dev/local_ci: use test timeout flags and add regression test

Add a regression test that fails when local_ci.sh uses -run 30m for go/llgo test, then switch both commands to -timeout 30m.
This commit is contained in:
Li Jie
2026-03-03 10:53:37 +08:00
parent eb14610e6a
commit 1b84911959
2 changed files with 39 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
//go:build !llgo
// +build !llgo
package test
import (
"os"
"path/filepath"
"runtime"
"strings"
"testing"
)
func TestLocalCIScriptUsesTimeoutNotRun(t *testing.T) {
_, thisFile, _, ok := runtime.Caller(0)
if !ok {
t.Fatal("runtime.Caller(0) failed")
}
script := filepath.Clean(filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "dev", "local_ci.sh"))
data, err := os.ReadFile(script)
if err != nil {
t.Fatalf("read %s: %v", script, err)
}
text := string(data)
if strings.Contains(text, "go test -run 30m ./...") {
t.Fatalf("%s still uses invalid go test -run 30m form", script)
}
if strings.Contains(text, "llgo test -run 30m ./...") {
t.Fatalf("%s still uses invalid llgo test -run 30m form", script)
}
if !strings.Contains(text, "go test -timeout 30m ./...") {
t.Fatalf("%s missing go test -timeout 30m", script)
}
if !strings.Contains(text, "llgo test -timeout 30m ./...") {
t.Fatalf("%s missing llgo test -timeout 30m", script)
}
}
+2 -2
View File
@@ -159,7 +159,7 @@ log_section "Go Build"
(cd "$workdir" && go build ./...)
log_section "Go Test"
(cd "$workdir" && go test -run 30m ./...)
(cd "$workdir" && go test -timeout 30m ./...)
log_section "Install llgo"
(cd "$workdir" && go install -tags=dev ./cmd/llgo)
@@ -171,7 +171,7 @@ fi
export PATH="$gobin:$PATH"
log_section "llgo test"
(cd "$workdir" && llgo test -run 30m ./...)
(cd "$workdir" && llgo test -timeout 30m ./...)
log_section "Demo Tests"
demo_jobs="${LLGO_DEMO_JOBS:-}"