Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CTest / cmCTestMemCheckHandler.h
blob593685e82d59342b9d50e0dc4e9228ef76faac4e
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCTestMemCheckHandler.h,v $
5 Language: C++
6 Date: $Date: 2007/07/24 18:43:31 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 2002 Kitware, Inc. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef cmCTestMemCheckHandler_h
19 #define cmCTestMemCheckHandler_h
22 #include "cmCTestTestHandler.h"
23 #include "cmListFileCache.h"
25 class cmMakefile;
27 /** \class cmCTestMemCheckHandler
28 * \brief A class that handles ctest -S invocations
31 class cmCTestMemCheckHandler : public cmCTestTestHandler
33 public:
34 cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
36 void PopulateCustomVectors(cmMakefile *mf);
38 cmCTestMemCheckHandler();
40 void Initialize();
41 protected:
42 virtual int PreProcessHandler();
43 virtual int PostProcessHandler();
44 virtual void GenerateTestCommand(std::vector<const char*>& args);
46 private:
48 enum { // Memory checkers
49 UNKNOWN = 0,
50 VALGRIND,
51 PURIFY,
52 BOUNDS_CHECKER
54 public:
55 enum { // Memory faults
56 ABR = 0,
57 ABW,
58 ABWL,
59 COR,
60 EXU,
61 FFM,
62 FIM,
63 FMM,
64 FMR,
65 FMW,
66 FUM,
67 IPR,
68 IPW,
69 MAF,
70 MLK,
71 MPK,
72 NPR,
73 ODS,
74 PAR,
75 PLK,
76 UMC,
77 UMR,
78 NO_MEMORY_FAULT
80 private:
81 enum { // Program statuses
82 NOT_RUN = 0,
83 TIMEOUT,
84 SEGFAULT,
85 ILLEGAL,
86 INTERRUPT,
87 NUMERICAL,
88 OTHER_FAULT,
89 FAILED,
90 BAD_COMMAND,
91 COMPLETED
93 std::string BoundsCheckerDPBDFile;
94 std::string BoundsCheckerXMLFile;
95 std::string MemoryTester;
96 std::vector<cmStdString> MemoryTesterOptionsParsed;
97 std::string MemoryTesterOptions;
98 int MemoryTesterStyle;
99 std::string MemoryTesterOutputFile;
100 int MemoryTesterGlobalResults[NO_MEMORY_FAULT];
102 ///! Initialize memory checking subsystem.
103 bool InitializeMemoryChecking();
106 * Generate the Dart compatible output
108 void GenerateDartOutput(std::ostream& os);
110 std::vector<cmStdString> CustomPreMemCheck;
111 std::vector<cmStdString> CustomPostMemCheck;
113 //! Parse Valgrind/Purify/Bounds Checker result out of the output
114 //string. After running, log holds the output and results hold the
115 //different memmory errors.
116 bool ProcessMemCheckOutput(const std::string& str,
117 std::string& log, int* results);
118 bool ProcessMemCheckValgrindOutput(const std::string& str,
119 std::string& log, int* results);
120 bool ProcessMemCheckPurifyOutput(const std::string& str,
121 std::string& log, int* results);
122 bool ProcessMemCheckBoundsCheckerOutput(const std::string& str,
123 std::string& log, int* results);
125 * Run one test
127 virtual void ProcessOneTest(cmCTestTestProperties *props,
128 std::vector<cmStdString> &passed,
129 std::vector<cmStdString> &failed,
130 int count, int tmsize);
131 void PostProcessPurifyTest(cmCTestTestResult& res);
132 void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
135 #endif