Permalink
Browse files

First commit of new tools/run-tests.py

  • Loading branch information...
1 parent 7b114fa commit 4dfbfcc2948e55c1a4ee2edc8545161575b8cbd2 jkummerow@chromium.org committed Sep 24, 2012
Showing with 5,075 additions and 51 deletions.
  1. +9 −0 .gitignore
  2. +5 −0 test/benchmarks/testcfg.py
  3. +59 −4 test/cctest/testcfg.py
  4. +5 −0 test/es5conform/testcfg.py
  5. +82 −2 test/message/testcfg.py
  6. +26 −26 test/message/try-catch-finally-no-message.out
  7. +74 −3 test/mjsunit/testcfg.py
  8. +121 −3 test/mozilla/testcfg.py
  9. +101 −5 test/preparser/testcfg.py
  10. +5 −0 test/sputnik/testcfg.py
  11. +96 −8 test/test262/testcfg.py
  12. +1 −0 tools/presubmit.py
  13. +356 −0 tools/run-tests.py
  14. +39 −0 tools/status-file-converter.py
  15. +217 −0 tools/test-server.py
  16. +174 −0 tools/testrunner/README
  17. +26 −0 tools/testrunner/__init__.py
  18. +26 −0 tools/testrunner/local/__init__.py
  19. +152 −0 tools/testrunner/local/commands.py
  20. +154 −0 tools/testrunner/local/execution.py
  21. +460 −0 tools/testrunner/local/old_statusfile.py
  22. +237 −0 tools/testrunner/local/progress.py
  23. +145 −0 tools/testrunner/local/statusfile.py
  24. +181 −0 tools/testrunner/local/testsuite.py
  25. +108 −0 tools/testrunner/local/utils.py
  26. +99 −0 tools/testrunner/local/verbose.py
  27. +26 −0 tools/testrunner/network/__init__.py
  28. +90 −0 tools/testrunner/network/distro.py
  29. +114 −0 tools/testrunner/network/endpoint.py
  30. +243 −0 tools/testrunner/network/network_execution.py
  31. +120 −0 tools/testrunner/network/perfdata.py
  32. +26 −0 tools/testrunner/objects/__init__.py
  33. +50 −0 tools/testrunner/objects/context.py
  34. +60 −0 tools/testrunner/objects/output.py
  35. +80 −0 tools/testrunner/objects/peer.py
  36. +83 −0 tools/testrunner/objects/testcase.py
  37. +90 −0 tools/testrunner/objects/workpacket.py
  38. +26 −0 tools/testrunner/server/__init__.py
  39. +112 −0 tools/testrunner/server/compression.py
  40. +51 −0 tools/testrunner/server/constants.py
  41. +147 −0 tools/testrunner/server/daemon.py
  42. +119 −0 tools/testrunner/server/local_handler.py
  43. +245 −0 tools/testrunner/server/main.py
  44. +120 −0 tools/testrunner/server/presence_handler.py
  45. +63 −0 tools/testrunner/server/signatures.py
  46. +113 −0 tools/testrunner/server/status_handler.py
  47. +139 −0 tools/testrunner/server/work_handler.py
