diff --git a/Makefile b/Makefile index b2ded91..88ffe4b 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,12 @@ fmt: go fmt ./... govet-check: - go vet ./... \ No newline at end of file + go vet ./... + +clean: + find tests/ -type f -name '*.bak' -delete + find tests/ -type f -name '*.cov' -delete + find tests/ -type f -name 'simple-project' -delete + find tests/ -type f -name '*_profile_listen_addr' -delete + find tests/ -type f -name 'simple_gopath_project' -delete + \ No newline at end of file diff --git a/cmd/commonflags.go b/cmd/commonflags.go index 8f93dcc..fcd63d4 100644 --- a/cmd/commonflags.go +++ b/cmd/commonflags.go @@ -25,11 +25,12 @@ import ( ) var ( - target string - center string - agentPort AgentPort - debugGoc bool - buildFlags string + target string + center string + agentPort AgentPort + debugGoc bool + debugInCISyncFile string + buildFlags string goRunExecFlag string goRunArguments string diff --git a/cmd/list.go b/cmd/list.go index 5698596..101b4fe 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -18,9 +18,10 @@ package cmd import ( "fmt" - "log" "os" + log "github.com/sirupsen/logrus" + "github.com/qiniu/goc/pkg/cover" "github.com/spf13/cobra" ) @@ -37,6 +38,7 @@ goc list [flags] if err != nil { log.Fatalf("list failed, err: %v", err) } + log.Infoln(string(res)) fmt.Fprint(os.Stdout, string(res)) }, } diff --git a/cmd/root.go b/cmd/root.go index 3263c43..1316cfa 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,9 +17,11 @@ package cmd import ( + "os" "path/filepath" "runtime" "strconv" + "time" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -58,10 +60,23 @@ Find more information at: }) } }, + PersistentPostRun: func(cmd *cobra.Command, args []string) { + if debugInCISyncFile != "" { + f, err := os.Create(debugInCISyncFile) + if err != nil { + log.Fatalln(err) + } + defer f.Close() + + time.Sleep(5 * time.Second) + } + }, } func init() { rootCmd.PersistentFlags().BoolVar(&debugGoc, "debug", false, "run goc in debug mode") + rootCmd.PersistentFlags().StringVar(&debugInCISyncFile, "debugcisyncfile", "", "internal use only, no explain") + rootCmd.PersistentFlags().MarkHidden("debugcisyncfile") viper.BindPFlags(rootCmd.PersistentFlags()) } diff --git a/pkg/build/run.go b/pkg/build/run.go index 43ca1a4..1a59219 100644 --- a/pkg/build/run.go +++ b/pkg/build/run.go @@ -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) } diff --git a/tests/build.bats b/tests/build.bats new file mode 100755 index 0000000..c9698ea --- /dev/null +++ b/tests/build.bats @@ -0,0 +1,46 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID +} + +@test "test basic goc build command" { + cd samples/run_for_several_seconds + wait_profile_backend "build1" + run gocc build --debug --debugcisyncfile ci-sync.bak; + info build output: $output + [ "$status" -eq 0 ] +} + +@test "test goc build command without debug" { + cd samples/run_for_several_seconds + wait_profile_backend "build2" + run gocc build --debugcisyncfile ci-sync.bak; + info build output: $output + [ "$status" -eq 0 ] +} \ No newline at end of file diff --git a/tests/clear.bats b/tests/clear.bats new file mode 100755 index 0000000..453924c --- /dev/null +++ b/tests/clear.bats @@ -0,0 +1,62 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + # run covered goc + gocc server --port=:60001 --debug 3>&- & + GOCC_PID=$! + sleep 1 + + WORKDIR=$PWD + cd samples/run_for_several_seconds + gocc build --center=http://127.0.0.1:60001 + ./simple-project 3>&- & + SAMPLE_PID=$! + sleep 2 + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID + kill -9 $GOCC_PID + kill -9 $SAMPLE_PID +} + +@test "test basic goc clear command" { + wait_profile_backend "clear1" + + run gocc clear --debug --debugcisyncfile ci-sync.bak; + info clear1 output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"coverage counter clear call successfully"* ]] +} + +@test "test clear another center" { + wait_profile_backend "clear2" + + run gocc clear --center=http://127.0.0.1:60001 --debug --debugcisyncfile ci-sync.bak; + info clear2 output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"coverage counter clear call successfully"* ]] +} \ No newline at end of file diff --git a/tests/cover.bats b/tests/cover.bats new file mode 100755 index 0000000..fce90e9 --- /dev/null +++ b/tests/cover.bats @@ -0,0 +1,49 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + mkdir -p test-temp + cp samples/simple_project/main.go test-temp + cp samples/simple_project/go.mod test-temp + + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + info "goc server started" +} + +teardown_file() { + cp test-temp/filtered* . + rm -rf test-temp + kill -9 $GOC_PID +} + +@test "test basic goc cover command" { + cd test-temp + wait_profile_backend "cover1" + run gocc cover --debug --debugcisyncfile ci-sync.bak; + info cover1 output: $output + [ "$status" -eq 0 ] + + run ls http_cover_apis_auto_generated.go + info ls output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"http_cover_apis_auto_generated.go"* ]] +} diff --git a/tests/diff.bats b/tests/diff.bats new file mode 100755 index 0000000..dd96f15 --- /dev/null +++ b/tests/diff.bats @@ -0,0 +1,69 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID +} + +@test "test basic goc diff command" { + cd samples/diff_samples + + wait_profile_backend "diff1" + + + run gocc diff --new-profile=./new.voc --base-profile=./base.voc --debug --debugcisyncfile ci-sync.bak; + info list output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"qiniu.com/kodo/apiserver/server/main.go | 50.0% | 100.0% | 50.0%"* ]] + [[ "$output" == *"Total | 50.0% | 100.0% | 50.0%"* ]] +} + +@test "test diff in prow environment with periodic job" { + cd samples/diff_samples + + wait_profile_backend "diff2" + + export JOB_TYPE=periodic + + run gocc diff --new-profile=./new.voc --prow-postsubmit-job=base --debug --debugcisyncfile ci-sync.bak; + info diff1 output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"do nothing"* ]] +} + +@test "test diff in prow environment with postsubmit job" { + cd samples/diff_samples + + wait_profile_backend "diff3" + + export JOB_TYPE=postsubmit + + run gocc diff --new-profile=./new.voc --prow-postsubmit-job=base --debug --debugcisyncfile ci-sync.bak; + info diff2 output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"do nothing"* ]] +} \ No newline at end of file diff --git a/tests/init.bats b/tests/init.bats new file mode 100755 index 0000000..68dc03b --- /dev/null +++ b/tests/init.bats @@ -0,0 +1,52 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + # run covered goc + gocc server --port=:60001 --debug 3>&- & + GOCC_PID=$! + sleep 1 + + WORKDIR=$PWD + cd samples/run_for_several_seconds + gocc build --center=http://127.0.0.1:60001 + ./simple-project 3>&- & + SAMPLE_PID=$! + sleep 2 + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID + kill -9 $GOCC_PID + kill -9 $SAMPLE_PID +} + +@test "test init command" { + wait_profile_backend "init1" + + run gocc init --center=http://127.0.0.1:60001 --debug --debugcisyncfile ci-sync.bak; + info init output: $output + [ "$status" -eq 0 ] +} \ No newline at end of file diff --git a/tests/install.bats b/tests/install.bats new file mode 100755 index 0000000..3b4c321 --- /dev/null +++ b/tests/install.bats @@ -0,0 +1,41 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID +} + +@test "test basic goc install command" { + 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 "install" + run gocc install --debug --debugcisyncfile ci-sync.bak; + info install output: $output + [ "$status" -eq 0 ] +} diff --git a/tests/list.bats b/tests/list.bats new file mode 100755 index 0000000..76284fe --- /dev/null +++ b/tests/list.bats @@ -0,0 +1,46 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + # run covered goc + gocc server --port=:60001 --debug 3>&- & + GOCC_PID=$! + sleep 1 + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID + kill -9 $GOCC_PID +} + +@test "test basic goc list command" { + wait_profile_backend "list" + + run gocc list --debug --debugcisyncfile ci-sync.bak; + info list output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"gocc"* ]] + [[ "$output" == *"http"* ]] +} \ No newline at end of file diff --git a/tests/profile.bats b/tests/profile.bats new file mode 100755 index 0000000..fa76a32 --- /dev/null +++ b/tests/profile.bats @@ -0,0 +1,53 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + # run covered goc + gocc server --port=:60001 --debug 3>&- & + GOCC_PID=$! + sleep 1 + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID + kill -9 $GOCC_PID +} + +@test "test goc profile to stdout" { + wait_profile_backend "profile1" + + run gocc profile --debug --debugcisyncfile ci-sync.bak; + [ "$status" -eq 0 ] + [[ "$output" == *"mode: count"* ]] +} + +@test "test goc profile to file" { + wait_profile_backend "profile2" + + run gocc profile -o test-profile.bak --debug --debugcisyncfile ci-sync.bak; + [ "$status" -eq 0 ] + run cat test-profile.bak + [[ "$output" == *"mode: count"* ]] +} \ No newline at end of file diff --git a/tests/register.bats b/tests/register.bats new file mode 100755 index 0000000..058234c --- /dev/null +++ b/tests/register.bats @@ -0,0 +1,54 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + # run covered goc + gocc server --port=:60001 --debug 3>&- & + GOCC_PID=$! + sleep 1 + + info "goc server started" +} + +teardown_file() { + kill -9 $GOC_PID + kill -9 $GOCC_PID +} + +@test "test basic goc register command" { + wait_profile_backend "register1" + + run gocc register --center=http://127.0.0.1:60001 --name=xyz --address=http://137.0.0.1:666 --debug --debugcisyncfile ci-sync.bak; + info register output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"success"* ]] +} + +@test "test goc register without port" { + wait_profile_backend "register2" + + run gocc register --center=http://127.0.0.1:60001 --name=xyz --address=http://137.0.0.1 --debug --debugcisyncfile ci-sync.bak; + info register output: $output + [ "$status" -eq 0 ] + [[ "$output" == *"missing port"* ]] +} \ No newline at end of file diff --git a/tests/run-ci-actions.sh b/tests/run-ci-actions.sh index 8980993..c8840d2 100755 --- a/tests/run-ci-actions.sh +++ b/tests/run-ci-actions.sh @@ -17,8 +17,28 @@ set -ex echo "test start" -bats server.bats +bats -t server.bats -bats gocrun.bats +bats -t run.bats + +bats -t version.bats + +bats -t list.bats + +bats -t clear.bats + +bats -t build.bats + +bats -t profile.bats + +bats -t install.bats + +bats -t register.bats + +bats -t init.bats + +bats -t diff.bats + +bats -t cover.bats bash <(curl -s https://codecov.io/bash) -f 'filtered*' -F e2e \ No newline at end of file diff --git a/tests/run-in-local.sh b/tests/run-in-local.sh new file mode 100755 index 0000000..33fafdc --- /dev/null +++ b/tests/run-in-local.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +echo "test start" + +bats -t run.bats \ No newline at end of file diff --git a/tests/run.bats b/tests/run.bats new file mode 100755 index 0000000..026a64f --- /dev/null +++ b/tests/run.bats @@ -0,0 +1,43 @@ +#!/usr/bin/env bats +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load util.sh + +setup_file() { + # run centered server + goc server 3>&- & + GOC_PID=$! + sleep 2 + goc init + + info "goc gocc server started" +} + +teardown_file() { + kill -9 $GOC_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."* ]] +} \ No newline at end of file diff --git a/tests/samples/diff_samples/base.voc b/tests/samples/diff_samples/base.voc new file mode 100644 index 0000000..5c8b06e --- /dev/null +++ b/tests/samples/diff_samples/base.voc @@ -0,0 +1,3 @@ +mode: atomic +qiniu.com/kodo/apiserver/server/main.go:32.49,33.13 1 30 +qiniu.com/kodo/apiserver/server/main.go:42.49,43.13 1 0 \ No newline at end of file diff --git a/tests/samples/diff_samples/new.voc b/tests/samples/diff_samples/new.voc new file mode 100644 index 0000000..ddc8f11 --- /dev/null +++ b/tests/samples/diff_samples/new.voc @@ -0,0 +1,3 @@ +mode: atomic +qiniu.com/kodo/apiserver/server/main.go:32.49,33.13 1 30 +qiniu.com/kodo/apiserver/server/main.go:42.49,43.13 1 1 \ No newline at end of file diff --git a/tests/server.bats b/tests/server.bats index c834e5a..6395801 100755 --- a/tests/server.bats +++ b/tests/server.bats @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +load util.sh + setup_file() { # run centered server goc server 3>&- & @@ -23,12 +25,12 @@ setup_file() { gocc server --port=:60001 --debug 3>&- & GOCC_PID=$! sleep 2 - echo "goc gocc server started" + info "goc gocc server started" } teardown_file() { # collect from center - goc profile --debug -o filtered.cov + goc profile --debug -o filtered-server.cov kill -9 $GOC_PID kill -9 $GOCC_PID } diff --git a/tests/util.sh b/tests/util.sh new file mode 100644 index 0000000..d59d0d8 --- /dev/null +++ b/tests/util.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright 2020 Qiniu Cloud (七牛云) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +info() { + echo -e "[$(date +'%Y-%m-%dT%H:%M:%S.%N%z')] INFO: $@" >&3 +} + +wait_profile() { + local n=0 + local timeout=10 + until [[ ${n} -ge ${timeout} ]] + do + # check whether the target port is listened by specific process + if [[ -f ci-sync.bak ]]; then + break + fi + n=$[${n}+1] + sleep 1 + done + # collect from center + goc profile -o filtered-$1.cov +} + +wait_profile_backend() { + rm ci-sync.bak || true + coproc { wait_profile $1; } +} \ No newline at end of file diff --git a/tests/gocrun.bats b/tests/version.bats similarity index 70% rename from tests/gocrun.bats rename to tests/version.bats index d4a363d..4323a2c 100755 --- a/tests/gocrun.bats +++ b/tests/version.bats @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +load util.sh + setup_file() { # run centered server goc server 3>&- & @@ -20,24 +22,21 @@ 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 - echo "goc gocc server started" + info "goc server started" +} + +setup() { + goc init + rm ci-sync.bak || true } teardown_file() { - cd $WORKDIR - # collect from center - goc profile --debug -o filtered2.cov kill -9 $GOC_PID - kill -9 $GOCC_PID } -@test "test basic goc run" { +@test "test basic goc version command" { + wait_profile_backend "version" + run gocc version --debug --debugcisyncfile ci-sync.bak; + [ "$output" = "(devel)" ] } \ No newline at end of file