Skip to content
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

Failing test #1523

Closed
folliehiyuki opened this issue Mar 12, 2023 · 4 comments · Fixed by #1526
Closed

Failing test #1523

folliehiyuki opened this issue Mar 12, 2023 · 4 comments · Fixed by #1526

Comments

@folliehiyuki
Copy link

The following program sample.go triggers an unexpected result

Just clone the repo and run `go test ./...`.

Expected result

Running `go test ./...` passed.

Got

?   	github.com/traefik/yaegi	[no test files]
ok  	github.com/traefik/yaegi/cmd/yaegi	(cached)
ok  	github.com/traefik/yaegi/example/closure	0.009s
ok  	github.com/traefik/yaegi/example/fs	(cached)
ok  	github.com/traefik/yaegi/example/getfunc	0.010s
?   	github.com/traefik/yaegi/internal/cmd/extract	[no test files]
?   	github.com/traefik/yaegi/internal/cmd/genop	[no test files]
?   	github.com/traefik/yaegi/stdlib	[no test files]
?   	github.com/traefik/yaegi/stdlib/syscall	[no test files]
?   	github.com/traefik/yaegi/stdlib/unrestricted	[no test files]
?   	github.com/traefik/yaegi/stdlib/unsafe	[no test files]
ok  	github.com/traefik/yaegi/example/pkg	0.053s
ok  	github.com/traefik/yaegi/extract	0.031s
ok  	github.com/traefik/yaegi/internal/unsafe2	(cached)
--- FAIL: TestInterpConsistencyBuild (155.45s)
    --- FAIL: TestInterpConsistencyBuild/composite6.go (0.00s)
        interp_consistent_test.go:148: ../_test/composite6.go:6:2: import "github.com/traefik/yaegi/_test/ct1" error: unable to find source related to: "github.com/traefik/yaegi/_test/ct1"
    --- FAIL: TestInterpConsistencyBuild/d3.go (0.00s)
        interp_consistent_test.go:148: ../_test/d3.go:3:8: import "github.com/traefik/yaegi/_test/d2" error: unable to find source related to: "github.com/traefik/yaegi/_test/d2"
    --- FAIL: TestInterpConsistencyBuild/import3.go (0.00s)
        interp_consistent_test.go:148: ../_test/import3.go:3:8: import "github.com/traefik/yaegi/_test/foo" error: unable to find source related to: "github.com/traefik/yaegi/_test/foo"
    --- FAIL: TestInterpConsistencyBuild/import4.go (0.00s)
        interp_consistent_test.go:148: ../_test/import4.go:3:8: import "github.com/traefik/yaegi/_test/p1" error: unable to find source related to: "github.com/traefik/yaegi/_test/p1"
    --- FAIL: TestInterpConsistencyBuild/import5.go (0.00s)
        interp_consistent_test.go:148: ../_test/import5.go:3:8: import "github.com/traefik/yaegi/_test/foo" error: unable to find source related to: "github.com/traefik/yaegi/_test/foo"
    --- FAIL: TestInterpConsistencyBuild/import7.go (0.00s)
        interp_consistent_test.go:148: ../_test/import7.go:3:8: import "github.com/traefik/yaegi/_test/foo-bar" error: unable to find source related to: "github.com/traefik/yaegi/_test/foo-bar"
    --- FAIL: TestInterpConsistencyBuild/import8.go (0.00s)
        interp_consistent_test.go:148: ../_test/import8.go:3:8: import "github.com/traefik/yaegi/_test/b1/foo" error: unable to find source related to: "github.com/traefik/yaegi/_test/b1/foo"
    --- FAIL: TestInterpConsistencyBuild/import9.go (0.00s)
        interp_consistent_test.go:148: ../_test/import9.go:3:8: import "github.com/traefik/yaegi/_test/baz-bat" error: unable to find source related to: "github.com/traefik/yaegi/_test/baz-bat"
    --- FAIL: TestInterpConsistencyBuild/issue-1355.go (0.00s)
        interp_consistent_test.go:148: ../_test/issue-1355.go:3:8: import "github.com/traefik/yaegi/_test/p2" error: unable to find source related to: "github.com/traefik/yaegi/_test/p2"
    --- FAIL: TestInterpConsistencyBuild/method38.go (0.00s)
        interp_consistent_test.go:148: ../_test/method38.go:6:2: import "github.com/traefik/yaegi/_test/method38" error: unable to find source related to: "github.com/traefik/yaegi/_test/method38"
    --- FAIL: TestInterpConsistencyBuild/named3.go (0.00s)
        interp_consistent_test.go:148: ../_test/named3.go:3:8: import "github.com/traefik/yaegi/_test/named3" error: unable to find source related to: "github.com/traefik/yaegi/_test/named3"
    --- FAIL: TestInterpConsistencyBuild/p5.go (0.00s)
        interp_consistent_test.go:148: ../_test/p5.go:3:8: import "github.com/traefik/yaegi/_test/p5" error: unable to find source related to: "github.com/traefik/yaegi/_test/p5"
    --- FAIL: TestInterpConsistencyBuild/p6.go (0.00s)
        interp_consistent_test.go:148: ../_test/p6.go:6:2: import "github.com/traefik/yaegi/_test/p6" error: unable to find source related to: "github.com/traefik/yaegi/_test/p6"
    --- FAIL: TestInterpConsistencyBuild/tag0.go (0.00s)
        interp_consistent_test.go:148: ../_test/tag0.go:6:8: import "github.com/traefik/yaegi/_test/ct" error: unable to find source related to: "github.com/traefik/yaegi/_test/ct"
    --- FAIL: TestInterpConsistencyBuild/var14.go (0.00s)
        interp_consistent_test.go:148: ../_test/var14.go:3:8: import "github.com/traefik/yaegi/_test/vars" error: unable to find source related to: "github.com/traefik/yaegi/_test/vars"
