68
68
readTestCase : func (fpath string , fname string ) (_ []byte , c wazero.ModuleConfig , stdout , stderr * os.File , err error ) {
69
69
bin , err := os .ReadFile (fpath )
70
70
c , stdout , stderr = defaultModuleConfig ()
71
- c .WithFSConfig (wazero .NewFSConfig ().WithDirMount ("." , "/" )).
71
+ c = c .WithFSConfig (wazero .NewFSConfig ().WithDirMount ("." , "/" )).
72
72
WithArgs ("test.wasm" )
73
73
return bin , c , stdout , stderr , err
74
74
},
87
87
WithDirMount (os .TempDir (), "/tmp" )
88
88
89
89
c , stdout , stderr = defaultModuleConfig ()
90
- c .WithFSConfig (fsconfig ).
90
+ c = c .WithFSConfig (fsconfig ).
91
91
WithArgs (fname , "-test.v" )
92
92
93
93
return bin , c , stdout , stderr , err
@@ -113,7 +113,7 @@ var (
113
113
normalizedTestdir := normalizeOsPath (testdir )
114
114
115
115
c , stdout , stderr = defaultModuleConfig ()
116
- c .WithFSConfig (
116
+ c = c .WithFSConfig (
117
117
wazero .NewFSConfig ().
118
118
WithDirMount (sysroot , "/" ).
119
119
WithDirMount (os .TempDir (), "/tmp" )).
@@ -223,11 +223,13 @@ func requireZeroExitCode(b *testing.B, err error, stdout, stderr *os.File) {
223
223
b .Helper ()
224
224
if se , ok := err .(* sys.ExitError ); ok {
225
225
if se .ExitCode () != 0 { // Don't err on success.
226
- stdoutBytes , err := io .ReadAll (stdout )
227
- require .NoError (b , err )
228
- stderrBytes , err := io .ReadAll (stderr )
229
- require .NoError (b , err )
226
+ stdoutBytes , _ := io .ReadAll (stdout )
227
+ stderrBytes , _ := io .ReadAll (stderr )
230
228
require .NoError (b , err , "stdout: %s\n stderr: %s" , string (stdoutBytes ), string (stderrBytes ))
231
229
}
230
+ } else if err != nil {
231
+ stdoutBytes , _ := io .ReadAll (stdout )
232
+ stderrBytes , _ := io .ReadAll (stderr )
233
+ require .NoError (b , err , "stdout: %s\n stderr: %s" , string (stdoutBytes ), string (stderrBytes ))
232
234
}
233
235
}
0 commit comments