From 60eb7c8c4c76edb89e2d402769c6a3b8450ff7e8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 12 Feb 2021 22:47:53 +0000 Subject: Allow specifying additional features past the features section (#3564) That is, if a wasm says "simd", it is ok to let the user specify simd as well as more features, and the the optimizer can perhaps do something with them. --- test/unit/test_features.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/unit/test_features.py') diff --git a/test/unit/test_features.py b/test/unit/test_features.py index 7eb814e39..9c3b20ed7 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -349,6 +349,13 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase): self.assertIn('anyref', disassembly) self.assertIn('eqref', disassembly) + def test_superset(self): + # It is ok to enable additional features past what is in the section. + shared.run_process( + shared.WASM_OPT + ['--print', '--detect-features', '-mvp', + '--enable-simd', '--enable-sign-ext', + self.input_path('signext_target_feature.wasm')]) + def test_incompatible_features(self): path = self.input_path('signext_target_feature.wasm') p = shared.run_process( @@ -357,7 +364,7 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase): check=False, capture_output=True ) self.assertNotEqual(p.returncode, 0) - self.assertIn('Fatal: module features do not match specified features. ' + + self.assertIn('Fatal: features section is not a subset of specified features. ' + 'Use --detect-features to resolve.', p.stderr) -- cgit v1.2.3