-
Notifications
You must be signed in to change notification settings - Fork 595
Expand file tree
/
Copy pathparallelise
More file actions
executable file
·36 lines (31 loc) · 1.17 KB
/
parallelise
File metadata and controls
executable file
·36 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# For running test cmds that are pathed relative to the repo root.
# Commands are read from stdin.
NO_CD=1 source $(git rev-parse --show-toplevel)/ci3/source
cd $root
jobs=$(get_num_cpus_max ${1:-})
parallel_args="-j$jobs --memsuspend ${MEMSUSPEND:-64G} --line-buffer --joblog joblog.txt"
echo "Starting test run with max $jobs jobs..."
# If we're in a terminal default to a progress bar, and use cache_log to save output to redis.
# Otherwise use denoise to display dots and save output to redis.
if [ -t 1 ]; then
set +e
output=$(parallel $parallel_args --bar "run_test_cmd {}")
code=$?
echo -e "$output" | cache_log "Test run" >/dev/null
if [ "$code" -ne 0 ]; then
echo -e "$output"
exit 1
fi
set -e
else
denoise "parallel $parallel_args 'run_test_cmd {}'"
fi
slow_jobs=$(cat joblog.txt | \
awk 'NR>1 && $4 > 300 {print | "sort -k4,4"}' | \
awk '{print $4 ": " substr($0, index($0, $10))}')
if [ -n "$slow_jobs" ]; then
echo -e "${yellow}WARNING: The following tests exceed 5 minute runtimes. Break them up or rethink them.${reset}"
echo "$slow_jobs"
fi
echo "Completed run of $(tail -n+2 joblog.txt | wc -l) tests in $SECONDS seconds."