Skip to content

Commit 81d57b5

Browse files
add arm/arm64 and chakrafull support to runtests.py
1 parent 3181c96 commit 81d57b5

File tree

1 file changed

+51
-10
lines changed

1 file changed

+51
-10
lines changed

test/runtests.py

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
help='use debug build');
5151
parser.add_argument('-t', '--test', '--test-build', action='store_true',
5252
help='use test build')
53+
parser.add_argument('-f', '--full', '--chakrafull', action='store_true',
54+
help='test chakrafull instead of chakracore')
5355
parser.add_argument('--static', action='store_true',
5456
help='mark that we are testing a static build')
5557
parser.add_argument('--variants', metavar='variant', nargs='+',
@@ -78,12 +80,18 @@
7880
help='use x86 build')
7981
parser.add_argument('--x64', action='store_true',
8082
help='use x64 build')
83+
parser.add_argument('--arm', action='store_true',
84+
help='use arm build')
85+
parser.add_argument('--arm64', action='store_true',
86+
help='use arm64 build')
8187
parser.add_argument('-j', '--processcount', metavar='processcount', type=int,
8288
help='number of parallel threads to use')
8389
parser.add_argument('--warn-on-timeout', action='store_true',
8490
help='warn when a test times out instead of labelling it as an error immediately')
8591
parser.add_argument('--override-test-root', type=str,
8692
help='change the base directory for the tests (where rlexedirs will be sought)')
93+
parser.add_argument('--extra-flags', type=str,
94+
help='add extra flags to all executed tests')
8795
args = parser.parse_args()
8896

8997
test_root = os.path.dirname(os.path.realpath(__file__))
@@ -94,7 +102,7 @@
94102
test_root = os.path.realpath(args.override_test_root)
95103

96104
# arch: x86, x64
97-
arch = 'x86' if args.x86 else ('x64' if args.x64 else None)
105+
arch = 'x86' if args.x86 else ('x64' if args.x64 else ('arm' if args.arm else ('arm64' if args.arm64 else None)))
98106
if arch == None:
99107
arch = os.environ.get('_BuildArch', 'x86')
100108
if sys.platform != 'win32':
@@ -110,26 +118,46 @@
110118
sys.exit(1)
111119
flavor_alias = 'chk' if flavor == 'Debug' else 'fre'
112120

121+
# handling for extra flags
122+
extra_flags = []
123+
if args.extra_flags:
124+
extra_flags = args.extra_flags.split()
125+
113126
# test variants
114127
if not args.variants:
115128
args.variants = ['interpreted', 'dynapogo']
116129

130+
# target binary variants
131+
binary_name_noext = "ch"
132+
if args.full:
133+
binary_name_noext = "jshost"
134+
repo_root = os.path.dirname(repo_root)
135+
# we need this to have consistent error message formatting with ch
136+
extra_flags.append("-bvt")
137+
else:
138+
extra_flags.append('-WERExceptionSupport')
139+
140+
# append exe to the binary name on windows
141+
binary_name = binary_name_noext
142+
if sys.platform == 'win32':
143+
binary_name = binary_name + ".exe"
144+
117145
# binary: full ch path
118146
binary = args.binary
119147
if binary == None:
120148
if sys.platform == 'win32':
121149
build = "VcBuild.SWB" if args.swb else "VcBuild"
122-
binary = 'Build\\' + build + '\\bin\\{}_{}\\ch.exe'.format(arch, flavor)
150+
binary = os.path.join('Build', build, 'bin', '{}_{}'.format(arch, flavor), binary_name)
123151
else:
124-
binary = 'out/{0}/ch'.format(flavor)
152+
binary = os.path.join('out', '{0}'.format(flavor), binary_name)
125153
binary = os.path.join(repo_root, binary)
126154
if not os.path.isfile(binary):
127155
print('{} not found. Did you run ./build.sh already?'.format(binary))
128156
sys.exit(1)
129157

