summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-01-29 02:30:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-29 02:30:25 +0000
commit017da8bc58ba07be92dd371020e9dc3fe26f481b (patch)
tree5f5ff4d962cd9511a057c0a85454abd78a35edfa
parent43606bc1ce974e4ba42d7d2c3682ad5182e6fc96 (diff)
parent11c4353cdd9f78bdb36837ab0c97c41bb46d49ed (diff)
downloadbionic-017da8bc58ba07be92dd371020e9dc3fe26f481b.zip
bionic-017da8bc58ba07be92dd371020e9dc3fe26f481b.tar.gz
bionic-017da8bc58ba07be92dd371020e9dc3fe26f481b.tar.bz2
Merge "Add --gtest-filter as synonym for --gtest_filter in bionic gtest main."
-rw-r--r--tests/gtest_main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp
index b0740b0..e199449 100644
--- a/tests/gtest_main.cpp
+++ b/tests/gtest_main.cpp
@@ -91,6 +91,8 @@ static void PrintHelpInfo() {
" --warnline=[TIME_IN_MS]\n"
" Test running longer than [TIME_IN_MS] will be warned.\n"
" It takes effect only in isolation mode. Default warnline is 2000 ms.\n"
+ " --gtest-filter=POSITIVE_PATTERNS[-NEGATIVE_PATTERNS]\n"
+ " Used as a synonym for --gtest_filter option in gtest.\n"
"\nDefault bionic unit test option is -j.\n"
"\n");
}
@@ -720,6 +722,15 @@ static size_t GetProcessorCount() {
return static_cast<size_t>(sysconf(_SC_NPROCESSORS_ONLN));
}
+static void AddGtestFilterSynonym(std::vector<char*>& args) {
+ // Support --gtest-filter as a synonym for --gtest_filter.
+ for (size_t i = 1; i < args.size(); ++i) {
+ if (strncmp(args[i], "--gtest-filter", strlen("--gtest-filter")) == 0) {
+ args[i][7] = '_';
+ }
+ }
+}
+
struct IsolationTestOptions {
bool isolate;
size_t job_count;
@@ -748,6 +759,8 @@ static bool PickOptions(std::vector<char*>& args, IsolationTestOptions& options)
}
}
+ AddGtestFilterSynonym(args);
+
// if --bionic-selftest argument is used, only enable self tests, otherwise remove self tests.
bool enable_selftest = false;
for (size_t i = 1; i < args.size(); ++i) {