cmCTestCoverageHandler.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmCTestCoverageHandler_h
  14. #define cmCTestCoverageHandler_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmListFileCache.h"
  17. class cmCTest;
  18. /** \class cmCTestCoverageHandler
  19. * \brief A class that handles coverage computaiton for ctest
  20. *
  21. */
  22. class cmCTestCoverageHandler
  23. {
  24. public:
  25. /*
  26. * The main entry point for this class
  27. */
  28. int CoverageDirectory(cmCTest *);
  29. /*
  30. * If verbose then more informaiton is printed out
  31. */
  32. void SetVerbose(bool val) { m_Verbose = val; }
  33. cmCTestCoverageHandler();
  34. private:
  35. bool m_Verbose;
  36. cmCTest *m_CTest;
  37. bool ShouldIDoCoverage(const char* file, const char* srcDir,
  38. const char* binDir, bool verbose);
  39. bool StartLogFile(std::ofstream& ostr, int logFileCount);
  40. void EndLogFile(std::ofstream& ostr, int logFileCount);
  41. struct cmCTestCoverage
  42. {
  43. cmCTestCoverage()
  44. {
  45. m_AbsolutePath = "";
  46. m_FullPath = "";
  47. m_Covered = false;
  48. m_Tested = 0;
  49. m_UnTested = 0;
  50. m_Lines.clear();
  51. m_Show = false;
  52. }
  53. std::string m_AbsolutePath;
  54. std::string m_FullPath;
  55. bool m_Covered;
  56. int m_Tested;
  57. int m_UnTested;
  58. std::vector<int> m_Lines;
  59. bool m_Show;
  60. };
  61. typedef std::map<std::string, cmCTestCoverage> tm_CoverageMap;
  62. };
  63. #endif