Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: test/emscripten/testcfg.py

Issue 1099813007: Revert "[test] Initial import of an emscripten test suite." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/emscripten/emscripten.status ('k') | tools/presubmit.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 the V8 project authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import itertools
6 import os
7 import re
8
9 from testrunner.local import testsuite
10 from testrunner.local import utils
11 from testrunner.objects import testcase
12
13
14 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
15 INVALID_FLAGS = ["--enable-slow-asserts"]
16
17
18 class EmscriptenTestSuite(testsuite.TestSuite):
19 def __init__(self, name, root):
20 super(EmscriptenTestSuite, self).__init__(name, root)
21
22 def ListTests(self, context):
23 tests = []
24 for dirname, dirs, files in os.walk(self.root):
25 for dotted in [x for x in dirs if x.startswith('.')]:
26 dirs.remove(dotted)
27 dirs.sort()
28 files.sort()
29 for filename in files:
30 if filename.endswith(".js"):
31 testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
32 test = testcase.TestCase(self, testname)
33 tests.append(test)
34 return tests
35
36 def GetFlagsForTestCase(self, testcase, context):
37 source = self.GetSourceForTest(testcase)
38 result = []
39 flags_match = re.findall(FLAGS_PATTERN, source)
40 for match in flags_match:
41 result += match.strip().split()
42 result += context.mode_flags
43 result = [x for x in result if x not in INVALID_FLAGS]
44 result.append(os.path.join(self.root, testcase.path + ".js"))
45 return testcase.flags + result
46
47 def GetSourceForTest(self, testcase):
48 filename = os.path.join(self.root, testcase.path + self.suffix())
49 with open(filename) as f:
50 return f.read()
51
52 def _IgnoreLine(self, string):
53 """Ignore valgrind, NaCl and Android output."""
54 return (string.startswith("==") or string.startswith("**") or
55 string.startswith("ANDROID") or
56 # These five patterns appear in normal Native Client output.
57 string.startswith("DEBUG MODE ENABLED") or
58 string.startswith("tools/nacl-run.py") or
59 string.find("BYPASSING ALL ACL CHECKS") > 0 or
60 string.find("Native Client module will be loaded") > 0 or
61 string.find("NaClHostDescOpen:") > 0)
62
63 def IsFailureOutput(self, output, testpath):
64 expected_path = os.path.join(self.root, testpath + ".out")
65 expected_lines = []
66 # Can't use utils.ReadLinesFrom() here because it strips whitespace.
67 with open(expected_path) as expected:
68 expected_lines = expected.read().splitlines()
69 raw_lines = output.stdout.splitlines()
70 actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ]
71 env = { "basename": os.path.basename(testpath + ".js") }
72 if len(expected_lines) != len(actual_lines):
73 return True
74 for (expected, actual) in itertools.izip_longest(
75 expected_lines, actual_lines, fillvalue=''):
76 if expected != actual:
77 return True
78 return False
79
80 def StripOutputForTransmit(self, testcase):
81 pass
82
83
84 def GetSuite(name, root):
85 return EmscriptenTestSuite(name, root)
OLDNEW
« no previous file with comments | « test/emscripten/emscripten.status ('k') | tools/presubmit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698