-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathinstallability_runner.sh
executable file
·55 lines (49 loc) · 1.57 KB
/
installability_runner.sh
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
#!/bin/bash
[ -z "$TMT_VERSION" ] && { echo "Please run using tmt run. See README.md."; exit 1; }
get_result () {
local result
case $1 in
0) result="pass" ;;
1) result="fail" ;;
*) result="error" ;;
esac
echo "$result"
}
TESTRUN_ID="$(date +%H%M%S)"
LOGS_DIR=${LOGS_DIR:-${TMT_TEST_DATA}/mtps-logs}
mkdir -p "${LOGS_DIR}"
if [[ -f ${TMT_PLAN_DATA}/SKIP_TEST ]]; then
# The SKIP_TEST file contains a reason why the prepare.sh ended unexpectedly.
# Copy it to a log file which can be parsed by generate-result-json
# (to show the reason in viewer.html)
cat ${TMT_PLAN_DATA}/SKIP_TEST
cp ${TMT_PLAN_DATA}/SKIP_TEST "${LOGS_DIR}/SKIP-${TESTRUN_ID}-install-package.log"
tmtresult="skip"
else
highrc=0
for method in "install" "update" "downgrade" "remove"; do
mtps-run-tests "$@" --test="$method";
thisrc=$?
thisres="$(get_result $thisrc)"
echo "$method result: $thisres (status code: $thisrc)"
if [ "$thisrc" -gt "$highrc" ]; then
highrc="$thisrc"
fi
done
tmtresult="$(get_result $highrc)"
fi
# generate the result JSON
/usr/libexec/mini-tps/viewer/generate-result-json "$LOGS_DIR" > "$TMT_TEST_DATA/result.json"
# copy the viewer HTML
cp /usr/share/mini-tps/viewer/viewer.html "$TMT_TEST_DATA/viewer.html"
cat <<FOE > "$TMT_TEST_DATA/results.yaml"
- name: /installability
result: $tmtresult
log:
- ../output.txt
- viewer.html
- result.json
FOE
echo "running in TMT, wrote $TMT_TEST_DATA/results.yaml"
echo "mtps-run-tests overall result: $tmtresult (status code: $highrc)"
exit $highrc