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

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

Issue 902263002: Enable compiling mjsunit tests as ES6 modules (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/mjsunit/harmony/modules.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 16 matching lines...) Expand all
27 27
28 import os 28 import os
29 import re 29 import re
30 30
31 from testrunner.local import testsuite 31 from testrunner.local import testsuite
32 from testrunner.objects import testcase 32 from testrunner.objects import testcase
33 33
34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") 34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") 35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") 36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
37 MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
37 38
38 39
39 class MjsunitTestSuite(testsuite.TestSuite): 40 class MjsunitTestSuite(testsuite.TestSuite):
40 41
41 def __init__(self, name, root): 42 def __init__(self, name, root):
42 super(MjsunitTestSuite, self).__init__(name, root) 43 super(MjsunitTestSuite, self).__init__(name, root)
43 44
44 def ListTests(self, context): 45 def ListTests(self, context):
45 tests = [] 46 tests = []
46 for dirname, dirs, files in os.walk(self.root): 47 for dirname, dirs, files in os.walk(self.root):
(...skipping 26 matching lines...) Expand all
73 break 74 break
74 files = [ os.path.normpath(os.path.join(self.root, '..', '..', f)) 75 files = [ os.path.normpath(os.path.join(self.root, '..', '..', f))
75 for f in files_list ] 76 for f in files_list ]
76 testfilename = os.path.join(self.root, testcase.path + self.suffix()) 77 testfilename = os.path.join(self.root, testcase.path + self.suffix())
77 if SELF_SCRIPT_PATTERN.search(source): 78 if SELF_SCRIPT_PATTERN.search(source):
78 env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] 79 env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")]
79 files = env + files 80 files = env + files
80 81
81 if not context.no_harness: 82 if not context.no_harness:
82 files.append(os.path.join(self.root, "mjsunit.js")) 83 files.append(os.path.join(self.root, "mjsunit.js"))
84
85 if MODULE_PATTERN.search(source):
86 files.append("--module")
83 files.append(testfilename) 87 files.append(testfilename)
84 88
85 flags += files 89 flags += files
86 if context.isolates: 90 if context.isolates:
87 flags.append("--isolate") 91 flags.append("--isolate")
88 flags += files 92 flags += files
89 93
90 return testcase.flags + flags 94 return testcase.flags + flags
91 95
92 def GetSourceForTest(self, testcase): 96 def GetSourceForTest(self, testcase):
93 filename = os.path.join(self.root, testcase.path + self.suffix()) 97 filename = os.path.join(self.root, testcase.path + self.suffix())
94 with open(filename) as f: 98 with open(filename) as f:
95 return f.read() 99 return f.read()
96 100
97 101
98 def GetSuite(name, root): 102 def GetSuite(name, root):
99 return MjsunitTestSuite(name, root) 103 return MjsunitTestSuite(name, root)
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/modules.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698