cmCTestCoverageCommand.cxx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmCTestCoverageCommand.h"
  11. #include "cmCTest.h"
  12. #include "cmCTestCoverageHandler.h"
  13. cmCTestCoverageCommand::cmCTestCoverageCommand()
  14. {
  15. this->LabelsMentioned = false;
  16. }
  17. cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
  18. {
  19. this->CTest->SetCTestConfigurationFromCMakeVariable(
  20. this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
  21. this->CTest->SetCTestConfigurationFromCMakeVariable(
  22. this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
  23. this->Quiet);
  24. cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>(
  25. this->CTest->GetInitializedHandler("coverage"));
  26. if (!handler) {
  27. this->SetError("internal CTest error. Cannot instantiate test handler");
  28. return CM_NULLPTR;
  29. }
  30. // If a LABELS option was given, select only files with the labels.
  31. if (this->LabelsMentioned) {
  32. handler->SetLabelFilter(this->Labels);
  33. }
  34. handler->SetQuiet(this->Quiet);
  35. return handler;
  36. }
  37. bool cmCTestCoverageCommand::CheckArgumentKeyword(std::string const& arg)
  38. {
  39. // Look for arguments specific to this command.
  40. if (arg == "LABELS") {
  41. this->ArgumentDoing = ArgumentDoingLabels;
  42. this->LabelsMentioned = true;
  43. return true;
  44. }
  45. // Look for other arguments.
  46. return this->Superclass::CheckArgumentKeyword(arg);
  47. }
  48. bool cmCTestCoverageCommand::CheckArgumentValue(std::string const& arg)
  49. {
  50. // Handle states specific to this command.
  51. if (this->ArgumentDoing == ArgumentDoingLabels) {
  52. this->Labels.insert(arg);
  53. return true;
  54. }
  55. // Look for other arguments.
  56. return this->Superclass::CheckArgumentValue(arg);
  57. }