From 8e230698baf2b2a2215706afae95df9cafe40e54 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Mon, 16 Feb 2015 14:55:39 +0000 Subject: [PATCH] [ROSAUTOTEST] - Add /n option to suppress console output. May or may not help to speed up testbot runs, but can't hurt to have in here. svn path=/trunk/; revision=66318 --- rostests/rosautotest/CConfiguration.cpp | 13 ++++++++----- rostests/rosautotest/CConfiguration.h | 2 ++ rostests/rosautotest/main.cpp | 1 + rostests/rosautotest/tools.cpp | 6 ++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/rostests/rosautotest/CConfiguration.cpp b/rostests/rosautotest/CConfiguration.cpp index 66e1bc33f58..2eb3799a8d3 100644 --- a/rostests/rosautotest/CConfiguration.cpp +++ b/rostests/rosautotest/CConfiguration.cpp @@ -16,14 +16,13 @@ typedef void (WINAPI *GETSYSINFO)(LPSYSTEM_INFO); * Constructs an empty CConfiguration object */ CConfiguration::CConfiguration() + : m_CrashRecovery(false), + m_PrintToConsole(true), + m_Shutdown(false), + m_Submit(false) { WCHAR WindowsDirectory[MAX_PATH]; - /* Zero-initialize variables */ - m_CrashRecovery = false; - m_Shutdown = false; - m_Submit = false; - /* Check if we are running under ReactOS from the SystemRoot directory */ if(!GetWindowsDirectoryW(WindowsDirectory, MAX_PATH)) FATAL("GetWindowsDirectoryW failed"); @@ -55,6 +54,10 @@ CConfiguration::ParseParameters(int argc, wchar_t* argv[]) m_Comment = UnicodeToAscii(argv[i]); break; + case 'n': + m_PrintToConsole = false; + break; + case 'r': m_CrashRecovery = true; break; diff --git a/rostests/rosautotest/CConfiguration.h b/rostests/rosautotest/CConfiguration.h index b65db7d6e5e..a5f5ea29620 100644 --- a/rostests/rosautotest/CConfiguration.h +++ b/rostests/rosautotest/CConfiguration.h @@ -10,6 +10,7 @@ class CConfiguration private: bool m_CrashRecovery; bool m_IsReactOS; + bool m_PrintToConsole; bool m_Shutdown; bool m_Submit; string m_Comment; @@ -26,6 +27,7 @@ public: void GetConfigurationFromFile(); bool DoCrashRecovery() const { return m_CrashRecovery; } + bool DoPrint() const { return m_PrintToConsole; } bool DoShutdown() const { return m_Shutdown; } bool DoSubmit() const { return m_Submit; } bool IsReactOS() const { return m_IsReactOS; } diff --git a/rostests/rosautotest/main.cpp b/rostests/rosautotest/main.cpp index 7165520991f..c5ae58f0296 100644 --- a/rostests/rosautotest/main.cpp +++ b/rostests/rosautotest/main.cpp @@ -23,6 +23,7 @@ IntPrintUsage() << " /c - Specifies the comment to be submitted to the Web Service." << endl << " Skips the comment set in the configuration file (if any)." << endl << " Only has an effect when /w is also used." << endl + << " /n - Do not print test output to console" << endl << " /r - Maintain information to resume from ReactOS crashes" << endl << " Can only be run under ReactOS and relies on sysreg2," << endl << " so incompatible with /w" << endl diff --git a/rostests/rosautotest/tools.cpp b/rostests/rosautotest/tools.cpp index 417e8091d1f..c925c145ad7 100644 --- a/rostests/rosautotest/tools.cpp +++ b/rostests/rosautotest/tools.cpp @@ -149,7 +149,8 @@ StringOut(const string& String, bool forcePrint) if(forcePrint == true || NewString[curr_pos - 1] == '\n') { /* Output the whole string */ - cout << NewString; + if(Configuration.DoPrint()) + cout << NewString; memcpy(DbgString, NewString.c_str() + start, size); DbgString[size] = 0; @@ -160,7 +161,8 @@ StringOut(const string& String, bool forcePrint) } /* Output full lines only */ - cout << NewString.substr(0, start); + if(Configuration.DoPrint()) + cout << NewString.substr(0, start); /* Return the remaining chunk */ return NewString.substr(start, size);