summaryrefslogtreecommitdiffstats
path: root/base/test
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-08 20:23:17 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-08 20:23:17 +0000
commitbe2148db0ab1ecba4c2d2d38d2bd86848190c758 (patch)
treee9def535efc2c989a844469c442df65622cb8180 /base/test
parent3cfdd955a1b7df5dbbb62681d85261de3a44f642 (diff)
downloadchromium_src-be2148db0ab1ecba4c2d2d38d2bd86848190c758.zip
chromium_src-be2148db0ab1ecba4c2d2d38d2bd86848190c758.tar.gz
chromium_src-be2148db0ab1ecba4c2d2d38d2bd86848190c758.tar.bz2
Revert 233963 "Revert 233960 "GTTF: Make test launcher unset GTE..."
> Revert 233960 "GTTF: Make test launcher unset GTEST_ env variabl..." > > > GTTF: Make test launcher unset GTEST_ env variables since it handles all of sharding. > > > > This is a relanding of https://codereview.chromium.org/60983004/ which checks > > for variable existence before unsetting to avoid failing on Windows XP. > > > > BUG=236893 > > R=kbr@chromium.org > > > > Review URL: https://codereview.chromium.org/67183003 > > TBR=phajdan.jr@chromium.org > > Review URL: https://codereview.chromium.org/66603005 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/64623004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/test')
-rw-r--r--base/test/launcher/test_launcher.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index f7f9679..08a573b 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -166,6 +166,18 @@ bool TakeInt32FromEnvironment(const char* const var, int32* result) {
return true;
}
+// Unsets the environment variable |name| and returns true on success.
+// Also returns true if the variable just doesn't exist.
+bool UnsetEnvironmentVariableIfExists(const std::string& name) {
+ scoped_ptr<Environment> env(Environment::Create());
+ std::string str_val;
+
+ if (!env->GetVar(name.c_str(), &str_val))
+ return true;
+
+ return env->UnSetVar(name.c_str());
+}
+
// For a basic pattern matching for gtest_filter options. (Copied from
// gtest.cc, see the comment below and http://crbug.com/44497)
bool PatternMatchesString(const char* pattern, const char* str) {
@@ -616,6 +628,11 @@ bool TestLauncher::Init() {
return false;
}
+ // Make sure we don't pass any sharding-related environment to the child
+ // processes. This test launcher implements the sharding completely.
+ CHECK(UnsetEnvironmentVariableIfExists("GTEST_TOTAL_SHARDS"));
+ CHECK(UnsetEnvironmentVariableIfExists("GTEST_SHARD_INDEX"));
+
if (command_line->HasSwitch(kGTestRepeatFlag) &&
!StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag),
&cycles_)) {