diff --git a/mithril-client-wasm/analyze-headless-tests-results.sh b/mithril-client-wasm/analyze-headless-tests-results.sh index 88f710fa5e5..8a2671d86dd 100755 --- a/mithril-client-wasm/analyze-headless-tests-results.sh +++ b/mithril-client-wasm/analyze-headless-tests-results.sh @@ -1,13 +1,20 @@ FILENAME=$1 + +if [ ! -e "$FILENAME" ]; then + echo "Error: File '$FILENAME' not found." + exit 1 +fi + +echo "Analyzing headless test results from file: '$FILENAME'" if grep -q 'title="FAILED"' "$FILENAME"; then - failed_info=$(grep -oE '
([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}') - echo $failed_info + FAILED_INFO=$(grep -oE '
([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}') + echo "$FAILED_INFO" exit 1 elif grep -q 'title="OK"' "$FILENAME"; then grep -oE '
([^<]+)' "$FILENAME" | awk '{print substr($0, index($0,$4))}' echo "Success: all tests passed." else cat "$FILENAME" - echo "No test results found. Check $FILENAME output." + echo "No test results found. Check '$FILENAME' output." exit 1 fi