diff options
| author | Ben Vanik <ben.vanik@gmail.com> | 2016-01-01 20:54:36 +0000 |
|---|---|---|
| committer | Ben Vanik <ben.vanik@gmail.com> | 2016-01-01 20:55:32 +0000 |
| commit | 5fb2c7cca1d03a763266d1bd78637bb0aef35b79 (patch) | |
| tree | 461d0d4186a20b69d2e83aa0716da1c9dc29ccd1 /tools | |
| parent | c93b93fe55377884371f86330c61ff84925208ec (diff) | |
1 linking and running tests for travis.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/build/src/test_suite_main.cc | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/tools/build/src/test_suite_main.cc b/tools/build/src/test_suite_main.cc index 607811bc4..3a3f577a1 100644 --- a/tools/build/src/test_suite_main.cc +++ b/tools/build/src/test_suite_main.cc @@ -1,11 +1,11 @@ /** -****************************************************************************** -* Xenia : Xbox 360 Emulator Research Project * -****************************************************************************** -* Copyright 2015 Ben Vanik. All rights reserved. * -* Released under the BSD license - see LICENSE in the root for more details. * -****************************************************************************** -*/ + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ #include <gflags/gflags.h> @@ -19,14 +19,32 @@ #include "third_party/catch/include/catch.hpp" namespace xe { + bool has_console_attached() { return true; } -} // namespace xe // Used in console mode apps; automatically picked based on subsystem. -int main(int argc, wchar_t* argv[]) { +int Main(int argc, char* argv[]) { google::SetUsageMessage(std::string("usage: ...")); google::SetVersionString("1.0"); + // Parse flags; this may delete some of them. + google::ParseCommandLineFlags(&argc, &argv, true); + + // Run Catch. + int result = Catch::Session().run(argc, argv); + + google::ShutDownCommandLineFlags(); + return result; +} + +} // namespace xe + +#if _WIN32 +extern "C" int main(int argc, wchar_t* argv[]) { + // Setup COM on the main thread. + // NOTE: this may fail if COM has already been initialized - that's OK. + CoInitializeEx(nullptr, COINIT_MULTITHREADED); + // Convert all args to narrow, as gflags doesn't support wchar. int argca = argc; char** argva = (char**)alloca(sizeof(char*) * argca); @@ -35,19 +53,8 @@ int main(int argc, wchar_t* argv[]) { argva[n] = (char*)alloca(len + 1); std::wcstombs(argva[n], argv[n], len + 1); } - - // Parse flags; this may delete some of them. - google::ParseCommandLineFlags(&argc, &argva, true); - -#if _WIN32 - // Setup COM on the main thread. - // NOTE: this may fail if COM has already been initialized - that's OK. - CoInitializeEx(nullptr, COINIT_MULTITHREADED); -#endif // _WIN32 - - // Run Catch. - int result = Catch::Session().run(argc, argva); - - google::ShutDownCommandLineFlags(); - return result; + return xe::Main(argc, argva); } +#else +extern "C" int main(int argc, char* argv[]) { return xe::Main(argc, argv); } +#endif // _WIN32 |
