mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-25 17:45:39 +00:00
Merge pull request #99 from vbatts/cli.test
cli.test: fail on cli tests
This commit is contained in:
commit
efe17f56ae
7 changed files with 32 additions and 8 deletions
4
Makefile
4
Makefile
|
@ -30,9 +30,7 @@ vet: .vet
|
||||||
cli.test: .cli.test
|
cli.test: .cli.test
|
||||||
|
|
||||||
.cli.test: $(BUILD) $(wildcard ./test/cli/*.sh)
|
.cli.test: $(BUILD) $(wildcard ./test/cli/*.sh)
|
||||||
@ for test in ./test/cli/*.sh ; do \
|
@go run ./test/cli.go ./test/cli/*.sh && touch $@
|
||||||
bash $$test $(CWD) ; \
|
|
||||||
done && touch $@
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(BUILD)
|
build: $(BUILD)
|
||||||
|
|
26
test/cli.go
Normal file
26
test/cli.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
name=$(basename $0)
|
name=$(basename $0)
|
||||||
root=$1
|
root="$(dirname $(dirname $(dirname $0)))"
|
||||||
gomtree=$(readlink -f ${root}/gomtree)
|
gomtree=$(readlink -f ${root}/gomtree)
|
||||||
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
name=$(basename $0)
|
name=$(basename $0)
|
||||||
root=$1
|
root="$(dirname $(dirname $(dirname $0)))"
|
||||||
gomtree=$(readlink -f ${root}/gomtree)
|
gomtree=$(readlink -f ${root}/gomtree)
|
||||||
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
name=$(basename $0)
|
name=$(basename $0)
|
||||||
root=$1
|
root="$(dirname $(dirname $(dirname $0)))"
|
||||||
gomtree=$(readlink -f ${root}/gomtree)
|
gomtree=$(readlink -f ${root}/gomtree)
|
||||||
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
name=$(basename $0)
|
name=$(basename $0)
|
||||||
root=$1
|
root="$(dirname $(dirname $(dirname $0)))"
|
||||||
gomtree=$(readlink -f ${root}/gomtree)
|
gomtree=$(readlink -f ${root}/gomtree)
|
||||||
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
name=$(basename $0)
|
name=$(basename $0)
|
||||||
root=$1
|
root="$(dirname $(dirname $(dirname $0)))"
|
||||||
gomtree=$(readlink -f ${root}/gomtree)
|
gomtree=$(readlink -f ${root}/gomtree)
|
||||||
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue