1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-21 16:05:40 +00:00

cli.test: fail on cli tests

This cleans up the Makefile target, and drops the dependency to point to
the $root path of the repo.

Fixes https://github.com/vbatts/go-mtree/issues/98

Reported-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-11-22 10:57:47 -05:00
parent 13131d516b
commit f49f66f61e
Signed by: vbatts
GPG key ID: 10937E57733F1362
7 changed files with 32 additions and 8 deletions

View file

@ -30,9 +30,7 @@ vet: .vet
cli.test: .cli.test
.cli.test: $(BUILD) $(wildcard ./test/cli/*.sh)
@ for test in ./test/cli/*.sh ; do \
bash $$test $(CWD) ; \
done && touch $@
@go run ./test/cli.go ./test/cli/*.sh && touch $@
.PHONY: build
build: $(BUILD)

26
test/cli.go Normal file
View file

@ -0,0 +1,26 @@
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++
}
}
if failed > 0 {
fmt.Printf("%d FAILED tests\n", failed)
os.Exit(1)
}
}

View file

@ -2,7 +2,7 @@
set -e
name=$(basename $0)
root=$1
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -d /tmp/go-mtree.XXXXXX)

View file

@ -2,7 +2,7 @@
set -e
name=$(basename $0)
root=$1
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -d /tmp/go-mtree.XXXXXX)

View file

@ -3,7 +3,7 @@ set -e
#set -x
name=$(basename $0)
root=$1
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -d /tmp/go-mtree.XXXXXX)

View file

@ -2,7 +2,7 @@
set -e
name=$(basename $0)
root=$1
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -d /tmp/go-mtree.XXXXXX)

View file

@ -2,7 +2,7 @@
set -e
name=$(basename $0)
root=$1
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -d /tmp/go-mtree.XXXXXX)