1 linking and running tests for travis.

This commit is contained in:
Ben Vanik 2016-01-01 20:54:36 +00:00
parent c93b93fe55
commit 5fb2c7cca1
2 changed files with 34 additions and 24 deletions

View File

@ -37,6 +37,9 @@ script:
- ./xenia-build lint --all - ./xenia-build lint --all
# Run style checker. # Run style checker.
#- ./xenia-build style #- ./xenia-build style
# Build and run our simple hello world test.
- ./xenia-build build --config=debug --target=xenia-base-tests
- ./build/bin/Linux/Debug/xenia-base-tests
# Build all of xenia. # Build all of xenia.
#- ./xenia-build build --config=debug #- ./xenia-build build --config=debug
# All tests (without haswell support). # All tests (without haswell support).

View File

@ -19,14 +19,32 @@
#include "third_party/catch/include/catch.hpp" #include "third_party/catch/include/catch.hpp"
namespace xe { namespace xe {
bool has_console_attached() { return true; } bool has_console_attached() { return true; }
} // namespace xe
// Used in console mode apps; automatically picked based on subsystem. // 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::SetUsageMessage(std::string("usage: ..."));
google::SetVersionString("1.0"); 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. // Convert all args to narrow, as gflags doesn't support wchar.
int argca = argc; int argca = argc;
char** argva = (char**)alloca(sizeof(char*) * argca); char** argva = (char**)alloca(sizeof(char*) * argca);
@ -35,19 +53,8 @@ int main(int argc, wchar_t* argv[]) {
argva[n] = (char*)alloca(len + 1); argva[n] = (char*)alloca(len + 1);
std::wcstombs(argva[n], argv[n], len + 1); std::wcstombs(argva[n], argv[n], len + 1);
} }
return xe::Main(argc, argva);
// 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;
} }
#else
extern "C" int main(int argc, char* argv[]) { return xe::Main(argc, argv); }
#endif // _WIN32