-
Notifications
You must be signed in to change notification settings - Fork 997
wasm test suite #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
wasm test suite #1116
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b70182d
wasm test suite
bradleypeabody 9e5decb
testing setup_remote_docker per https://circleci.com/docs/2.0/buildin…
bradleypeabody f7d903c
try just installing chrome instead of using docker for circleci
bradleypeabody 5c3af35
build go1.12+ and add debug output
bradleypeabody c3686c6
making event test go1.14+ for now
bradleypeabody 16a7aec
debug output
bradleypeabody 569d4e7
making this go1.14+ - 1.13 is giving a panic syscall/js: call of Valu…
bradleypeabody e42b563
cleanup to wasm test suite remove docker and other fixes
bradleypeabody 8e79bb6
rm unnecessary rm
bradleypeabody 0540e67
cleanup and added fmt test to show go 1.13 issue
bradleypeabody File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package wasm | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/chromedp/chromedp" | ||
| ) | ||
|
|
||
| func TestChan(t *testing.T) { | ||
|
|
||
| t.Parallel() | ||
|
|
||
| err := run("tinygo build -o " + wasmTmpDir + "/chan.wasm -target wasm testdata/chan.go") | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| ctx, cancel := chromectx(5 * time.Second) | ||
| defer cancel() | ||
|
|
||
| err = chromedp.Run(ctx, | ||
| chromedp.Navigate("http://localhost:8826/run?file=chan.wasm"), | ||
| waitLog(`1 | ||
| 2 | ||
| 4 | ||
| 3 | ||
| true`), | ||
| ) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // +build go1.14 | ||
|
|
||
| package wasm | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/chromedp/chromedp" | ||
| ) | ||
|
|
||
| func TestEvent(t *testing.T) { | ||
|
|
||
| t.Parallel() | ||
|
|
||
| err := run("tinygo build -o " + wasmTmpDir + "/event.wasm -target wasm testdata/event.go") | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| ctx, cancel := chromectx(5 * time.Second) | ||
| defer cancel() | ||
|
|
||
| var log1, log2 string | ||
| err = chromedp.Run(ctx, | ||
| chromedp.Navigate("http://localhost:8826/run?file=event.wasm"), | ||
| chromedp.WaitVisible("#log"), | ||
| chromedp.Sleep(time.Second), | ||
| chromedp.InnerHTML("#log", &log1), | ||
| waitLog(`1 | ||
| 4`), | ||
| chromedp.Click("#testbtn"), | ||
| chromedp.Sleep(time.Second), | ||
| chromedp.InnerHTML("#log", &log2), | ||
| waitLog(`1 | ||
| 4 | ||
| 2 | ||
| 3 | ||
| true`), | ||
| ) | ||
| t.Logf("log1: %s", log1) | ||
| t.Logf("log2: %s", log2) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // +build go1.14 | ||
|
|
||
| package wasm | ||
|
|
||
| // NOTE: this should work in go1.13 but panics with: | ||
| // panic: syscall/js: call of Value.Get on string | ||
| // which is coming from here: https://github.com/golang/go/blob/release-branch.go1.13/src/syscall/js/js.go#L252 | ||
| // But I'm not sure how import "fmt" results in this. | ||
| // To reproduce, install Go 1.13.x and change the build tag above | ||
| // to go1.13 and run this test. | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/chromedp/chromedp" | ||
| ) | ||
|
|
||
| func TestFmt(t *testing.T) { | ||
|
|
||
| t.Parallel() | ||
|
|
||
| err := run("tinygo build -o " + wasmTmpDir + "/fmt.wasm -target wasm testdata/fmt.go") | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| ctx, cancel := chromectx(5 * time.Second) | ||
| defer cancel() | ||
|
|
||
| var log1 string | ||
| err = chromedp.Run(ctx, | ||
| chromedp.Navigate("http://localhost:8826/run?file=fmt.wasm"), | ||
| chromedp.Sleep(time.Second), | ||
| chromedp.InnerHTML("#log", &log1), | ||
| waitLog(`did not panic`), | ||
| ) | ||
| t.Logf("log1: %s", log1) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // +build go1.14 | ||
|
|
||
| package wasm | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/chromedp/chromedp" | ||
| ) | ||
|
|
||
| func TestFmtprint(t *testing.T) { | ||
|
|
||
| t.Parallel() | ||
|
|
||
| err := run("tinygo build -o " + wasmTmpDir + "/fmtprint.wasm -target wasm testdata/fmtprint.go") | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| ctx, cancel := chromectx(5 * time.Second) | ||
| defer cancel() | ||
|
|
||
| var log1 string | ||
| err = chromedp.Run(ctx, | ||
| chromedp.Navigate("http://localhost:8826/run?file=fmtprint.wasm"), | ||
| chromedp.Sleep(time.Second), | ||
| chromedp.InnerHTML("#log", &log1), | ||
| waitLog(`test from fmtprint 1 | ||
| test from fmtprint 2 | ||
| test from fmtprint 3 | ||
| test from fmtprint 4`), | ||
| ) | ||
| t.Logf("log1: %s", log1) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really depend on Go 1.14 (just checking)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally not, but I was getting a strange error I could not debug on go 1.13. I will make another attempt to fix as part of the refactor to remove docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this again, I suspect you may be running into this Go 1.13 incompatibility: #1035