Skip to content

Commit

Permalink
test: fix adding examples directory in fuzzer (#3470)
Browse files Browse the repository at this point in the history
Fixes master CI.
  • Loading branch information
thehowl authored Jan 9, 2025
1 parent e5b9095 commit 58ce793
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions gnovm/pkg/transpiler/fuzz_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package transpiler
package transpiler_test

import (
"fmt"
"io"
"io/fs"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"

"github.com/gnolang/gno/gnovm/pkg/gnoenv"
"github.com/gnolang/gno/gnovm/pkg/transpiler"
)

func FuzzTranspiling(f *testing.F) {
Expand All @@ -18,13 +20,7 @@ func FuzzTranspiling(f *testing.F) {
}

// 1. Derive the seeds from our seedGnoFiles.
breakRoot := filepath.Join("gnolang", "gno")
pc, thisFile, _, _ := runtime.Caller(0)
index := strings.Index(thisFile, breakRoot)
_ = pc // to silence the pedantic golangci linter.
rootPath := thisFile[:index+len(breakRoot)]
examplesDir := filepath.Join(rootPath, "examples")
ffs := os.DirFS(examplesDir)
ffs := os.DirFS(filepath.Join(gnoenv.RootDir(), "examples"))
fs.WalkDir(ffs, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
panic(err)
Expand Down Expand Up @@ -65,7 +61,7 @@ func FuzzTranspiling(f *testing.F) {
}()
close(readyCh)
defer close(doneCh)
_, _ = Transpile(string(gnoSourceCode), "gno", "in.gno")
_, _ = transpiler.Transpile(string(gnoSourceCode), "gno", "in.gno")
doneCh <- true
}()

Expand Down

0 comments on commit 58ce793

Please sign in to comment.