--- FAIL: TestInterpErrorConsistency (0.88s)
    --- FAIL: TestInterpErrorConsistency/import6.go (0.01s)
        interp_consistent_test.go:308: got "../_test/import6.go:3:8: import \"github.com/traefik/yaegi/_test/c1\" error: unable to find source related to: \"github.com/traefik/yaegi/_test/c1\"", want: "import cycle not allowed"
Hello
Hello bar
Hello baz
io: read/write on closed pipe
io: read/write on closed pipe
io: read/write on closed pipe
1:28: undefined: reflect
--- FAIL: TestNoGoFiles (0.00s)
    interp_eval_test.go:1723: failed to detect no Go files: 1:21: import "github.com/traefik/yaegi/_test/p3" error: unable to find source related to: "github.com/traefik/yaegi/_test/p3"
Hello
In Hi:
hello from Myint 4
--- FAIL: TestFile (3.75s)
    --- FAIL: TestFile/composite6.go (0.00s)
        interp_file_test.go:36: ../_test/composite6.go:6:2: import "github.com/traefik/yaegi/_test/ct1" error: unable to find source related to: "github.com/traefik/yaegi/_test/ct1"
    --- FAIL: TestFile/d3.go (0.00s)
        interp_file_test.go:36: ../_test/d3.go:3:8: import "github.com/traefik/yaegi/_test/d2" error: unable to find source related to: "github.com/traefik/yaegi/_test/d2"
    --- FAIL: TestFile/import3.go (0.00s)
        interp_file_test.go:36: ../_test/import3.go:3:8: import "github.com/traefik/yaegi/_test/foo" error: unable to find source related to: "github.com/traefik/yaegi/_test/foo"
    --- FAIL: TestFile/import4.go (0.00s)
        interp_file_test.go:36: ../_test/import4.go:3:8: import "github.com/traefik/yaegi/_test/p1" error: unable to find source related to: "github.com/traefik/yaegi/_test/p1"
    --- FAIL: TestFile/import5.go (0.00s)
        interp_file_test.go:36: ../_test/import5.go:3:8: import "github.com/traefik/yaegi/_test/foo" error: unable to find source related to: "github.com/traefik/yaegi/_test/foo"
    --- FAIL: TestFile/import6.go (0.00s)
        interp_file_test.go:36: got "../_test/import6.go:3:8: import \"github.com/traefik/yaegi/_test/c1\" error: unable to find source related to: \"github.com/traefik/yaegi/_test/c1\"", want: "import cycle not allowed\n\timports github.com/traefik/yaegi/_test/c1"
    --- FAIL: TestFile/import7.go (0.00s)
        interp_file_test.go:36: ../_test/import7.go:3:8: import "github.com/traefik/yaegi/_test/foo-bar" error: unable to find source related to: "github.com/traefik/yaegi/_test/foo-bar"
    --- FAIL: TestFile/import8.go (0.00s)
        interp_file_test.go:36: ../_test/import8.go:3:8: import "github.com/traefik/yaegi/_test/b1/foo" error: unable to find source related to: "github.com/traefik/yaegi/_test/b1/foo"
    --- FAIL: TestFile/import9.go (0.00s)
        interp_file_test.go:36: ../_test/import9.go:3:8: import "github.com/traefik/yaegi/_test/baz-bat" error: unable to find source related to: "github.com/traefik/yaegi/_test/baz-bat"
    --- FAIL: TestFile/issue-1355.go (0.00s)
        interp_file_test.go:36: ../_test/issue-1355.go:3:8: import "github.com/traefik/yaegi/_test/p2" error: unable to find source related to: "github.com/traefik/yaegi/_test/p2"
    --- FAIL: TestFile/method38.go (0.00s)
        interp_file_test.go:36: ../_test/method38.go:6:2: import "github.com/traefik/yaegi/_test/method38" error: unable to find source related to: "github.com/traefik/yaegi/_test/method38"
    --- FAIL: TestFile/method39.go (0.00s)
        interp_file_test.go:36: got "../_test/method39.go:7:2: import \"github.com/traefik/yaegi/_test/method38\" error: unable to find source related to: \"github.com/traefik/yaegi/_test/method38\"", want: "17:11: undefined selector Get"
    --- FAIL: TestFile/named3.go (0.00s)
        interp_file_test.go:36: ../_test/named3.go:3:8: import "github.com/traefik/yaegi/_test/named3" error: unable to find source related to: "github.com/traefik/yaegi/_test/named3"
    --- FAIL: TestFile/p5.go (0.00s)
        interp_file_test.go:36: ../_test/p5.go:3:8: import "github.com/traefik/yaegi/_test/p5" error: unable to find source related to: "github.com/traefik/yaegi/_test/p5"
    --- FAIL: TestFile/tag0.go (0.00s)
        interp_file_test.go:36: ../_test/tag0.go:6:8: import "github.com/traefik/yaegi/_test/ct" error: unable to find source related to: "github.com/traefik/yaegi/_test/ct"
    --- FAIL: TestFile/var14.go (0.00s)
        interp_file_test.go:36: ../_test/var14.go:3:8: import "github.com/traefik/yaegi/_test/vars" error: unable to find source related to: "github.com/traefik/yaegi/_test/vars"