130158
# global tags/not_tags
131159
tags = set(args.tag or [])
132-
not_tags = set(args.not_tag or []).union(['fail', 'exclude_' + arch, 'exclude_' + flavor, 'exclude_ch'])
160+
not_tags = set(args.not_tag or []).union(['fail', 'exclude_' + arch, 'exclude_' + flavor])
133161

134162
if arch_alias:
135163
not_tags.add('exclude_' + arch_alias)
@@ -158,6 +186,14 @@
158186
else:
159187
not_tags.add('exclude_windows')
160188

189+
# exclude tests that depend on features not supported on a platform
190+
if arch == 'arm' or arch == 'arm64':
191+
not_tags.add('require_asmjs')
192+
193+
# exclude tests that exclude the current binary
194+
not_tags.add('exclude_' + binary_name_noext)
195+
196+
# exclude tests known to fail under certain sanitizers
161197
if args.sanitize != None:
162198
not_tags.add('exclude_sanitize_'+args.sanitize)
163199

@@ -204,7 +240,7 @@ def __init__(self, log_file_path = None):
204240
# Set up the log file paths
205241
# Make sure the right directory exists and the log file doesn't
206242
log_file_name = "testrun.{0}{1}.log".format(arch, flavor)
207-
log_file_directory = os.path.join(repo_root, "test", "logs")
243+
log_file_directory = os.path.join(test_root, "logs")
208244

209245
if not os.path.exists(log_file_directory):
210246
os.mkdir(log_file_directory)
@@ -306,7 +342,7 @@ class TestVariant(object):
306342
def __init__(self, name, compile_flags=[], variant_not_tags=[]):
307343
self.name = name
308344
self.compile_flags = \
309-
['-WERExceptionSupport', '-ExtendedErrorStackForTestHost',
345+
['-ExtendedErrorStackForTestHost',
310346
'-BaselineMode'] + compile_flags
311347
self._compile_flags_has_expansion = self._has_expansion(compile_flags)
312348
self.tags = tags.copy()
@@ -318,6 +354,11 @@ def __init__(self, name, compile_flags=[], variant_not_tags=[]):
318354
self.test_count = 0
319355
self._print_lines = [] # _print lines buffer
320356
self._last_len = 0
357+
if verbose:
358+
print("Added variant {0}:".format(name))
359+
print("Flags: " + ", ".join(self.compile_flags))
360+
print("Tags: " + ", ".join(self.tags))
361+
print("NotTags: " + ", ".join(self.not_tags))
321362

322363
@staticmethod
323364
def _has_expansion(flags):
@@ -506,7 +547,7 @@ def timeout_func(timeout_data):
506547
return self._show_failed(timedout=True, **fail_args)
507548

508549
# check ch failed
509-
if exit_code != 0:
550+
if exit_code != 0 and binary_name_noext == 'ch':
510551
return self._show_failed(**fail_args)
511552

512553
# check output
@@ -706,19 +747,19 @@ def main():
706747

707748
# test variants
708749
variants = [x for x in [
709-
TestVariant('interpreted', [
750+
TestVariant('interpreted', extra_flags + [
710751
'-maxInterpretCount:1', '-maxSimpleJitRunCount:1', '-bgjit-',
711752
'-dynamicprofilecache:profile.dpl.${id}'
712753
], [
713754
'require_disable_jit'
714755
]),
715-
TestVariant('dynapogo', [
756+
TestVariant('dynapogo', extra_flags + [
716757
'-forceNative', '-off:simpleJit', '-bgJitDelay:0',
717758
'-dynamicprofileinput:profile.dpl.${id}'
718759
], [
719760
'require_disable_jit'
720761
]),
721-
TestVariant('disable_jit', [
762+
TestVariant('disable_jit', extra_flags + [
722763
'-nonative'
723764
], [
724765
'exclude_interpreted', 'fails_interpreted', 'require_backend'

0 commit comments

Comments
 (0)