Skip to content

Commit

Permalink
misc: Test for actual failure vs skipped
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lowe-Power <[email protected]>
  • Loading branch information
powerjg committed Oct 22, 2024
1 parent 9551966 commit 254c5df
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/test-materials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,37 @@ jobs:
uses: actions/checkout@v2

- name: Run test
run: python3 materials/test-material.py "${{ matrix.file }}"
id: run-test
continue-on-error: true
run: |
python3 materials/test-material.py "${{ matrix.file }}"
echo "${{ matrix.file }}=$?" >> results.txt
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: results.txt

aggregate-results:
needs: run-tests
runs-on: ubuntu-latest

steps:
- name: Download test results
uses: actions/download-artifact@v3
with:
name: test-results
path: ./results

- name: Aggregate test results
run: |
failed=0
for test in $(cat ./results/results.txt); do
result=$(echo $test | cut -d'=' -f2)
if [ "$result" -eq 1 ]; then
failed=1
echo "Test failed for $(echo $test | cut -d'=' -f1)"
fi
done
exit $failed
6 changes: 5 additions & 1 deletion materials/test-material.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ def main():
with open(args.script, "r") as f:
script = f.read()

if '"""' not in script:
print("Warning: No docstring found")
return 2

docstring = script.split('"""')[1]

if "$ gem5" not in docstring:
print("Warning: No gem5 command found in docstring")
return 0
return 2

gem5_command = "gem5" + docstring.split("$ gem5")[1].split("\n")[0].strip()
expected_output = docstring.split("$ gem5")[1].split("\n")[1].strip()
Expand Down

0 comments on commit 254c5df

Please sign in to comment.