diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 19:50:12 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 19:50:12 +0000 |
commit | 7e40f180b28951bc84ba636d93929d0494747619 (patch) | |
tree | 062c86ffa2d0022a4f154393dd6acc4ad2f116f7 | |
parent | b48ecd2d9291f75c05a2aa55a3cc274d2234c0f7 (diff) | |
download | chromium_src-7e40f180b28951bc84ba636d93929d0494747619.zip chromium_src-7e40f180b28951bc84ba636d93929d0494747619.tar.gz chromium_src-7e40f180b28951bc84ba636d93929d0494747619.tar.bz2 |
Add support for startup_tests to tools/valgrind/chrome_tests.py
Also fix a typo and an 80 col nit in its list of tests.
Review URL: http://codereview.chromium.org/79043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13957 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/startup/startup_test.cc | 19 | ||||
-rwxr-xr-x | tools/valgrind/chrome_tests.py | 51 |
2 files changed, 47 insertions, 23 deletions
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index c63629a..80bfeab 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -30,10 +30,19 @@ class StartupTest : public UITest { void RunStartupTest(const char* graph, const char* trace, bool test_cold, bool important) { - const int kNumCycles = 20; - - TimeDelta timings[kNumCycles]; - for (int i = 0; i < kNumCycles; ++i) { + const int kNumCyclesMax = 20; + int numCycles = kNumCyclesMax; +// It's ok for unit test code to use getenv(), isn't it? +#if defined(OS_WIN) +#pragma warning( disable : 4996 ) +#endif + const char* numCyclesEnv = getenv("STARTUP_TESTS_NUMCYCLES"); + if (numCyclesEnv && StringToInt(numCyclesEnv, &numCycles)) + LOG(INFO) << "STARTUP_TESTS_NUMCYCLES set in environment, " + << "so setting numCycles to " << numCycles; + + TimeDelta timings[kNumCyclesMax]; + for (int i = 0; i < numCycles; ++i) { if (test_cold) { FilePath dir_app; ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app)); @@ -70,7 +79,7 @@ class StartupTest : public UITest { } std::string times; - for (int i = 0; i < kNumCycles; ++i) + for (int i = 0; i < numCycles; ++i) StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); PrintResultList(graph, "", trace, times, "ms", important); } diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py index 3bea91b..323bfe6 100755 --- a/tools/valgrind/chrome_tests.py +++ b/tools/valgrind/chrome_tests.py @@ -44,16 +44,17 @@ class ChromeTests: # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { - "base": self.TestBase, "base_unittests": self.TestBase, - "googleurl": self.TestGoogleurl, "googleurl_tests": self.TestGoogleurl, - "ipc": self.TestIpc, "ipc_tests": self.TestIpc, - "layout": self.TestLayout, "layout_tests": self.TestLayout, - "media": self.TestMedia, "media_unittests": self.TestMedia, - "net": self.TestNet, "net_unittests": self.TestNet, - "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, - "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, - "ui": self.TestUI, "ui_tests": self.TestUI, - "unit": self.TestUnit, "unit_tests": self.TestUnit, + "base": self.TestBase, "base_unittests": self.TestBase, + "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, + "ipc": self.TestIpc, "ipc_tests": self.TestIpc, + "layout": self.TestLayout, "layout_tests": self.TestLayout, + "media": self.TestMedia, "media_unittests": self.TestMedia, + "net": self.TestNet, "net_unittests": self.TestNet, + "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, + "startup": self.TestStartup, "startup_tests": self.TestStartup, + "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, + "ui": self.TestUI, "ui_tests": self.TestUI, + "unit": self.TestUnit, "unit_tests": self.TestUnit, } if test not in self._test_list: @@ -76,7 +77,7 @@ class ChromeTests: self._command_preamble = ["python", valgrind_test, "--source_dir=%s" % (self._source_dir)] - def _DefaultCommand(self, module, exe=None): + def _DefaultCommand(self, module, exe=None, valgrind_test_args=None): '''Generates the default command array that most tests will use.''' module_dir = os.path.join(self._source_dir, module) @@ -143,9 +144,9 @@ class ChromeTests: cmd.append("--track_origins") if self._options.generate_suppressions: cmd.append("--generate_suppressions") - if exe == "ui_tests": - cmd.append("--trace_children") - cmd.append("--indirect") + if valgrind_test_args != None: + for arg in valgrind_test_args: + cmd.append(arg) if exe: cmd.append(os.path.join(self._options.build_dir, exe)) # Valgrind runs tests slowly, so slow tests hurt more; show elapased time @@ -184,17 +185,18 @@ class ChromeTests: if gtest_filter: cmd.append("--gtest_filter=%s" % gtest_filter) - def SimpleTest(self, module, name, cmd_args=None): - cmd = self._DefaultCommand(module, name) + def SimpleTest(self, module, name, valgrind_test_args=None, cmd_args=None): + cmd = self._DefaultCommand(module, name, valgrind_test_args) self._ReadGtestFilterFile(name, cmd) if cmd_args: + cmd.extend(["--"]) cmd.extend(cmd_args) return common.RunSubprocess(cmd, 0) def TestBase(self): return self.SimpleTest("base", "base_unittests") - def TestGoogleurl(self): + def TestGURL(self): return self.SimpleTest("chrome", "googleurl_unittests") def TestMedia(self): @@ -209,6 +211,16 @@ class ChromeTests: def TestNet(self): return self.SimpleTest("net", "net_unittests") + def TestStartup(self): + # We don't need the performance results, we're just looking for pointer + # errors, so set number of iterations down to the minimum. + os.putenv("STARTUP_TESTS_NUMCYCLES", "1") + logging.info("export STARTUP_TESTS_NUMCYCLES=1"); + return self.SimpleTest("chrome", "startup_tests", + valgrind_test_args=[ + "--trace_children", + "--indirect"]) + def TestTestShell(self): return self.SimpleTest("webkit", "test_shell_tests") @@ -217,7 +229,10 @@ class ChromeTests: def TestUI(self): return self.SimpleTest("chrome", "ui_tests", - cmd_args=["--", + valgrind_test_args=[ + "--trace_children", + "--indirect"], + cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000"]) |