-
Notifications
You must be signed in to change notification settings - Fork 604
/
Copy pathrun-spread
executable file
·70 lines (56 loc) · 2.22 KB
/
run-spread
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -xeu
need_rebuild=1
shopt -s nullglob
if [ "${NO_REBUILD:-0}" = "1" ]; then
echo "-- $(date) -- requested no snap rebuild"
need_rebuild=0
# check if we have any snaps built at all
built_snaps=(built-snap/snapd_*.snap.keep)
if (( "${#built_snaps[@]}" > 0 )); then
echo "-- $(date) -- found prebuilt snapd snaps:"
for s in "${built_snaps[@]}"; do
echo "-- $s"
done
else
echo "-- $(date) -- no prebuilt snaps found"
need_rebuild=1
fi
fi
if [ "$need_rebuild" = 1 ]; then
echo "-- $(date) -- rebuilding snapd snap"
./tests/build-test-snapd-snap
echo "-- $(date) -- snapd snap rebuild complete"
fi
if [ -z "$SPREAD_TAG_FEATURES" ]; then
SPREAD_USE_PREBUILT_SNAPD_SNAP=true exec spread "$@"
else
WRITE_DIR="/tmp/features"
RUN_TESTS=("$@")
NUM_ATTEMPTS=${NUM_ATTEMPTS:-1}
export SPREAD_USE_PREBUILT_SNAPD_SNAP=true
mkdir -p "$WRITE_DIR"
for i in $(seq 1 "$NUM_ATTEMPTS"); do
spread -artifacts "${WRITE_DIR}"/features-artifacts -no-debug-output "${RUN_TESTS[@]}" | tee "${WRITE_DIR}/spread-logs.txt"
if [ -f "$WRITE_DIR"/spread-logs.txt ]; then
./tests/lib/external/snapd-testing-tools/utils/log-parser "${WRITE_DIR}"/spread-logs.txt --output "${WRITE_DIR}"/spread-results.json
./tests/lib/external/snapd-testing-tools/utils/log-analyzer list-reexecute-tasks "${RUN_TESTS[@]}" "${WRITE_DIR}"/spread-results.json > "${WRITE_DIR}"/failed-tests.txt
else
touch "${WRITE_DIR}/failed-tests.txt"
fi
./tests/lib/compose-features.py \
--dir ${WRITE_DIR}/features-artifacts/feature-tags \
--output ${WRITE_DIR}/composed-feature-tags \
--failed-tests "$(cat ${WRITE_DIR}/failed-tests.txt)" \
--run-attempt "${i}"
if [ ! -s "${WRITE_DIR}/failed-tests.txt" ]; then
break
fi
mapfile RUN_TESTS < "${WRITE_DIR}"/failed-tests.txt
done
./tests/lib/compose-features.py \
--dir ${WRITE_DIR}/composed-feature-tags \
--output ${WRITE_DIR}/final-feature-tags \
--replace-old-runs
echo "Your feature tags can be found in $WRITE_DIR/final-feature-tags"
fi