summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 08:43:28 +0000
committerglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 08:43:28 +0000
commit29cd97871e733952ab4e05b5d9d7ea79d3a339d9 (patch)
tree28539023582ff06852c1b77a939eeb8d48839870
parent5a446c945ae2058f0b20bfc2dfa7d3e02fe33196 (diff)
downloadchromium_src-29cd97871e733952ab4e05b5d9d7ea79d3a339d9.zip
chromium_src-29cd97871e733952ab4e05b5d9d7ea79d3a339d9.tar.gz
chromium_src-29cd97871e733952ab4e05b5d9d7ea79d3a339d9.tar.bz2
Multiply the timeouts by 2 if the tests are ran under AddressSanitizer.
I've preferred using kTimeoutMultiplier only once to duplicating it for each timeout. This however makes InitializeTimeout(0, 0, &value) non-unipotent. BUG=103371 Review URL: http://codereview.chromium.org/8510053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110058 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/test/test_timeouts.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/base/test/test_timeouts.cc b/base/test/test_timeouts.cc
index 524e85e..dc7f243 100644
--- a/base/test/test_timeouts.cc
+++ b/base/test/test_timeouts.cc
@@ -11,10 +11,18 @@
namespace {
+#ifdef ADDRESS_SANITIZER
+static const int kTimeoutMultiplier = 2;
+#else
+static const int kTimeoutMultiplier = 1;
+#endif
+
// Sets value to the greatest of:
-// 1) value's current value.
+// 1) value's current value multiplied by kTimeoutMultiplier (assuming
+// InitializeTimeout is called only once per value).
// 2) min_value.
-// 3) the numerical value given by switch_name on the command line.
+// 3) the numerical value given by switch_name on the command line multiplied
+// by kTimeoutMultiplier.
void InitializeTimeout(const char* switch_name, int min_value, int* value) {
DCHECK(value);
if (CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) {
@@ -24,13 +32,15 @@ void InitializeTimeout(const char* switch_name, int min_value, int* value) {
base::StringToInt(string_value, &timeout);
*value = std::max(*value, timeout);
}
+ *value *= kTimeoutMultiplier;
*value = std::max(*value, min_value);
}
// Sets value to the greatest of:
-// 1) value's current value.
+// 1) value's current value multiplied by kTimeoutMultiplier.
// 2) 0
-// 3) the numerical value given by switch_name on the command line.
+// 3) the numerical value given by switch_name on the command line multiplied
+// by kTimeoutMultiplier.
void InitializeTimeout(const char* switch_name, int* value) {
InitializeTimeout(switch_name, 0, value);
}