github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/testdata/courses/qf104-2022/tests/scripts/run.sh (about) 1 #image/qf104 2 3 start=$SECONDS 4 printf "*** Initializing Tests for %s ***\n" "$CURRENT" 5 6 # Move to folder with assignment handout code for the current assignment to test. 7 cd "$ASSIGNMENTS/$CURRENT" 8 # Remove assignment handout tests, if any, to avoid interference, but keep quickfeed tests. 9 find . \( -name '*_test.go' -and -not -name '*_ag_test.go' \) -exec rm -rf {} \; 10 11 # Copy tests into the base assignments folder for initializing test scores 12 cp -r "$TESTS"/* "$ASSIGNMENTS"/ 13 14 # $TESTS does not contain go.mod and go.sum: make sure to get the kit/score package 15 go get -t github.com/quickfeed/quickfeed/kit/score 16 go mod tidy 17 # Initialize test scores 18 SCORE_INIT=1 go test -v ./... 2>&1 | grep TestName 19 20 printf "*** Preparing Test Execution for %s ***\n" "$CURRENT" 21 22 # Move to folder with submitted code for the current assignment to test. 23 cd "$SUBMITTED/$CURRENT" 24 # Remove student written tests to avoid interference 25 find . -name '*_test.go' -exec rm -rf {} \; 26 27 # Copy tests into student assignments folder for running tests 28 cp -r "$TESTS"/* "$SUBMITTED"/ 29 30 # $TESTS does not contain go.mod and go.sum: make sure to get the kit/score package 31 go get -t github.com/quickfeed/quickfeed/kit/score 32 go mod tidy 33 34 printf "\n*** Finished Test Setup in %s seconds ***\n" "$(( SECONDS - start ))" 35 start=$SECONDS 36 printf "\n*** Running Tests ***\n\n" 37 go test -v -timeout 30s ./... 2>&1 38 printf "\n*** Finished Running Tests in %s seconds ***\n" "$(( SECONDS - start ))"