summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2015-07-14 21:49:27 +0000
committerkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2015-07-14 21:49:27 +0000
commitfb83793a0b602a1a522de4dfa1a9fe06fbcc263e (patch)
tree56acd5e60d21c8130bcfad0e1dd6c7e7b101a33f
parent8e3586d50e85d651c66aa6d79564392258a5a5f1 (diff)
downloadgoogletest-fb83793a0b602a1a522de4dfa1a9fe06fbcc263e.tar.gz
Change GetDefaultFilter to allow for the injection of a custom filter.
git-svn-id: http://googletest.googlecode.com/svn/trunk@721 861a406c-534a-0410-8894-cb66d6ee9925
-rw-r--r--include/gtest/internal/custom/gtest-port.h5
-rw-r--r--src/gtest.cc6
2 files changed, 11 insertions, 0 deletions
diff --git a/include/gtest/internal/custom/gtest-port.h b/include/gtest/internal/custom/gtest-port.h
index 3083b8e..b31810d 100644
--- a/include/gtest/internal/custom/gtest-port.h
+++ b/include/gtest/internal/custom/gtest-port.h
@@ -39,6 +39,11 @@
// GTEST_DEFINE_int32_(name, default_val, doc)
// GTEST_DEFINE_string_(name, default_val, doc)
//
+// Test filtering:
+// GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
+// will be used if --GTEST_FLAG(test_filter)
+// is not provided.
+//
// Logging:
// GTEST_LOG_(severity)
// GTEST_CHECK_(condition)
diff --git a/src/gtest.cc b/src/gtest.cc
index 8b76707..6dea6c6 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -189,6 +189,12 @@ bool g_help_flag = false;
} // namespace internal
static const char* GetDefaultFilter() {
+#ifdef GTEST_TEST_FILTER_ENV_VAR_
+ const char* const testbridge_test_only = getenv(GTEST_TEST_FILTER_ENV_VAR_);
+ if (testbridge_test_only != NULL) {
+ return testbridge_test_only;
+ }
+#endif // GTEST_TEST_FILTER_ENV_VAR_
return kUniversalFilter;
}