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 1515script covers different options being passed)
1616'''
1717
18+ import contextlib
1819import os
1920import difflib
2021import math
@@ -87,6 +88,17 @@ def randomize_pass_debug():
8788 print ('randomized pass debug:' , os .environ .get ('BINARYEN_PASS_DEBUG' , '' ))
8889
8990
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+
90102def randomize_feature_opts ():
91103 global FEATURE_OPTS
92104 FEATURE_OPTS = CONSTANT_FEATURE_OPTS [:]
@@ -380,7 +392,11 @@ def run(self, wasm):
380392 compile_cmd += ['-Os' ]
381393 else :
382394 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 )
384400 return run_vm (['d8' , 'a.out.js' ])
385401
386402 def can_run (self ):
Original file line number Diff line number Diff line change @@ -98,14 +98,13 @@ int main(int argc, char** argv) {
9898
9999 // For each export in the wasm, emit code to call it and log its result,
100100 // 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];
104103 if (exp->kind != ExternalKind::Function) {
105104 continue ;
106105 }
107106
108- ret += " case " + std::to_string (exportIndex++ ) + " :\n " ;
107+ ret += " case " + std::to_string (i ) + " :\n " ;
109108
110109 auto * func = wasm.getFunction (exp->value );
111110
You can’t perform that action at this time.
0 commit comments