Makefile, build: make test fast fail (#1739)

This commit is contained in:
Daniel Liu 2025-11-15 19:12:35 +08:00 committed by GitHub
parent 60868c9045
commit 0fc4c82350
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -43,11 +43,11 @@ all:
#? test: Run the tests.
test: all
go run build/ci.go test
go run build/ci.go test -failfast
#? quick-test: Run the tests except time-consuming tests.
quick-test: all
go run build/ci.go test --quick
go run build/ci.go test --quick -failfast
#? lint: Run certain pre-selected linters.
lint: ## Run linters.

View file

@ -223,6 +223,7 @@ func doTest(cmdline []string) {
coverage := flag.Bool("coverage", false, "Whether to record code coverage")
verbose := flag.Bool("v", false, "Whether to log verbosely")
quick := flag.Bool("quick", false, "Whether to skip long time test")
failfast := flag.Bool("failfast", false, "Do not start new tests after the first test failure")
flag.CommandLine.Parse(cmdline)
env := build.Env()
@ -249,6 +250,9 @@ func doTest(cmdline []string) {
if *verbose {
gotest.Args = append(gotest.Args, "-v")
}
if *failfast {
gotest.Args = append(gotest.Args, "-failfast")
}
gotest.Args = append(gotest.Args, packages...)
build.MustRun(gotest)