X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Funittest%2FUnitTestMain%2FTestMain.cpp;h=5387512e6fb54546aba2c82c0e000d344fc9714b;hb=2a4005688c05e26439ce83c0b1da482e3c346ba9;hp=4e4c210fcd2e32e1b3945db25c08f3aa9d1aee2c;hpb=6b096c35c7fae6e638138d698af7523edeafcac4;p=oota-llvm.git diff --git a/utils/unittest/UnitTestMain/TestMain.cpp b/utils/unittest/UnitTestMain/TestMain.cpp index 4e4c210fcd2..5387512e6fb 100644 --- a/utils/unittest/UnitTestMain/TestMain.cpp +++ b/utils/unittest/UnitTestMain/TestMain.cpp @@ -8,20 +8,27 @@ //===----------------------------------------------------------------------===// #include "llvm/Config/config.h" -#include "llvm/System/Signals.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Signals.h" #include "gtest/gtest.h" #if defined(LLVM_ON_WIN32) -# include +# include # if defined(_MSC_VER) # include # endif #endif +const char *TestMainArgv0; + int main(int argc, char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); testing::InitGoogleTest(&argc, argv); + llvm::cl::ParseCommandLineOptions(argc, argv); + + // Make it easy for a test to re-execute itself by saving argv[0]. + TestMainArgv0 = argv[0]; # if defined(LLVM_ON_WIN32) // Disable all of the possible ways Windows conspires to make automated @@ -29,12 +36,12 @@ int main(int argc, char **argv) { ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); # if defined(_MSC_VER) ::_set_error_mode(_OUT_TO_STDERR); - ::_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - ::_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - ::_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - ::_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); - ::_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - ::_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); # endif # endif