-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version devel +165ebaf97b Sun Oct 7 02:36:02 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
yes
What did you do?
I tried to run tests from standard library in the browser. See #26051 for more context. But after 0e4c013 was checked in, the tests seem to hang and not run.
Here is how to repro -
-
Take the html and wasm_exec.js from GOROOT/misc/wasm/. Change the
writeSync
andopenSync
functions towrite
andopen
inglobal.fs
in wasm_exec.js. (That is another thing we need to fix). -
Compile any test to a binary -
/go/src/encoding$GOOS=js GOARCH=wasm gotip test -run=^TestDecode -o hex.wasm -c -v ./hex/
-
Update your index.html to pass the args after getting the go object.
go.argv = ['-test.run=TestDecode', '-test.v=true'];
-
Try to run the test, by copying over the binary to your other folder and press the run button.
What did you expect to see?
I expect it to run all the tests
What did you see instead?
Only the first test was started, but then after that nothing else is running
Console was cleared
wasm_exec.js:45 === RUN TestEncode
But if I revert this commit
commit 0e4c013b6743507ebce2c08991cf1e3ab49cf7ac
Author: Richard Musiol <mail@richard-musiol.de>
Date: Tue Sep 25 13:45:08 2018 +0200
syscall: use asynchronous operations on js/wasm
and compile and run again, all tests run (also including the ones not in my test.run
pattern, which seems to be another issue). Make sure you have the writeSync and openSync functions again, not write and open. Or rather duplicate them so that it's easy to test.
Console was cleared
wasm_exec.js:54 === RUN TestEncode
wasm_exec.js:54 --- PASS: TestEncode (0.00s)
wasm_exec.js:54 === RUN TestDecode
wasm_exec.js:54 --- PASS: TestDecode (0.00s)
wasm_exec.js:54 === RUN TestEncodeToString
wasm_exec.js:54 --- PASS: TestEncodeToString (0.00s)
wasm_exec.js:54 === RUN TestDecodeString
wasm_exec.js:54 --- PASS: TestDecodeString (0.00s)
wasm_exec.js:54 === RUN TestDecodeErr
wasm_exec.js:54 --- PASS: TestDecodeErr (0.00s)
wasm_exec.js:54 === RUN TestDecodeStringErr
wasm_exec.js:54 --- PASS: TestDecodeStringErr (0.00s)
wasm_exec.js:54 === RUN TestEncoderDecoder
wasm_exec.js:54 --- PASS: TestEncoderDecoder (0.01s)
wasm_exec.js:54 === RUN TestDecoderErr
wasm_exec.js:54 --- PASS: TestDecoderErr (0.00s)
wasm_exec.js:54 === RUN TestDumper
wasm_exec.js:54 --- PASS: TestDumper (0.00s)
wasm_exec.js:54 === RUN TestDumper_doubleclose
wasm_exec.js:54 --- PASS: TestDumper_doubleclose (0.00s)
wasm_exec.js:54 === RUN TestDumper_earlyclose
wasm_exec.js:54 --- PASS: TestDumper_earlyclose (0.00s)
wasm_exec.js:54 === RUN TestDump
wasm_exec.js:54 --- PASS: TestDump (0.00s)
wasm_exec.js:54 === RUN ExampleEncode
wasm_exec.js:54 pipe: not implemented on js
wasm_exec.js:76 exit code: 1
Is this issue in syscall side or wasm_exec side ? I am not very clear on that. But there is clearly something which changed with this commit, that is preventing the tests from running.