summaryrefslogtreecommitdiff
path: root/doTest.go
diff options
context:
space:
mode:
Diffstat (limited to 'doTest.go')
-rw-r--r--doTest.go46
1 files changed, 28 insertions, 18 deletions
diff --git a/doTest.go b/doTest.go
index 01f7caa..1d524b1 100644
--- a/doTest.go
+++ b/doTest.go
@@ -15,11 +15,12 @@ import (
func doTest() (string, error) {
var s string
- var err error
+ var allerr error
+
+ initForge()
if argv.Test.Version != nil {
- var data []byte
- data, err = resources.ReadFile("resources/TESTVERSION")
+ data, err := resources.ReadFile("resources/TESTVERSION")
if err != nil {
s = "open repomap failed"
log.Info(s, err)
@@ -30,7 +31,6 @@ func doTest() (string, error) {
log.Info(s, err)
return s, config.ErrEmpty
}
- var broken string
for _, line := range strings.Split(string(data), "\n") {
line := strings.TrimSpace(line)
if line == "" {
@@ -38,23 +38,33 @@ func doTest() (string, error) {
}
parts := strings.Fields(line)
cmdname := parts[len(parts)-1]
- log.Info("LINE=", cmdname)
- r := shell.Run([]string{cmdname, "--version"})
- if r.Error != nil {
- return cmdname + " version test failed", r.Error
- }
- if len(r.Stdout) != 1 {
- for _, line := range r.Stderr {
- log.Info("STDERR:", line)
- }
- for _, line := range r.Stdout {
- log.Info("STDOUT:", line)
+ if argv.Test.Copy {
+ // find cmdname repo
+ for repo := range me.forge.IterByMode() {
+ if !strings.HasPrefix(repo.Namespace, "go.wit.com") {
+ continue
+ }
+ if !strings.HasSuffix(repo.Namespace, cmdname) {
+ continue
+ }
+ if cmdname == "forge" {
+ continue
+ }
+ if cmdname == "autogenpb" {
+ continue
+ }
+ cmd := []string{"cp", "-f", "argv.template.go", repo.FullPath + "/"}
+ shell.RunVerbose(cmd)
}
- broken += cmdname + " "
+ continue
+ }
+ if argv.Test.Version != nil {
+ log.Info("LINE=", cmdname)
+ allerr = errors.Join(allerr, doTestVersion(cmdname))
}
}
- if broken != "" {
- return "version tests failed", errors.New(broken)
+ if allerr != nil {
+ return "version tests failed", allerr
}
return "all version tests passed", nil
}