View
@@ -27,10 +27,19 @@ shell_g
/build/Release
/obj/
/out/
+/test/cctest/cctest.status2
/test/es5conform/data
+/test/messages/messages.status2
+/test/mjsunit/mjsunit.status2
+/test/mozilla/CHECKED_OUT_VERSION
/test/mozilla/data
+/test/mozilla/downloaded_*
+/test/mozilla/mozilla.status2
+/test/preparser/preparser.status2
/test/sputnik/sputniktests
/test/test262/data
+/test/test262/test262-*
+/test/test262/test262.status2
/third_party
/tools/jsfunfuzz
/tools/jsfunfuzz.zip
@@ -30,6 +30,11 @@
import os
from os.path import join, split
+def GetSuite(name, root):
+ # Not implemented.
+ return None
+
+
def IsNumber(string):
try:
float(string)
View
@@ -25,11 +25,66 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import test
import os
-from os.path import join, dirname, exists
-import platform
-import utils
+import shutil
+
+from testrunner.local import commands
+from testrunner.local import testsuite
+from testrunner.local import utils
+from testrunner.objects import testcase
+
+
+class CcTestSuite(testsuite.TestSuite):
+
+ def __init__(self, name, root):
+ super(CcTestSuite, self).__init__(name, root)
+ self.serdes_dir = normpath(join(root, "..", "..", "out", ".serdes"))
+ if exists(self.serdes_dir):
+ shutil.rmtree(self.serdes_dir, True)
+ os.makedirs(self.serdes_dir)
+
+ def ListTests(self, context):
+ shell = join(context.shell_dir, self.shell())
+ if utils.IsWindows():
+ shell += '.exe'
+ output = commands.Execute([shell, '--list'])
+ if output.exit_code != 0:
+ print output.stdout
+ print output.stderr
+ return []
+ tests = []
+ for test_desc in output.stdout.strip().split():
+ raw_test, dependency = test_desc.split('<')
+ if dependency != '':
+ dependency = raw_test.split('/')[0] + '/' + dependency
+ else:
+ dependency = None
+ test = testcase.TestCase(self, raw_test, dependency=dependency)
+ tests.append(test)
+ tests.sort()
+ return tests
+
+ def GetFlagsForTestCase(self, testcase, context):
+ testname = testcase.path.split(os.path.sep)[-1]
+ serialization_file = join(self.serdes_dir, "serdes_" + testname)
+ serialization_file += ''.join(testcase.flags).replace('-', '_')
+ return (testcase.flags + [testcase.path] + context.mode_flags +
+ ["--testing_serialization_file=" + serialization_file])
+
+ def shell(self):
+ return "cctest"
+
+
+def GetSuite(name, root):
+ return CcTestSuite(name, root)
+
+
+# Deprecated definitions below.
+# TODO(jkummerow): Remove when SCons is no longer supported.
+
+
+from os.path import exists, join, normpath
+import test
class CcTestCase(test.TestCase):
@@ -31,6 +31,11 @@
from os.path import join, exists
+def GetSuite(name, root):
+ # Not implemented.
+ return None
+
+
HARNESS_FILES = ['sth.js']
View
@@ -25,13 +25,93 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import test
+import itertools
import os
-from os.path import join, dirname, exists, basename, isdir
import re
+from testrunner.local import testsuite
+from testrunner.local import utils
+from testrunner.objects import testcase
+
+
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
+
+class MessageTestSuite(testsuite.TestSuite):
+ def __init__(self, name, root):
+ super(MessageTestSuite, self).__init__(name, root)
+
+ def ListTests(self, context):
+ tests = []
+ for dirname, dirs, files in os.walk(self.root):
+ for dotted in [x for x in dirs if x.startswith('.')]:
+ dirs.remove(dotted)
+ dirs.sort()
+ files.sort()
+ for filename in files:
+ if filename.endswith(".js"):
+ testname = join(dirname[len(self.root) + 1:], filename[:-3])
+ test = testcase.TestCase(self, testname)
+ tests.append(test)
+ return tests
+
+ def GetFlagsForTestCase(self, testcase, context):
+ source = self.GetSourceForTest(testcase)
+ result = []
+ flags_match = re.findall(FLAGS_PATTERN, source)
+ for match in flags_match:
+ result += match.strip().split()
+ result += context.mode_flags
+ result.append(os.path.join(self.root, testcase.path + ".js"))
+ return testcase.flags + result
+
+ def GetSourceForTest(self, testcase):
+ filename = os.path.join(self.root, testcase.path + self.suffix())
+ with open(filename) as f:
+ return f.read()
+
+ def _IgnoreLine(self, string):
+ """Ignore empty lines, valgrind output and Android output."""
+ if not string: return True
+ return (string.startswith("==") or string.startswith("**") or
+ string.startswith("ANDROID"))
+
+ def IsFailureOutput(self, output, testpath):
+ expected_path = os.path.join(self.root, testpath + ".out")
+ expected_lines = []
+ # Can't use utils.ReadLinesFrom() here because it strips whitespace.
+ with open(expected_path) as f:
+ for line in f:
+ if line.startswith("#") or not line.strip(): continue
+ expected_lines.append(line)
+ raw_lines = output.stdout.splitlines()
+ actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ]
+ env = { "basename": os.path.basename(testpath + ".js") }
+ if len(expected_lines) != len(actual_lines):
+ return True
+ for (expected, actual) in itertools.izip(expected_lines, actual_lines):
+ pattern = re.escape(expected.rstrip() % env)
+ pattern = pattern.replace("\\*", ".*")
+ pattern = "^%s$" % pattern
+ if not re.match(pattern, actual):
+ return True
+ return False
+
+ def StripOutputForTransmit(self, testcase):
+ pass
+
+
+def GetSuite(name, root):
+ return MessageTestSuite(name, root)
+
+
+# Deprecated definitions below.
+# TODO(jkummerow): Remove when SCons is no longer supported.
+
+
+import test
+from os.path import join, exists, basename, isdir
+
class MessageTestCase(test.TestCase):
def __init__(self, path, file, expected, mode, context, config):
@@ -1,26 +1,26 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Copyright 2008 the V8 project authors. All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -25,17 +25,88 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import test
import os
-from os.path import join, dirname, exists
import re
-import tempfile
+
+from testrunner.local import testsuite
+from testrunner.objects import testcase
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
+class MjsunitTestSuite(testsuite.TestSuite):
+
+ def __init__(self, name, root):
+ super(MjsunitTestSuite, self).__init__(name, root)
+
+ def ListTests(self, context):
+ tests = []
+ for dirname, dirs, files in os.walk(self.root):
+ for dotted in [x for x in dirs if x.startswith('.')]:
+ dirs.remove(dotted)
+ dirs.sort()
+ files.sort()
+ for filename in files:
+ if filename.endswith(".js") and filename != "mjsunit.js":
+ testname = join(dirname[len(self.root) + 1:], filename[:-3])
+ test = testcase.TestCase(self, testname)
+ tests.append(test)
+ return tests
+
+ def GetFlagsForTestCase(self, testcase, context):
+ source = self.GetSourceForTest(testcase)
+ flags = []
+ flags_match = re.findall(FLAGS_PATTERN, source)
+ for match in flags_match:
+ flags += match.strip().split()
+ flags += context.mode_flags
+
+ files_list = [] # List of file names to append to command arguments.
+ files_match = FILES_PATTERN.search(source);
+ # Accept several lines of 'Files:'.
+ while True:
+ if files_match:
+ files_list += files_match.group(1).strip().split()
+ files_match = FILES_PATTERN.search(source, files_match.end())
+ else:
+ break
+ files = [ os.path.normpath(os.path.join(self.root, '..', '..', f))
+ for f in files_list ]
+ testfilename = os.path.join(self.root, testcase.path + self.suffix())
+ if SELF_SCRIPT_PATTERN.search(source):
+ env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename]
+ files = env + files
+ files.append(os.path.join(self.root, "mjsunit.js"))
+ files.append(testfilename)
+
+ flags += files
+ if context.isolates:
+ flags.append("--isolate")
+ flags += files
+
+ return testcase.flags + flags
+
+ def GetSourceForTest(self, testcase):
+ filename = os.path.join(self.root, testcase.path + self.suffix())
+ with open(filename) as f:
+ return f.read()
+
+
+def GetSuite(name, root):
+ return MjsunitTestSuite(name, root)
+
+
+# Deprecated definitions below.
+# TODO(jkummerow): Remove when SCons is no longer supported.
+
+
+from os.path import dirname, exists, join, normpath
+import tempfile
+import test
+
+
class MjsunitTestCase(test.TestCase):
def __init__(self, path, file, mode, context, config, isolates):
Oops, something went wrong.

0 comments on commit 4dfbfcc

Please sign in to comment.