| |
@@ -80,6 +80,7 @@
|
| |
debug "Test: $STR_BKR_TEST"
|
| |
debug "Work dir: $STR_WORKDIR"
|
| |
debug "Artifacts dir: $STR_ARTIFACTS_DIR"
|
| |
+ STR_BKR_TEST_DASHED=$(echo "$STR_BKR_TEST" | sed -e 's/\//-/g')
|
| |
|
| |
# Up to this point any fail is considered as ci-sytem fail. Exit code != 0.
|
| |
# Starting from this point and bellow any fail is considered as a test fail. Exit code == 0.
|
| |
@@ -88,13 +89,39 @@
|
| |
rc=$?;
|
| |
trap - SIGINT SIGTERM SIGABRT EXIT # clear the trap
|
| |
echo "Run test $STR_BKR_TEST: done."
|
| |
- # Exit code == 0, no matter of the test result.
|
| |
# Close tee pipes
|
| |
for pid in $(ps -o pid --no-headers --ppid $$); do
|
| |
if [ -n "$(ps -p $pid -o pid=)" ]; then
|
| |
kill -s HUP $pid
|
| |
fi
|
| |
done
|
| |
+ # Check test result status
|
| |
+ local log_file_name="$STR_BKR_TEST_DASHED.log"
|
| |
+ local log_file_path="$STR_ARTIFACTS_DIR/$log_file_name"
|
| |
+ local status
|
| |
+ if [[ $rc -eq 127 ]]; then
|
| |
+ status="ERROR"
|
| |
+ elif grep -q "RESULT: WARN" "$log_file_path"; then
|
| |
+ status="ERROR"
|
| |
+ elif grep -q "RESULT: FAIL" "$log_file_path"; then
|
| |
+ status="FAIL"
|
| |
+ elif grep -q "RESULT: PASS" "$log_file_path"; then
|
| |
+ status="PASS"
|
| |
+ elif grep -q "FAIL" "$log_file_path"; then
|
| |
+ status="FAIL"
|
| |
+ elif grep -q "PASS" "$log_file_path"; then
|
| |
+ status="PASS"
|
| |
+ else
|
| |
+ status="ERROR"
|
| |
+ fi
|
| |
+ echo "$status $STR_BKR_TEST" >> "$STR_ARTIFACTS_DIR/test.log"
|
| |
+ mv "$log_file_path" "$STR_ARTIFACTS_DIR/${status}_${log_file_name}"
|
| |
+ # Handle results.yml file
|
| |
+ local results="$STR_ARTIFACTS_DIR/results.yml"
|
| |
+ local result=$(echo $status | tr '[:upper:]' '[:lower:]')
|
| |
+ test -f "$results" || echo 'results:' > "$results"
|
| |
+ echo "- {result: $result, test: $STR_BKR_TEST}" >> "$results"
|
| |
+ # Exit code == 0, no matter of the test result.
|
| |
exit 0
|
| |
}
|
| |
trap clean_exit SIGINT SIGTERM SIGABRT EXIT
|
| |
@@ -103,9 +130,9 @@
|
| |
export PATH="$PATH:$STR_WORKDIR"
|
| |
mkdir -p "$STR_ARTIFACTS_DIR"
|
| |
# OUTPUTFILE has influence on beakerlib-libraries output
|
| |
- export OUTPUTFILE="$(realpath "$STR_ARTIFACTS_DIR")/$(echo "$STR_BKR_TEST" | sed -e 's/\//-/g')-out.log"
|
| |
- logfile_stdout="$STR_ARTIFACTS_DIR/$(echo "$STR_BKR_TEST" | sed -e 's/\//-/g').log"
|
| |
- logfile_stderr="$STR_ARTIFACTS_DIR/$(echo "$STR_BKR_TEST" | sed -e 's/\//-/g')-err.log"
|
| |
+ export OUTPUTFILE="$(realpath "$STR_ARTIFACTS_DIR")/$STR_BKR_TEST_DASHED-out.log"
|
| |
+ logfile_stdout="$STR_ARTIFACTS_DIR/$STR_BKR_TEST_DASHED.log"
|
| |
+ logfile_stderr="$STR_ARTIFACTS_DIR/$STR_BKR_TEST_DASHED-err.log"
|
| |
exec 3>&1 4>&2 1> >(tee -a "$logfile_stdout" >&3) 2> >(tee -a "$logfile_stderr" >&4)
|
| |
mkdir -p "$STR_WORKDIR"
|
| |
cd "$STR_WORKDIR"
|
| |
@@ -113,7 +140,7 @@
|
| |
if ! [ -d "$STR_BKR_TEST" ] && ! [ -f "$STR_BKR_TEST" ]; then
|
| |
# Next string goes to .log file
|
| |
echo "FAIL test $STR_BKR_TEST does not appear to be a file or directory"
|
| |
- exit 1
|
| |
+ exit 127
|
| |
fi
|
| |
|
| |
if [ -f "$STR_BKR_TEST" ]; then
|
| |
Added support for
results.yaml
to basic and beakerlib role and removed non-zero exit status reporting. @astepano, could you please review if something like this would be OK? I would then continue with other roles as well.Also, when disabling the non-zero exit status I've noticed that
role_result_failed
is only supported by these two roles. Is that expected? Thanks.Resolves #296.