Skip to content

Commit 587ec90

Browse files
committed
Add Go repository compiler tests, triage known failures.
Add a modified version of go/test/run.go for GopherJS. The run.go file should be run via native Go, but it will itself invoke `gopherjs run` for running tests. All modifications are marked with a "// GOPHERJS" comment. At this time, only a limited subset of folders and test types is supported. More can be added. Within the tests that are run, there are currently 234 tests passing and 34 failing. The failing test are marked as known failures and do not trigger CI failure. As the bugs are resolved, the knownFails map in run.go should be updated to remove resolved failures. The test will currently fail if any of the tests that were expected to fail unexpectedly pass (if it's not an accident, then knownFails map should be updated accordingly). I hope this will not cause too much noise; it can be changed if so. Four of the tests are compiler panics, they should probably be fixed first. The remaining ones are briefly described but not triaged further than that. The run.go test runner can be run manually via: go run run.go -v -summary Or to include known fails full error messages: go run run.go -v -summary -show_known_fails Add fixedbugs/issue10607.go to known failures. It cannot run because it uses os/exec. This test is meaningless anyway because it tests native go compiler linking modes. Remove unneeded TODOs. Don't output details of known test failures unless show_known_fails flag is on. This makes normal verbose output much more readable and suitable for CI. Change TestGoRepositoryCompilerTests to stream output as it runs. Previously, it would only display all of output when it finished. Fix issue where specifying specific test to run failed to run it. It was because filepath.Split left a trailing slash after dir, so "fixedbugs/" != "fixedbugs". Use filepath.Clean on input t.dir to resolve this. Always display known fails details if -show_known_fails flag is on (even without -v). Previously, both -v and -show_known_fails had to be on. Also tweak the reproduce command printed to include -show_known_fails flag, since it's needed. Remove absolute paths from known fails descriptions.
1 parent 22fe4b5 commit 587ec90

File tree

2 files changed

+1233
-0
lines changed

2 files changed

+1233
-0
lines changed

tests/gorepo_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// +build !js
2+
3+
package tests_test
4+
5+
import (
6+
"os"
7+
"os/exec"
8+
"testing"
9+
)
10+
11+
// Go repository basic compiler tests, and regression tests for fixed compiler bugs.
12+
func TestGoRepositoryCompilerTests(t *testing.T) {
13+
args := []string{"go", "run", "run.go", "-summary"}
14+
if testing.Verbose() {
15+
args = append(args, "-v")
16+
}
17+
cmd := exec.Command(args[0], args[1:]...)
18+
cmd.Stdout = os.Stdout
19+
cmd.Stderr = os.Stdout
20+
err := cmd.Run()
21+
if err != nil {
22+
t.Fatal(err)
23+
}
24+
}

0 commit comments

Comments
 (0)