gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
901 stars 378 forks source link

issue: gnovm/cmd/TestGnoDoc failed with incompatible gno packages from the earlier build #1142

Open piux2 opened 1 year ago

piux2 commented 1 year ago

Description

go test ./cmd/...

       --- FAIL: TestGnoDoc (0.05s)
          --- FAIL: TestGnoDoc/doc_avl (0.01s)
              main_test.go:143: stdout package avl // import "gno.land/p/demo/avl"

                  type MutTree struct{ ... }
                      func NewMutTree() *MutTree
                  type Tree struct{ ... }
                      func NewTree(key string, value interface{}) *Tree

              main_test.go:143:
                      Error Trace:  /Users/b/dev/gnofix/gno/gnovm/cmd/gno/main_test.go:71
                                                  /Users/b/dev/gnofix/gno/gnovm/cmd/gno/main_test.go:143
                      Error:        "package avl // import \"gno.land/p/demo/avl\"\n\ntype MutTree struct{ ... }\n    func NewMutTree() *MutTree\ntype Tree struct{ ... }\n    func NewTree(key string, value interface{}) *Tree\n" does not contain "func NewNode"
                      Test:         TestGnoDoc/doc_avl
                      Messages:     stdout should contain
thehowl commented 1 year ago

master seems to be succeeding normally. try cloning gno in a clean directory and running the test again there.

is your directory examples/gno.land/p/demo/avl dirty?

piux2 commented 1 year ago

master seems to be succeeding normally. try cloning gno in a clean directory and running the test again there.

is your directory examples/gno.land/p/demo/avl dirty?

thank you @thehowl for the help. here is the update.

I cloned a fresh local copy and run following command.

cd gnovm make _test.cmd

or run test directly go test ./cmd/gno -run '^TestGnoDoc$'

the error still exists.

it turns out, I had an old version of avl package here from an early build. The old avl does not have NewNode() and the test pick it up. ~/.gno/pkg/mod/gno.land/p/demo/avl

This does not happen in CI on github.

I removed ~/.gno/pkg, the test passed.

I have updated the name to reflect the new findings.

thehowl commented 1 year ago

maybe we could apply a fix to make it so that root dir for gnovm tests is always the project's git root.

I'd say either (a) close this, and open new issue to do that or (b) repurpose this issue and change the title