feature: add e2e tests

This commit is contained in:
jichangjun 2020-12-18 11:07:04 +08:00
parent 89bb9bd8b6
commit adfacd1713
2 changed files with 21 additions and 1 deletions

View File

@ -243,7 +243,7 @@ func filterProfile(coverFile []string, profiles []*cover.Profile) ([]*cover.Prof
return out, nil return out, nil
} }
// skipProfile skips profiles of the packages matching the coverFile pattern // skipProfile skips profiles of the packages matching the skipFile pattern
func skipProfile(skipFile []string, profiles []*cover.Profile) ([]*cover.Profile, error) { func skipProfile(skipFile []string, profiles []*cover.Profile) ([]*cover.Profile, error) {
var out = make([]*cover.Profile, 0) var out = make([]*cover.Profile, 0)
for _, profile := range profiles { for _, profile := range profiles {

View File

@ -98,6 +98,26 @@ setup() {
kill -9 $SAMPLE_PID kill -9 $SAMPLE_PID
} }
@test "test goc profile with coverfile and skipfile flags" {
./simple-project 3>&- &
SAMPLE_PID=$!
sleep 2
wait_profile_backend "profile3" &
profile_pid=$!
run gocc profile --center=http://127.0.0.1:60001 --coverfile="a.go$,b.go$" --skipfile="b.go$" --debug --debugcisyncfile ci-sync.bak;
info $output
[ "$status" -eq 0 ]
[[ "$output" == *"mode: count"* ]]
[[ "$output" == *"a.go"* ]] # contains a.go file
[[ "$output" != *"b.go"* ]] # not contains b.go file
[[ "$output" != *"main.go"* ]] # not contains main.go file
wait $profile_pid
kill -9 $SAMPLE_PID
}
@test "test goc profile with service flag" { @test "test goc profile with service flag" {
./simple-project 3>&- & ./simple-project 3>&- &
SAMPLE_PID=$! SAMPLE_PID=$!