Gtests can be run on another source tree

The gtest executable accepts a --test-root option to specify
a root directory for test files.  It defaults to the Test directory
in the source tree from which the executable is built.

For example, this lets us run test exectuables built with MinGW on Linux
on a Windows machine with its own copy of the source tree.
This commit is contained in:
David Neto
2016-10-05 10:25:09 -04:00
parent 196b6e24f6
commit 1d3a966106
13 changed files with 56 additions and 34 deletions

View File

@@ -36,6 +36,16 @@
namespace glslangtest {
GTestSettings GlobalTestSettings = {nullptr, false};
// We need CMake to provide us the absolute path to the directory containing
// test files, so we are certain to find those files no matter where the test
// harness binary is generated. This provides out-of-source build capability.
// This will be used as the default test root, but can be overridden with
// the --test-root argument.
#ifndef GLSLANG_TEST_DIRECTORY
#error \
"GLSLANG_TEST_DIRECTORY needs to be defined for gtest to locate test files."
#endif
GTestSettings GlobalTestSettings = {nullptr, false, GLSLANG_TEST_DIRECTORY};
} // namespace glslangtest