Commit 042da45b authored by Alexandros Frantzis's avatar Alexandros Frantzis

Improve error handling in run-tests.sh

Signed-off-by: Alexandros Frantzis's avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
parent 1ca40d71
Pipeline #81939 passed with stages
in 13 minutes and 46 seconds
......@@ -17,13 +17,16 @@ fetch_trace()
_trace="${1//,/?}"
echo -n "[fetch_trace] Fetching $1... "
_output=$(git lfs pull -I "$_trace" 2>&1)
_ret=0
if [[ $? -ne 0 || ! -f "$1" ]]; then
echo "ERROR"
echo "$_output"
_ret=1
else
echo "OK"
fi
restore_clean_git
return $_ret
}
fetch_reference_images()
......@@ -33,13 +36,16 @@ fetch_reference_images()
_wildcard="**/$_device_name/*$_trace_type*.png"
echo -n "[fetch_trace] Fetching reference images '$_wildcard'... "
_output=$(git lfs pull -I "$_wildcard" 2>&1)
_ret=0
if [[ $? -ne 0 ]]; then
echo "ERROR"
echo "$_output"
_ret=1
else
echo "OK"
fi
restore_clean_git
return $_ret
}
# During git operations various git objects get created which
......@@ -48,22 +54,16 @@ fetch_reference_images()
# storage consumption low.
create_clean_git
fetch_reference_images "$DEVICE_NAME" "$1"
fetch_reference_images "$DEVICE_NAME" "$1" || exit $?
ret=0
for trace in $(git lfs ls-files -n -I \*.$1)
do
if ! python3 "$CI_PROJECT_DIR/scripts/trace_has_ref_images.py" --device-name "$DEVICE_NAME" "$trace"; then
echo "[fetch_trace] Skipping $trace since it has no reference images"
continue;
fi
fetch_trace "$trace"
python3 $CI_PROJECT_DIR/scripts/dump_trace_images.py --device-name "$DEVICE_NAME" "$trace"
python3 $CI_PROJECT_DIR/scripts/diff_trace_images.py --device-name "$DEVICE_NAME" --output-dir "$CI_PROJECT_DIR/results" "$trace"
if [[ $? -ne 0 ]]; then
ret=1
fi
python3 "$CI_PROJECT_DIR/scripts/trace_has_ref_images.py" --device-name "$DEVICE_NAME" "$trace" || { echo "[fetch_trace] Skipping $trace since it has no reference images"; continue; }
fetch_trace "$trace" || exit $?
python3 "$CI_PROJECT_DIR/scripts/dump_trace_images.py" --device-name "$DEVICE_NAME" "$trace" || exit $?
python3 "$CI_PROJECT_DIR/scripts/diff_trace_images.py" --device-name "$DEVICE_NAME" --output-dir "$CI_PROJECT_DIR/results" "$trace" || ret=1
rm "$trace"
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment