Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a script to print the test results
  • Loading branch information
oSoMoN committed Feb 15, 2024
commit a526208ed856dc01215a216836fb8e1efdb62d74
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
with:
name: test-results.json
path: test-results.json
- run: ./print-test-results.sh

coverage:
name: Code Coverage
Expand Down
39 changes: 39 additions & 0 deletions print-test-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Print the test results written to a JSON file
# by run-upstream-testsuite.sh in a markdown format.

json="test-results.json"
[[ -n $1 ]] && json="$1"

codeblock () { echo "\`\`\`"; }

jq -c '.tests[]' "$json" | while read -r test
do
name=$(echo "$test" | jq -r '.test')
echo "# test: $name"
result=$(echo "$test" | jq -r '.result')
echo "result: $result"
url=$(echo "$test" | jq -r '.url')
echo "url: $url"
if [[ "$result" != "SKIP" ]]
then
stdout=$(echo "$test" | jq -r '.stdout' | base64 -d)
if [[ -n "$stdout" ]]
then
echo "## stdout"
codeblock
echo "$stdout"
codeblock
fi
stderr=$(echo "$test" | jq -r '.stderr' | base64 -d)
if [[ -n "$stderr" ]]
then
echo "## stderr"
codeblock
echo "$stderr"
codeblock
fi
fi
echo ""
done