Skip to content

Commit 18456e0

Browse files
committed
Fix combining of test parametization. NFC
As far as I can tell the only test that was relying on this features is `browser.test_sdl_image_prepare` which uses `@also_with_proxied` in addition to `@also_with_wasmfs` and it was getting the names and values backwards. I confirmed manually that all 4 test combination now do the right thing.
1 parent ef0efd2 commit 18456e0

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

test/common.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ def also_with_wasmfs(f):
376376

377377
@wraps(f)
378378
def metafunc(self, wasmfs, *args, **kwargs):
379+
if DEBUG:
380+
print('parameterize:wasmfs=%d' % wasmfs)
379381
if wasmfs:
380382
self.set_setting('WASMFS')
381383
self.emcc_args.append('-DWASMFS')
@@ -393,6 +395,8 @@ def also_with_noderawfs(func):
393395

394396
@wraps(func)
395397
def metafunc(self, rawfs, *args, **kwargs):
398+
if DEBUG:
399+
print('parameterize:rawfs=%d' % rawfs)
396400
if rawfs:
397401
self.require_node()
398402
self.emcc_args += ['-DNODERAWFS']
@@ -410,6 +414,8 @@ def also_with_env_modify(name_updates_mapping):
410414
def decorated(f):
411415
@wraps(f)
412416
def metafunc(self, updates, *args, **kwargs):
417+
if DEBUG:
418+
print('parameterize:env_modify=%s' % (updates))
413419
if updates:
414420
with env_modify(updates):
415421
return f(self, *args, **kwargs)
@@ -432,6 +438,8 @@ def also_with_minimal_runtime(f):
432438

433439
@wraps(f)
434440
def metafunc(self, with_minimal_runtime, *args, **kwargs):
441+
if DEBUG:
442+
print('parameterize:minimal_runtime=%s' % with_minimal_runtime)
435443
assert self.get_setting('MINIMAL_RUNTIME') is None
436444
if with_minimal_runtime:
437445
self.set_setting('MINIMAL_RUNTIME', 1)
@@ -447,6 +455,8 @@ def also_with_wasm_bigint(f):
447455

448456
@wraps(f)
449457
def metafunc(self, with_bigint, *args, **kwargs):
458+
if DEBUG:
459+
print('parameterize:bigint=%s' % with_bigint)
450460
if with_bigint:
451461
if self.is_wasm2js():
452462
self.skipTest('wasm2js does not support WASM_BIGINT')
@@ -469,6 +479,8 @@ def also_with_wasm64(f):
469479

470480
@wraps(f)
471481
def metafunc(self, with_wasm64, *args, **kwargs):
482+
if DEBUG:
483+
print('parameterize:wasm64=%s' % with_wasm64)
472484
if with_wasm64:
473485
self.require_wasm64()
474486
self.set_setting('MEMORY64')
@@ -488,6 +500,8 @@ def also_with_wasm2js(f):
488500
@wraps(f)
489501
def metafunc(self, with_wasm2js, *args, **kwargs):
490502
assert self.get_setting('WASM') is None
503+
if DEBUG:
504+
print('parameterize:wasm2js=%s' % with_wasm2js)
491505
if with_wasm2js:
492506
self.require_wasm2js()
493507
self.set_setting('WASM', 0)
@@ -522,6 +536,8 @@ def also_with_standalone_wasm(impure=False):
522536
def decorated(func):
523537
@wraps(func)
524538
def metafunc(self, standalone):
539+
if DEBUG:
540+
print('parameterize:standalone=%s' % standalone)
525541
if not standalone:
526542
func(self)
527543
else:
@@ -559,6 +575,8 @@ def with_all_eh_sjlj(f):
559575

560576
@wraps(f)
561577
def metafunc(self, mode, *args, **kwargs):
578+
if DEBUG:
579+
print('parameterize:eh_mode=%s' % mode)
562580
if mode == 'wasm' or mode == 'wasm_exnref':
563581
# Wasm EH is currently supported only in wasm backend and V8
564582
if self.is_wasm2js():
@@ -719,10 +737,13 @@ def parameterize(func, parameters):
719737
if prev:
720738
# If we're parameterizing 2nd time, construct a cartesian product for various combinations.
721739
func._parameterize = {
722-
'_'.join(filter(None, [k1, k2])): v1 + v2 for (k1, v1), (k2, v2) in itertools.product(prev.items(), parameters.items())
740+
'_'.join(filter(None, [k1, k2])): v2 + v1 for (k1, v1), (k2, v2) in itertools.product(prev.items(), parameters.items())
723741
}
724742
else:
725743
func._parameterize = parameters
744+
if func.__name__ == 'test_sdl_image_prepare':
745+
print(func.__name__)
746+
print(func._parameterize)
726747

727748

728749
def parameterized(parameters):

test/test_browser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from tools import shared
2828
from tools import ports
2929
from tools import utils
30-
from tools.shared import EMCC, WINDOWS, FILE_PACKAGER, PIPE
30+
from tools.shared import EMCC, WINDOWS, FILE_PACKAGER, PIPE, DEBUG
3131
from tools.utils import delete_dir
3232

3333

@@ -82,6 +82,8 @@ def also_with_wasmfs(f):
8282

8383
@wraps(f)
8484
def metafunc(self, wasmfs, *args, **kwargs):
85+
if DEBUG:
86+
print('parameterize:wasmfs=%d' % wasmfs)
8587
if wasmfs:
8688
self.set_setting('WASMFS')
8789
self.emcc_args = self.emcc_args.copy() + ['-DWASMFS']
@@ -100,6 +102,8 @@ def also_with_proxying(f):
100102

101103
@wraps(f)
102104
def metafunc(self, proxied, *args, **kwargs):
105+
if DEBUG:
106+
print('parameterize:proxied=%d' % proxied)
103107
self.proxied = proxied
104108
f(self, *args, **kwargs)
105109

0 commit comments

Comments
 (0)