WebAssembly / binaryen

Optimizer and compiler/toolchain library for WebAssembly
Apache License 2.0
7.41k stars 733 forks source link

Test suite failures on test/validator/invalid_import.wast and test/validator/invalid_export.wast #782

Open juj opened 7 years ago

juj commented 7 years ago

Running the test suite on OS X (log), Linux (log) and Windows, they all fail with the following errors:

1229 executing:  /home/clb/slaves/emslave/buildslave/ubuntu-incoming/emsdk/binaryen/master_64bit_binaryen/bin/wasm-as --validate=web /home/clb/slaves/emslave/buildslave/ubuntu-incoming/emsdk/binaryen/master/test/validator/invalid_export.wast
1230 [wasm-validator error in module] 2 == 2: Exported function must not have i64 return type, on 
1231 $export64
1232 (module
1233   (type $0 (func (result i64)))
1234   (memory $0 0)
1235   (export "a" (func $export64))
1236   (func $export64 (type $0) (result i64)
1237     (i64.const 1)
1238   )
1239 )
1240 Fatal: Error: input module is not valid.
1241 
1242 executing:  /home/clb/slaves/emslave/buildslave/ubuntu-incoming/emsdk/binaryen/master_64bit_binaryen/bin/wasm-as --validate=web /home/clb/slaves/emslave/buildslave/ubuntu-incoming/emsdk/binaryen/master/test/validator/invalid_import.wast
1243 [wasm-validator error in module] 2 == 2: Imported function must not have i64 parameters, on 
1244 $bad
1245 (module
1246   (type $FUNCSIG$vj (func (param i64)))
1247   (import "test" "bad" (func $bad (param i64)))
1248   (memory $0 0)
1249 )
1250 Fatal: Error: input module is not valid.
1251
juj commented 7 years ago

Looks like these failures also occur on Travis servers, but the fatal error is not actually triggering a test suite failure: https://travis-ci.org/WebAssembly/binaryen/jobs/167907643#L3145

I wonder if these tests are expected to fail (given the filenames), but they are just noisy and are shouting out the error they expect to see? In that case, perhaps it is possible to somehow mute the error from getting printed if the error is expected? That way all printed errors would be real errors.

kripken commented 7 years ago

cc @dschuff who added those tests.

I think that's right, those are meant to fail. Yes, we could make them silent.

rossberg commented 7 years ago

Hm, it's not a (validation) error per se to export or import an i64-function. It is only a (runtime) error trying to use these from JavaScript. It should be perfectly fine to link them into another Wasm module, though.

kripken commented 7 years ago

@rossberg-chromium: true, we just have a mode that disallows even importing them. we would need to not enable that mode if the import/export is only intended to be linked to another wasm module, of course.