From 2c98780a1068870e8340cfb1f0387b046efecec1 Mon Sep 17 00:00:00 2001 From: lyyyuna Date: Wed, 5 Aug 2020 17:40:36 +0800 Subject: [PATCH] add integration test --- tests/merge.bats | 19 +++++++++++++------ tests/run-ci-actions.sh | 2 ++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/merge.bats b/tests/merge.bats index f8cb0cd..0b3e4cc 100755 --- a/tests/merge.bats +++ b/tests/merge.bats @@ -33,25 +33,32 @@ setup() { goc init } -@test "test goc merge command" { +@test "test goc merge with same binary" { cd samples/merge_profile_samples wait_profile_backend "merge1" & profile_pid=$! # merge two profiles with same binary - run gocc merge a.voc b.voc --debug --debugcisyncfile ci-sync.bak; + run gocc merge a.voc b.voc --output mergeprofile.voc1 --debug --debugcisyncfile ci-sync.bak; info merge1 output: $output [ "$status" -eq 0 ] - run cat mergeprofile.cov + run cat mergeprofile.voc1 [[ "$output" == *"qiniu.com/kodo/apiserver/server/main.go:32.49,33.13 1 60"* ]] [[ "$output" == *"qiniu.com/kodo/apiserver/server/main.go:42.49,43.13 1 2"* ]] +} + +@test "test goc merge with two binaries, but has some source code in common" { + cd samples/merge_profile_samples + + wait_profile_backend "merge2" & + profile_pid=$! # merge two profiles from two binaries, but has some source code in common - run gocc merge a.voc c.voc --debug --debugcisyncfile ci-sync.bak; - info merge1 output: $output + run gocc merge a.voc c.voc --output mergeprofile.voc2 --debug --debugcisyncfile ci-sync.bak; + info merge2 output: $output [ "$status" -eq 0 ] - run cat mergeprofile.cov + run cat mergeprofile.voc2 [[ "$output" == *"qiniu.com/kodo/apiserver/server/main.go:32.49,33.13 1 60"* ]] [[ "$output" == *"qiniu.com/kodo/apiserver/server/main.go:42.49,43.13 1 0"* ]] [[ "$output" == *"qiniu.com/kodo/apiserver/server/wala.go:42.49,43.13 1 0"* ]] diff --git a/tests/run-ci-actions.sh b/tests/run-ci-actions.sh index 48ac66f..14bef93 100755 --- a/tests/run-ci-actions.sh +++ b/tests/run-ci-actions.sh @@ -43,4 +43,6 @@ bats -t cover.bats bats -t agent.bats +bats -t merge.bats + bash <(curl -s https://codecov.io/bash) -f 'filtered*' -F e2e-$GOVERSION \ No newline at end of file