Let test binaries run from any dir in the repo

Also spin out generate.WuffsRoot into its own package.
This commit is contained in:
Nigel Tao committed 2018-11-03 08:46:31 +11:00
1 parent e2d1f8e0c2
commit 3854ce3e89
13 files changed
+208 -147

No files matched your search

+5 -1
View File
@@ -24,6 +24,8 @@ import (
"path/filepath"
"strings"
"github.com/google/wuffs/lang/wuffsroot"
cf "github.com/google/wuffs/cmd/commonflags"
)
@@ -132,7 +134,9 @@ func doBenchTest1(filename string, bench bool, ccompilers string, focus string,
outCmd := exec.Command(out, outArgs...)
outCmd.Stdout = os.Stdout
outCmd.Stderr = os.Stderr
outCmd.Dir = filepath.Dir(filename)
if outCmd.Dir, err = wuffsroot.Value(); err != nil {
return false, err
}
if err := outCmd.Run(); err == nil {
// No-op.
} else if _, ok := err.(*exec.ExitError); ok {
+2 -2
View File
@@ -25,7 +25,7 @@ import (
"sort"
"strings"
"github.com/google/wuffs/lang/generate"
"github.com/google/wuffs/lang/wuffsroot"
)
var commands = []struct {
@@ -65,7 +65,7 @@ func main1() error {
flag.Usage = usage
flag.Parse()
wuffsRoot, err := generate.WuffsRoot()
wuffsRoot, err := wuffsroot.Value()
if err != nil {
return err
}