1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-22 00:15:39 +00:00
go-mtree/test/cli.go
Aleksa Sarai 3c76a35588
test: cli: add information about which test failed
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-01-17 00:46:28 +11:00

27 lines
411 B
Go

package main
import (
"flag"
"fmt"
"os"
"os/exec"
)
func main() {
flag.Parse()
failed := 0
for _, arg := range flag.Args() {
cmd := exec.Command("bash", arg)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
failed++
fmt.Fprintf(os.Stderr, "FAILED: %s\n", arg)
}
}
if failed > 0 {
fmt.Fprintf(os.Stderr, "%d FAILED tests\n", failed)
os.Exit(1)
}
}