Enahnce str-commit-final in CI

Seems set_fact task has no fail_when or abort modules and
set failed_when with register module.
This commit is contained in:
Takao Fujiwara 2024-05-16 22:46:26 +09:00
parent 2a53013251
commit 424ea5705d
2 changed files with 9 additions and 6 deletions

View File

@ -1,11 +1,13 @@
#!/bin/bash #!/bin/bash
TEST_LOG="test.log" TEST_LOG="test.log"
TEST_RUN_IN_RAWHIDE="1" TEST_RUN_IN_RAWHIDE=1
declare -i TEST_RUN_IN_RAWHIDE
if [ $# -gt 0 ] ; then if [ $# -gt 0 ] ; then
TEST_LOG="$1" TEST_LOG="$1"
TEST_RUN_IN_RAWHIDE="$2" TEST_RUN_IN_RAWHIDE=$2
fi fi
gen_results() gen_results()
@ -15,7 +17,6 @@ gen_results()
TEST_STATUS_UPPER="$(echo "$TEST_STATUS" | tr '[:lower:]' '[:upper:]')" TEST_STATUS_UPPER="$(echo "$TEST_STATUS" | tr '[:lower:]' '[:upper:]')"
cat > results.xml << _EOF cat > results.xml << _EOF
results: results:
- test: results - test: results
result: $TEST_STATUS result: $TEST_STATUS
runtime: $TEST_RUNTIME runtime: $TEST_RUNTIME
@ -39,12 +40,13 @@ if [ $TEST_RUN_IN_RAWHIDE -eq 0 ] ; then
IS_RAWHIDE="$(grep -i rawhide /etc/fedora-release)" IS_RAWHIDE="$(grep -i rawhide /etc/fedora-release)"
if [ x"$IS_RAWHIDE" != x ] ; then if [ x"$IS_RAWHIDE" != x ] ; then
gen_results "0" "pass" gen_results "0" "pass"
echo -n PASS
exit 0 exit 0
fi fi
fi fi
if [ ! -f $TEST_LOG ] ; then if [ ! -f $TEST_LOG ] ; then
gen_results "0" "fail" gen_results "0" "fail"
echo ERROR echo -n ERROR
else else
FAIL="$(grep "^FAIL: " $TEST_LOG | grep -v 'FAIL: 0$')" FAIL="$(grep "^FAIL: " $TEST_LOG | grep -v 'FAIL: 0$')"
RUNTIME_FAIL="$(grep -v 'frame' $TEST_LOG | grep "^FAIL: " | sed -e "s/FAIL: //")" RUNTIME_FAIL="$(grep -v 'frame' $TEST_LOG | grep "^FAIL: " | sed -e "s/FAIL: //")"
@ -58,9 +60,10 @@ else
RUNTIME="$(expr $RUNTIME_FAIL + $RUNTIME_PASS)" RUNTIME="$(expr $RUNTIME_FAIL + $RUNTIME_PASS)"
if [ x"$FAIL" != x ] ; then if [ x"$FAIL" != x ] ; then
gen_results "$RUNTIME" "fail" gen_results "$RUNTIME" "fail"
echo ERROR echo -n ERROR
else else
gen_results "$RUNTIME" "pass" gen_results "$RUNTIME" "pass"
echo -n PASS
fi fi
fi fi

View File

@ -208,7 +208,7 @@
- name: Check the results - name: Check the results
script: check-results.sh "{{ remote_artifacts }}/test.log" "0" script: check-results.sh "{{ remote_artifacts }}/test.log" "0"
register: test_fails register: test_fails
failed_when: False failed_when: '"ERROR" in test_fails.stdout'
- name: Set role result - name: Set role result
set_fact: set_fact: