mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Travis: Reduce footprint of unit tests - so hopefully flakiness (#12350)
* ./tests: Remove legacy coverage collection code The legacy tests/cover.test.bash script was not ./test script compatible for a long time. The following method of coverage collection works (also across packages) and does not make all the test execution slower. ``` COVERDIR=coverage PASSES="build build_cov cov" ./test go tool cover -html ./coverage/cover.out ``` * CI: Reduce duplicated coverage between different variants on Travis We used to execute unit tests in 3 different jobs, every time with --race detection and every time in 3 variants:1,2,4 CPUS. The proposed change makes each of the jobs use different variant of CPUS, and only 4-cpu variant is running with --race detection (as the more-parallel variant is more likely to experience races),
This commit is contained in:
12
test
12
test
@@ -29,7 +29,8 @@
|
||||
#
|
||||
# Run code coverage
|
||||
# COVERDIR must either be a absolute path or a relative path to the etcd root
|
||||
# $ COVERDIR=coverage PASSES="build_cov cov" ./test
|
||||
# $ COVERDIR=coverage PASSES="build build_cov cov" ./test
|
||||
# $ go tool cover -html ./coverage/cover.out
|
||||
set -e
|
||||
|
||||
# The test script is not supposed to make any changes to the files
|
||||
@@ -43,16 +44,12 @@ source ./scripts/test_lib.sh
|
||||
PASSES=${PASSES:-"fmt bom dep build unit"}
|
||||
PKG=${PKG:-}
|
||||
|
||||
# Invoke ./tests/cover.test.bash for HTML output
|
||||
COVER="--cover=${COVER:-true}"
|
||||
|
||||
if [ -z "$GOARCH" ]; then
|
||||
GOARCH=$(go env GOARCH);
|
||||
fi
|
||||
|
||||
# determine the number of CPUs to use for Go tests
|
||||
CPU=${CPU:-"1,2,4"}
|
||||
echo "Running with CPU:" "${CPU}"
|
||||
CPU=${CPU:-"4"}
|
||||
|
||||
# determine whether target supports race detection
|
||||
if [ -z "${RACE}" ] ; then
|
||||
@@ -66,7 +63,8 @@ else
|
||||
fi
|
||||
|
||||
# This options make sense for cases where SUT (System Under Test) is compiled by test.
|
||||
COMMON_TEST_FLAGS=("-cpu=${CPU}" "${RACE}" "${COVER}")
|
||||
COMMON_TEST_FLAGS=("-cpu=${CPU}" "${RACE}")
|
||||
log_callout "Running with ${COMMON_TEST_FLAGS[*]}"
|
||||
|
||||
RUN_ARG=()
|
||||
if [ -n "${TESTCASE}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user