2009-09-14 05:31:21 +08:00
|
|
|
//===--- utils/unittest/UnitTestMain/TestMain.cpp - unittest driver -------===//
|
2009-01-01 10:24:48 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-09-24 17:01:34 +08:00
|
|
|
#include "llvm/Config/config.h"
|
2010-11-30 02:16:10 +08:00
|
|
|
#include "llvm/Support/Signals.h"
|
2009-01-01 10:24:48 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2010-09-24 17:01:34 +08:00
|
|
|
|
|
|
|
#if defined(LLVM_ON_WIN32)
|
|
|
|
# include <Windows.h>
|
|
|
|
# if defined(_MSC_VER)
|
|
|
|
# include <crtdbg.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2009-01-01 10:24:48 +08:00
|
|
|
int main(int argc, char **argv) {
|
2010-09-24 17:01:34 +08:00
|
|
|
llvm::sys::PrintStackTraceOnErrorSignal();
|
2009-01-01 10:24:48 +08:00
|
|
|
testing::InitGoogleTest(&argc, argv);
|
2010-09-24 17:01:34 +08:00
|
|
|
|
|
|
|
# if defined(LLVM_ON_WIN32)
|
|
|
|
// Disable all of the possible ways Windows conspires to make automated
|
|
|
|
// testing impossible.
|
|
|
|
::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
|
|
|
# if defined(_MSC_VER)
|
|
|
|
::_set_error_mode(_OUT_TO_STDERR);
|
2010-10-02 11:26:54 +08:00
|
|
|
_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);
|
2010-09-24 17:01:34 +08:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
|
2009-01-01 10:24:48 +08:00
|
|
|
return RUN_ALL_TESTS();
|
|
|
|
}
|