File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 15
15
script covers different options being passed)
16
16
'''
17
17
18
+ import contextlib
18
19
import os
19
20
import difflib
20
21
import math
@@ -87,6 +88,17 @@ def randomize_pass_debug():
87
88
print ('randomized pass debug:' , os .environ .get ('BINARYEN_PASS_DEBUG' , '' ))
88
89
89
90
91
+ @contextlib .contextmanager
92
+ def no_pass_debug ():
93
+ old_env = os .environ .copy ()
94
+ if os .environ .get ('BINARYEN_PASS_DEBUG' ):
95
+ del os .environ ['BINARYEN_PASS_DEBUG' ]
96
+ try :
97
+ yield
98
+ finally :
99
+ os .environ .update (old_env )
100
+
101
+
90
102
def randomize_feature_opts ():
91
103
global FEATURE_OPTS
92
104
FEATURE_OPTS = CONSTANT_FEATURE_OPTS [:]
@@ -380,7 +392,11 @@ def run(self, wasm):
380
392
compile_cmd += ['-Os' ]
381
393
else :
382
394
compile_cmd += ['-Oz' ]
383
- run (compile_cmd )
395
+ # avoid pass-debug on the emcc invocation itself (which runs
396
+ # binaryen to optimize the wasm), as the wasm here can be very
397
+ # large and it isn't what we are focused on testing here
398
+ with no_pass_debug ():
399
+ run (compile_cmd )
384
400
return run_vm (['d8' , 'a.out.js' ])
385
401
386
402
def can_run (self ):
Original file line number Diff line number Diff line change @@ -98,14 +98,13 @@ int main(int argc, char** argv) {
98
98
99
99
// For each export in the wasm, emit code to call it and log its result,
100
100
// similar to the other wrappers.
101
- size_t exportIndex = 0 ;
102
-
103
- for (auto & exp : wasm.exports ) {
101
+ for (size_t i = 0 ; i < wasm.exports .size (); i++) {
102
+ auto & exp = wasm.exports [i];
104
103
if (exp->kind != ExternalKind::Function) {
105
104
continue ;
106
105
}
107
106
108
- ret += " case " + std::to_string (exportIndex++ ) + " :\n " ;
107
+ ret += " case " + std::to_string (i ) + " :\n " ;
109
108
110
109
auto * func = wasm.getFunction (exp->value );
111
110
You can’t perform that action at this time.
0 commit comments