FAIL
FAIL	github.com/traefik/yaegi/interp	176.933s
FAIL

Yaegi Version

0.15.0

Additional Notes

I'm trying to package yaegi for AlpineLinux, but my local build are failing (see the log above).

Also, it would be nice to have race optional when running test. AlpineLinux (and a few other distros) set -buildmode=pie that forbid -race flag.

if raceDetectorSupported(runtime.GOOS, runtime.GOARCH) {

@mvertes
Copy link
Member

mvertes commented Mar 13, 2023

I have tested under alpine-3.17.2 (aarch64) and go1.19.6 (alpinelinux package) and I have no errors.

I think the errors are not related to alpinelinux, but due to yaegi repo probably not installed at $GOPATH/src/github.com/traefik/yaegi, the old Go way which is still expected to pass all the tests, waiting for support of Go modules in yaegi.

@folliehiyuki
Copy link
Author

I think the errors are not related to alpinelinux, but due to yaegi repo probably not installed at $GOPATH/src/github.com/traefik/yaegi, the old Go way which is still expected to pass all the tests, waiting for support of Go modules in yaegi.

Thanks for the explanation. I moved the cloned repo to the suggested path and the tests ran successfully. Would you consider adding this note into contributing / building from source guideline? That would be helpful. Then, this issue can be closed.

Also can you look into the -race flag in test as I mentioned. I don't want to keep a patch downstream forever with just 2 LOCs removed. A variable to disable race while running test would be nice.

@mvertes
Copy link
Member

mvertes commented Mar 15, 2023

I will update the readme to document the constraint on repo path.

I'm running on alpinelinux and can totally run go test -race ./...

You mention -buildmode=pie, but I do not see that in my setup. Where is it coming from ? What is the output of go env on your alpinelinux setup ?

@folliehiyuki
Copy link
Author

I'm running on alpinelinux and can totally run go test -race ./...

Yes, nothing goes wrong when we run the command manually with default Go package in AlpineLinux.

You mention -buildmode=pie, but I do not see that in my setup

https://git.alpinelinux.org/abuild/tree/abuild.conf#n5

It is set in abuild configuration file (the program used to package AlpineLinux packages).

-race is enforced when running test based on the environment architecture. You can see the patch here: https://git.alpinelinux.org/aports/tree/testing/yaegi/remove-race-in-test.patch

mvertes added a commit to mvertes/yaegi that referenced this issue Mar 16, 2023
This should allow to build the package on AlpineLinux.
Also document the constraint of having to install the source under
$GOPATH/src/github.com/traefik/yaegi until Go modules are supported.

Fixes traefik#1523.
traefiker pushed a commit that referenced this issue Mar 16, 2023
This should allow to build the package on AlpineLinux. Also document the constraint of having to install the source under $GOPATH/src/github.com/traefik/yaegi until Go modules are supported.

Fixes #1523.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants