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

@@ -33,6 +33,7 @@
// POSSIBILITY OF SUCH DAMAGE.
#include <memory>
#include <string>
#include <gtest/gtest.h>
@@ -49,9 +50,19 @@ int main(int argc, char** argv)
glslangtest::GlobalTestSettings.initializer = initializer.get();
for (int i = 1; i < argc; ++i) {
if (!strncmp("--update-mode", argv[i], 13)) {
if (std::string("--update-mode") == argv[i]) {
glslangtest::GlobalTestSettings.updateMode = true;
break;
}
if (std::string("--test-root") == argv[i]) {
// Allow the user set the tets root directory. This is useful
// for testing with files from another source tree.
if (i + 1 < argc) {
glslangtest::GlobalTestSettings.testRoot = argv[i + 1];
i++;
} else {
printf("error: --test-root requires an argument\n");
return 1;
}
}
}