1 //===--- utils/unittest/UnitTestMain/TestMain.cpp - unittest driver -------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/Config/config.h"
11 #include "llvm/Support/Signals.h"
12 #include "gtest/gtest.h"
15 #if defined(LLVM_ON_WIN32)
17 # if defined(_MSC_VER)
22 int main(int argc
, char **argv
) {
23 llvm::sys::PrintStackTraceOnErrorSignal();
24 testing::InitGoogleTest(&argc
, argv
);
26 # if defined(LLVM_ON_WIN32)
27 // Disable all of the possible ways Windows conspires to make automated
28 // testing impossible.
29 ::SetErrorMode(SEM_FAILCRITICALERRORS
| SEM_NOGPFAULTERRORBOX
);
30 # if defined(_MSC_VER)
31 ::_set_error_mode(_OUT_TO_STDERR
);
32 _CrtSetReportMode(_CRT_WARN
, _CRTDBG_MODE_FILE
| _CRTDBG_MODE_DEBUG
);
33 _CrtSetReportFile(_CRT_WARN
, _CRTDBG_FILE_STDERR
);
34 _CrtSetReportMode(_CRT_ERROR
, _CRTDBG_MODE_FILE
| _CRTDBG_MODE_DEBUG
);
35 _CrtSetReportFile(_CRT_ERROR
, _CRTDBG_FILE_STDERR
);
36 _CrtSetReportMode(_CRT_ASSERT
, _CRTDBG_MODE_FILE
| _CRTDBG_MODE_DEBUG
);
37 _CrtSetReportFile(_CRT_ASSERT
, _CRTDBG_FILE_STDERR
);
41 return RUN_ALL_TESTS();