Merge ~paride/curtin:feature/jenkins-runner-shuf into curtin:master

Proposed by Paride Legovini
Status: Merged
Approved by: Dan Watkins
Approved revision: 688ffea1da8ccbdc09e8c1c27d33fb14667c5a29
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~paride/curtin:feature/jenkins-runner-shuf
Merge into: curtin:master
Diff against target: 49 lines (+14/-2)
1 file modified
tools/jenkins-runner (+14/-2)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Dan Watkins (community) Approve
Review via email: mp+385811@code.launchpad.net

Commit message

tools/jenkins-runner: shuffle test-cases to randomize load

Enabling jenkins-runner to enumerate all of the tests to be
run and then run them through 'shuf' which will randomize
each test class for selection by the parallel threads of
execution. This will reduce the likelihood that we have
four executions of a Bcache or Raid or other heavy storage
which is what we get with current module level parallelism.

This behavior can be disabled by exporting:

CURTIN_VMTEST_SHUFFLE_TESTS=0

It is enabled by default.

To post a comment you must log in.
Revision history for this message
Paride Legovini (paride) wrote :

This is

https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/381792

rebased and with the typo fixed. The original MP already had a +1 from Chad and me, and wasn't merged just because of the typo.

Revision history for this message
Dan Watkins (oddbloke) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/jenkins-runner b/tools/jenkins-runner
2index 253b722..375dc3c 100755
3--- a/tools/jenkins-runner
4+++ b/tools/jenkins-runner
5@@ -5,6 +5,7 @@ topdir="${CURTIN_VMTEST_TOPDIR:-${WORKSPACE:-$PWD}/output}"
6 pkeep=${CURTIN_VMTEST_KEEP_DATA_PASS:-logs,collect}
7 fkeep=${CURTIN_VMTEST_KEEP_DATA_FAIL:-logs,collect}
8 reuse=${CURTIN_VMTEST_REUSE_TOPDIR:-0}
9+shuffle=${CURTIN_VMTEST_SHUFFLE_TESTS:-1}
10 declare -i ltimeout=${CURTIN_VMTEST_IMAGE_LOCK_TIMEOUT:-"-1"}
11 export CURTIN_VMTEST_TAR_DISKS=${CURTIN_VMTEST_TAR_DISKS:-0}
12 export CURTIN_VMTEST_REUSE_TOPDIR=$reuse
13@@ -14,6 +15,7 @@ export CURTIN_VMTEST_KEEP_DATA_FAIL=$fkeep
14 export CURTIN_VMTEST_TOPDIR="$topdir"
15 export CURTIN_VMTEST_LOG="${CURTIN_VMTEST_LOG:-$topdir/debug.log}"
16 export CURTIN_VMTEST_PARALLEL=${CURTIN_VMTEST_PARALLEL:-0}
17+export CURTIN_VMTEST_SHUFFLE_TESTS=$shuffle
18 export IMAGE_DIR=${IMAGE_DIR:-/srv/images}
19
20 # empty TGT_* variables in current env to avoid killing a pid we didn't start.
21@@ -50,6 +52,15 @@ if [ "$reuse" != "1" ]; then
22 mkdir -p "$topdir" || fail "failed mkdir $topdir"
23 fi
24
25+# Use 'shuf' to randomize test case execution order
26+if [ "$shuffle" == "1" ]; then
27+ SHUFFLE="shuf"
28+else
29+ # when disabled just repeat the input to output
30+ SHUFFLE="tee"
31+fi
32+
33+
34 start_s=$(date +%s)
35 parallel=${CURTIN_VMTEST_PARALLEL}
36 ntfilters=( )
37@@ -83,9 +94,10 @@ if [ "${#tests[@]}" -ne 0 -a "${#ntfilters[@]}" -ne 0 ]; then
38 error "test arguments provided were: ${#tests[*]}"
39 fail
40 elif [ "${#tests[@]}" -eq 0 -a "${#ntfilters[@]}" -eq 0 ]; then
41- tests=( tests/vmtests )
42+ # run filter without args to enumerate all tests and maybe shuffle
43+ tests=( $(./tools/vmtest-filter | ${SHUFFLE}) )
44 elif [ "${#ntfilters[@]}" -ne 0 ]; then
45- tests=( $(./tools/vmtest-filter "${ntfilters[@]}") )
46+ tests=( $(./tools/vmtest-filter "${ntfilters[@]}" | ${SHUFFLE}) )
47 if [ "${#tests[@]}" -eq 0 ]; then
48 error "Failed to find any tests with filter(s): \"${ntfilters[*]}\""
49 fail "Try testing filters with: ./tools/vmtest-filter ${ntfilters[*]}"

Subscribers

People subscribed via source and target branches