diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-05-31 21:32:40 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-05-31 21:32:40 (GMT) |
commit | f6e5a878fc8de3ac3ef38b144a0a649a9f227682 (patch) | |
tree | ea4927fdd1c147884fc63e19fc417d325f933411 /Source/cmCTest.h | |
parent | f963c406ab2877bb53b66ad60d701b5d7b46f406 (diff) | |
download | CMake-f6e5a878fc8de3ac3ef38b144a0a649a9f227682.zip CMake-f6e5a878fc8de3ac3ef38b144a0a649a9f227682.tar.gz CMake-f6e5a878fc8de3ac3ef38b144a0a649a9f227682.tar.bz2 |
ENH: Add support for writing output file. While doing that, redesign the way ctest does output. There may still be problems with commands failing, but that should be fixed by applying the similar concept to whole CMake
Diffstat (limited to 'Source/cmCTest.h')
-rw-r--r-- | Source/cmCTest.h | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/Source/cmCTest.h b/Source/cmCTest.h index b3996ff..33144b5 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -18,7 +18,6 @@ #ifndef cmCTest_h #define cmCTest_h - #include "cmStandardIncludes.h" #include "cmListFileCache.h" #include <time.h> @@ -28,6 +27,23 @@ class cmMakefile; class cmCTestGenericHandler; class cmGeneratedFileStream; +#define cmCTestLog(ctSelf, logType, msg) \ + do { \ + cmOStringStream cmCTestLog_msg; \ + cmCTestLog_msg << msg; \ + (ctSelf)->Log(cmCTest::logType, cmCTestLog_msg.str().c_str());\ + } while ( 0 ) + +#ifdef cerr +# undef cerr +#endif +#define cerr no_cerr_use_cmCTestLog + +#ifdef cout +# undef cout +#endif +#define cout no_cout_use_cmCTestLog + class cmCTest { public: @@ -57,9 +73,8 @@ public: /* * A utility function that returns the nightly time */ - static struct tm* GetNightlyTime(std::string str, - bool verbose, - bool tomorrowtag); + struct tm* GetNightlyTime(std::string str, + bool tomorrowtag); /* * Is the tomorrow tag set? @@ -134,7 +149,7 @@ public: //! Run command specialized for make and configure. Returns process status // and retVal is return value or exception. int RunMakeCommand(const char* command, std::string* output, - int* retVal, const char* dir, bool verbose, int timeout, + int* retVal, const char* dir, int timeout, std::ofstream& ofs); /* @@ -206,6 +221,24 @@ public: //! Create XML file that contains all the notes specified int GenerateNotesFile(const std::vector<cmStdString> &files); + + //! Set the output log file name + void SetOutputLogFileName(const char* name); + + //! Various log types + enum { + DEBUG = 0, + OUTPUT, + HANDLER_OUTPUT, + HANDLER_VERBOSE_OUTPUT, + WARNING, + ERROR, + OTHER + }; + + //! Add log to the output + void Log(int logType, const char* msg); + private: std::string m_ConfigType; bool m_Verbose; @@ -302,6 +335,29 @@ private: void FindRunningCMake(const char* arg0); bool m_SuppressUpdatingCTestConfiguration; + + bool m_Debug; + bool m_Quiet; + + + cmGeneratedFileStream* m_OutputLogFile; + int m_OutputLogFileLastTag; }; +class cmCTestLogWrite +{ +public: + cmCTestLogWrite(const char* data, size_t length) : Data(data), Length(length) {} + + const char* Data; + size_t Length; +}; + +inline std::ostream& operator<< (std::ostream& os, const cmCTestLogWrite& c) +{ + os.write(c.Data, c.Length); + os.flush(); + return os; +} + #endif |