build: create parallel travis builds to isolate race condition tests
This commit modifies the travis build script, and our local test script to ensure that the race condition builds are conducted in a parallel build. After this commit two travis builds will be kicked off for each push/commit: one that runs the race condition tests in isolation, and another that runs the integration tests then the coverage tests. In order to do the above cleanly, the integration tests are now guarded behind a build flag. In order to run the integration tests, one now needs to specify the `-tags rpctest` flag when running the `go test` command.
This commit is contained in:
parent
01d54c29af
commit
f39b7aaaf9
@ -16,6 +16,9 @@ install:
|
|||||||
- go install . ./cmd/...
|
- go install . ./cmd/...
|
||||||
- popd
|
- popd
|
||||||
- popd
|
- popd
|
||||||
|
env:
|
||||||
|
- RACE=false
|
||||||
|
- RACE=true
|
||||||
script:
|
script:
|
||||||
- export PATH=$PATH:$HOME/gopath/bin
|
- export PATH=$PATH:$HOME/gopath/bin
|
||||||
- ./gotest.sh -l -r -c
|
- ./gotest.sh
|
||||||
|
@ -129,8 +129,8 @@ Bitcoin chain. Also `lnd` also supports Litecoin, one is able to also specified
|
|||||||
be active on Litecoin's testnet4.
|
be active on Litecoin's testnet4.
|
||||||
|
|
||||||
#### Accurate as of:
|
#### Accurate as of:
|
||||||
roasbeef/btcd commit: 54362e17a5b80643ef1e12edc08895a2e2a1202b
|
roasbeef/btcd commit: f8c02aff4e7a807ba0c1349e2db03695d8e790e8
|
||||||
|
|
||||||
roasbeef/btcutil commit: d347e49
|
roasbeef/btcutil commit: a259eaf2ec1b54653cdd67848a41867f280797ee
|
||||||
|
|
||||||
lightningnetwork/lnd commit: d7b36c6
|
lightningnetwork/lnd commit: d7b36c6
|
||||||
|
13
gotest.sh
13
gotest.sh
@ -32,7 +32,7 @@ check_test_ports() {
|
|||||||
# coverage profile. Be aware that we are skipping the integration tests, as the
|
# coverage profile. Be aware that we are skipping the integration tests, as the
|
||||||
# tool won't gather any useful coverage information from them.
|
# tool won't gather any useful coverage information from them.
|
||||||
test_with_coverage_profile() {
|
test_with_coverage_profile() {
|
||||||
print "* Run tests with creating coverage profile"
|
print "* Running tests with creating coverage profile"
|
||||||
check_test_ports
|
check_test_ports
|
||||||
|
|
||||||
echo "mode: count" > profile.cov
|
echo "mode: count" > profile.cov
|
||||||
@ -73,7 +73,7 @@ test_with_coverage_profile() {
|
|||||||
# test_race_conditions run standard go test without creating coverage
|
# test_race_conditions run standard go test without creating coverage
|
||||||
# profile but with race condition checks.
|
# profile but with race condition checks.
|
||||||
test_race_conditions() {
|
test_race_conditions() {
|
||||||
print "* Run tests with race conditions checks"
|
print "* Running tests with the race condition detector"
|
||||||
check_test_ports
|
check_test_ports
|
||||||
|
|
||||||
test_targets=$(go list ./... | grep -v '/vendor/')
|
test_targets=$(go list ./... | grep -v '/vendor/')
|
||||||
@ -151,18 +151,21 @@ print "* Build source"
|
|||||||
go install -v . ./cmd/...
|
go install -v . ./cmd/...
|
||||||
|
|
||||||
# Lint check is first because we shouldn't run tests on garbage code.
|
# Lint check is first because we shouldn't run tests on garbage code.
|
||||||
if [ "$NEED_LINT" == "true" ]; then
|
if [ "$NEED_LINT" == "true" ] || [ "$RACE" == "false" ]; then
|
||||||
lint_check
|
lint_check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Race condition second because we shouldn't check coverage on buggy code.
|
# Race condition second because we shouldn't check coverage on buggy code.
|
||||||
if [ "$NEED_RACE" == "true" ]; then
|
if [ "$NEED_RACE" == "true" ] || [ "$RACE" == "true" ]; then
|
||||||
test_race_conditions
|
test_race_conditions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test coverage is third because in this case code should work properly and
|
# Test coverage is third because in this case code should work properly and
|
||||||
# we may calmly send coverage profile (if script is run on travis)
|
# we may calmly send coverage profile (if script is run on travis)
|
||||||
if [ "$NEED_COVERAGE" == "true" ]; then
|
if [ "$NEED_COVERAGE" == "true" ] || [ "$RACE" == "false" ]; then
|
||||||
|
print "* Running integration tests"
|
||||||
|
go test -v -tags rpctest
|
||||||
|
|
||||||
test_with_coverage_profile
|
test_with_coverage_profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// +build rpctest
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
Loading…
Reference in New Issue
Block a user