[PerformanceTests] tests have dependencies
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 10:24:29 +0000 (10:24 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 10:24:29 +0000 (10:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77506

Reviewed by Hajime Morita.

PerformanceTests:

* resources/init.html: Added.

Tools:

Load an initialization page before each test after starting a DRT so that
warming up DRT won't affect the performance test results.

* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner):
(PerfTestsRunner.__init__):
(PerfTestsRunner._run_tests_set):
(PerfTestsRunner._run_single_test):
* Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
(MainTest.TestDriver.run_test):
(test_initial_page_loaded):
(test_initial_page_loaded.run_test):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106543 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/resources/init.html [new file with mode: 0644]
Tools/ChangeLog
Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py

index 7f68d8d..ca46d96 100644 (file)
@@ -1,3 +1,12 @@
+2012-02-02  Ryosuke Niwa  <rniwa@webkit.org>
+
+        [PerformanceTests] tests have dependencies
+        https://bugs.webkit.org/show_bug.cgi?id=77506
+
+        Reviewed by Hajime Morita.
+
+        * resources/init.html: Added.
+
 2012-02-01  Ryosuke Niwa  <rniwa@webkit.org>
 
         Fix after r106386. The empty anchor element was generating an erroneous whitespace.
diff --git a/PerformanceTests/resources/init.html b/PerformanceTests/resources/init.html
new file mode 100644 (file)
index 0000000..97173fe
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This file is used by run-perf-tests between each test to marginalize the dependency between tests.
+This file is not intended to be opened on a browser.</p>
+<script>
+
+if (window.layoutTestController) {
+    GCController.collect();
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+    // Give 5 seconds to cleanup the mess the last page left.
+    setTimeout(function () { layoutTestController.notifyDone(); }, 5000);
+    document.querySelector('p').innerHTML = 'PASS';
+}
+
+
+</script>
+</body>
+</html>
index b00bf1d..b29551a 100644 (file)
@@ -1,5 +1,25 @@
 2012-02-02  Ryosuke Niwa  <rniwa@webkit.org>
 
+        [PerformanceTests] tests have dependencies
+        https://bugs.webkit.org/show_bug.cgi?id=77506
+
+        Reviewed by Hajime Morita.
+
+        Load an initialization page before each test after starting a DRT so that
+        warming up DRT won't affect the performance test results.
+
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner):
+        (PerfTestsRunner.__init__):
+        (PerfTestsRunner._run_tests_set):
+        (PerfTestsRunner._run_single_test):
+        * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
+        (MainTest.TestDriver.run_test):
+        (test_initial_page_loaded):
+        (test_initial_page_loaded.run_test):
+
+2012-02-02  Ryosuke Niwa  <rniwa@webkit.org>
+
         Re-land r106442 per Adam's suggestion. We'll do both restarting DRT and loading a fake test first.
 
         * Scripts/webkitpy/performance_tests/perftestsrunner.py:
index 4d88d56..097a537 100644 (file)
@@ -47,6 +47,7 @@ _log = logging.getLogger(__name__)
 
 class PerfTestsRunner(object):
     _perf_tests_base_dir = 'PerformanceTests'
+    _initial_page_relative_path = 'resources/init.html'
     _test_directories_for_chromium_style_tests = ['inspector']
     _default_branch = 'webkit-trunk'
     _EXIT_CODE_BAD_BUILD = -1
@@ -66,6 +67,7 @@ class PerfTestsRunner(object):
         self._printer = printing.Printer(self._port, self._options, regular_output, buildbot_output, configure_logging=False)
         self._webkit_base_dir_len = len(self._port.webkit_base())
         self._base_path = self._port.perf_tests_dir()
+        self._initial_page_path = self._host.filesystem.join(self._base_path, self._initial_page_relative_path)
         self._results = {}
         self._timestamp = time.time()
 
@@ -202,7 +204,6 @@ class PerfTestsRunner(object):
         result_count = len(tests)
         expected = 0
         unexpected = 0
-        driver = None
 
         for test in tests:
             driver = port.create_driver(worker_number=1, no_timeout=True)
@@ -282,6 +283,9 @@ class PerfTestsRunner(object):
 
     def _run_single_test(self, test, driver, is_chromium_style):
         test_failed = False
+        output = driver.run_test(DriverInput(self._initial_page_path, 10000, None, False))
+        if output.text != 'PASS\n':
+            self._printer.write('Initialization page failed to load.')
         output = driver.run_test(DriverInput(test, self._options.time_out_ms, None, False))
 
         if output.text == None:
index 58bd377..56f052e 100755 (executable)
@@ -49,7 +49,9 @@ class MainTest(unittest.TestCase):
             text = ''
             timeout = False
             crash = False
-            if driver_input.test_name.endswith('pass.html'):
+            if driver_input.test_name.endswith('init.html'):
+                text = 'PASS\n'
+            elif driver_input.test_name.endswith('pass.html'):
                 text = 'RESULT group_name: test_name= 42 ms'
             elif driver_input.test_name.endswith('timeout.html'):
                 timeout = True
@@ -123,6 +125,24 @@ max 1120
         driver = MainTest.TestDriver()
         return runner._run_single_test(test_name, driver, is_chromium_style=True)
 
+    def test_initial_page_loaded(self):
+        runner = self.create_runner()
+        driver = MainTest.TestDriver()
+        inputs = []
+
+        def run_test(input):
+            inputs.append(input)
+            if input.test_name.endswith('init.html'):
+                return DriverOutput('PASS\n', 'image output', 'some hash', None)
+            else:
+                return DriverOutput('RESULT group_name: test_name= 42 ms\n', 'image output', 'some hash', None)
+
+        driver.run_test = run_test
+        self.assertTrue(runner._run_single_test('pass.html', driver, is_chromium_style=True))
+        self.assertEqual(len(inputs), 2)
+        self.assertEqual(inputs[0].test_name, runner._base_path + '/resources/init.html')
+        self.assertEqual(inputs[1].test_name, 'pass.html')
+
     def test_run_passing_test(self):
         self.assertTrue(self.run_test('pass.html'))