Skip to content

Commit

Permalink
enhance script
Browse files Browse the repository at this point in the history
  • Loading branch information
dlachaume committed Jan 30, 2024
1 parent c5c14d2 commit aebf4c9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mithril-client-wasm/analyze-headless-tests-results.sh
Original file line number Diff line number Diff line change
@@ -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 '<div id="[^"]+" title="FAILED">([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}')
echo $failed_info
FAILED_INFO=$(grep -oE '<div id="[^"]+" title="FAILED">([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}')
echo "$FAILED_INFO"
exit 1
elif grep -q 'title="OK"' "$FILENAME"; then
grep -oE '<div id="[^"]+" title="OK">([^<]+)' "$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

0 comments on commit aebf4c9

Please sign in to comment.