update run e2e test case

This commit is contained in:
lyyyuna 2020-07-17 14:27:00 +08:00
parent c08f0e45eb
commit 72bf6b265d
5 changed files with 13 additions and 17 deletions

View File

@ -39,12 +39,10 @@ func (b *Build) Run() error {
cmd.Stderr = os.Stderr
err := cmd.Start()
if err != nil {
log.Errorf("Fail to start command: %v. The error is: %v", cmd.Args, err)
return fmt.Errorf("fail to execute: %v, err: %w", cmd.Args, err)
}
if err = cmd.Wait(); err != nil {
log.Errorf("Fail to go run: %v. The error is: %v", cmd.Args, err)
return fmt.Errorf("fail to execute: %v, err: %w", cmd.Args, err)
}

View File

@ -31,7 +31,7 @@ teardown_file() {
@test "test basic goc build command" {
cd samples/run_for_several_seconds
wait_profile_backend "build"
wait_profile_backend "build1"
run gocc build --debug --debugcisyncfile ci-sync.bak;
info build output: $output
[ "$status" -eq 0 ]
@ -39,7 +39,7 @@ teardown_file() {
@test "test goc build command without debug" {
cd samples/run_for_several_seconds
wait_profile_backend "build"
wait_profile_backend "build2"
run gocc build --debugcisyncfile ci-sync.bak;
info build output: $output
[ "$status" -eq 0 ]

View File

@ -19,7 +19,7 @@ echo "test start"
bats -t server.bats
bats -t gocrun.bats
bats -t run.bats
bats -t version.bats

View File

@ -17,4 +17,4 @@ set -ex
echo "test start"
bats -t profile.bats
bats -t run.bats

View File

@ -22,24 +22,22 @@ setup_file() {
sleep 2
goc init
# run covered goc run
WORKDIR=$PWD
cd samples/run_for_several_seconds
ls -al
gocc run --debug . 3>&- &
GOCC_PID=$!
sleep 2
info "goc gocc server started"
}
teardown_file() {
cd $WORKDIR
# collect from center
goc profile --debug -o filtered-run.cov
kill -9 $GOC_PID
kill -9 $GOCC_PID
}
@test "test basic goc run" {
info $PWD
export GOPATH=$PWD/samples/simple_gopath_project
export GO111MODULE=off
cd samples/simple_gopath_project/src/qiniu.com/simple_gopath_project
wait_profile_backend "run1"
run gocc run . --debug --debugcisyncfile ci-sync.bak;
info run output: $output
[ "$status" -eq 0 ]
[[ "$output" == *"hello, world."* ]]
}