Skip to content

Commit d9adcd3

Browse files
frncmxfjl
authored andcommitted
travis.yml: add race detector job for Swarm (ethereum#19148)
1 parent 1993227 commit d9adcd3

File tree

2 files changed

+61
-6
lines changed

2 files changed

+61
-6
lines changed

.travis.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ matrix:
5353
- go run build/ci.go lint
5454

5555
# This builder does the Ubuntu PPA upload
56-
- if: type = push
56+
- if: repo = ethereum/go-ethereum AND type = push
5757
os: linux
5858
dist: trusty
5959
go: 1.11.x
@@ -75,7 +75,7 @@ matrix:
7575
- go run build/ci.go debsrc -upload ethereum/ethereum -sftp-user geth-ci -signer "Go Ethereum Linux Builder <[email protected]>"
7676

7777
# This builder does the Linux Azure uploads
78-
- if: type = push
78+
- if: repo = ethereum/go-ethereum AND type = push
7979
os: linux
8080
dist: trusty
8181
sudo: required
@@ -109,7 +109,7 @@ matrix:
109109
- go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
110110

111111
# This builder does the Linux Azure MIPS xgo uploads
112-
- if: type = push
112+
- if: repo = ethereum/go-ethereum AND type = push
113113
os: linux
114114
dist: trusty
115115
services:
@@ -137,7 +137,7 @@ matrix:
137137
- go run build/ci.go archive -arch mips64le -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
138138

139139
# This builder does the Android Maven and Azure uploads
140-
- if: type = push
140+
- if: repo = ethereum/go-ethereum AND type = push
141141
os: linux
142142
dist: trusty
143143
addons:
@@ -175,7 +175,7 @@ matrix:
175175
- go run build/ci.go aar -signer ANDROID_SIGNING_KEY -deploy https://oss.sonatype.org -upload gethstore/builds
176176

177177
# This builder does the OSX Azure, iOS CocoaPods and iOS Azure uploads
178-
- if: type = push
178+
- if: repo = ethereum/go-ethereum AND type = push
179179
os: osx
180180
go: 1.11.x
181181
env:
@@ -204,7 +204,7 @@ matrix:
204204
- go run build/ci.go xcode -signer IOS_SIGNING_KEY -deploy trunk -upload gethstore/builds
205205

206206
# This builder does the Azure archive purges to avoid accumulating junk
207-
- if: type = cron
207+
- if: repo = ethereum/go-ethereum AND type = cron
208208
os: linux
209209
dist: trusty
210210
go: 1.11.x
@@ -214,3 +214,12 @@ matrix:
214214
submodules: false # avoid cloning ethereum/tests
215215
script:
216216
- go run build/ci.go purge -store gethstore/builds -days 14
217+
218+
- name: Race Detector for Swarm
219+
if: repo = ethersphere/go-ethereum
220+
os: linux
221+
dist: trusty
222+
go: 1.11.x
223+
git:
224+
submodules: false # avoid cloning ethereum/tests
225+
script: ./build/travis_keepalive.sh go test -v -timeout 20m -race ./swarm...

build/travis_keepalive.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
# travis_keepalive runs the given command and preserves its return value,
4+
# while it forks a child process what periodically produces a log line,
5+
# so that Travis won't abort the build after 10 minutes.
6+
7+
# Why?
8+
# `t.Log()` in Go holds the buffer until the test does not pass or fail,
9+
# and `-race` can increase the execution time by 2-20x.
10+
11+
set -euo pipefail
12+
13+
readonly KEEPALIVE_INTERVAL=300 # seconds => 5m
14+
15+
main() {
16+
keepalive
17+
$@
18+
}
19+
20+
# Keepalive produces a log line in each KEEPALIVE_INTERVAL.
21+
keepalive() {
22+
local child_pid
23+
# Note: We fork here!
24+
repeat "keepalive" &
25+
child_pid=$!
26+
ensureChildOnEXIT "${child_pid}"
27+
}
28+
29+
repeat() {
30+
local this="$1"
31+
while true; do
32+
echo "${this}"
33+
sleep "${KEEPALIVE_INTERVAL}"
34+
done
35+
}
36+
37+
# Ensures that the child gets killed on normal program exit.
38+
ensureChildOnEXIT() {
39+
# Note: SIGINT and SIGTERM are forwarded to the child process by Bash
40+
# automatically, so we don't have to deal with signals.
41+
42+
local child_pid="$1"
43+
trap "kill ${child_pid}" EXIT
44+
}
45+
46+
main "$@"

0 commit comments

Comments
 (0)