Skip to content

Commit

Permalink
scar: exit with 1 if any test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
saursin committed Sep 13, 2023
1 parent e0ec9ad commit f226d88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions test/scar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $(shell mkdir -p work)

default: clean verify

.PHONY: verify
verify:
$(PY) scar.py

Expand Down
15 changes: 8 additions & 7 deletions test/scar/scar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#########################################
# RISCV - Atom verification framework #
#########################################
import os
import os, sys
import subprocess
import glob
from colorama import Fore, Back, Style
Expand Down Expand Up @@ -94,7 +94,7 @@ def compile(tests, save_objdump=False):

if (dump.returncode != 0):
print(Fore.RED+"EXITING due to compile error!"+Style.RESET_ALL)
exit()
sys.exit(1)

# get objdumpdump
if save_objdump:
Expand Down Expand Up @@ -152,7 +152,7 @@ def verify(test):
f.close()
except:
print("Unable to open file :" + test)
exit()
sys.exit(1)

# find start of assert block
assert_block_start = -1
Expand Down Expand Up @@ -296,19 +296,20 @@ def verify(test):
count = 1
for t in tests:
print(str(count)+").\t"+t, end="")

print(" "*(30-len(t)), end="- ")

if t in passed_tests:
print(Fore.GREEN+"Passed"+Style.RESET_ALL)
elif t in ignored_tests:
print(Fore.YELLOW+"Ignored"+Style.RESET_ALL)
else:
print(Fore.RED+"Failed"+Style.RESET_ALL)

count=count+1


print(Fore.GREEN+"\nPassed tests : " + str(len(passed_tests)) + '/' + str(len(tests))+ Style.RESET_ALL)
print(Fore.YELLOW+"Ignored tests : " + str(len(ignored_tests)) + '/' + str(len(tests))+ Style.RESET_ALL)
print(Fore.RED+"Failed tests : " + str(len(failed_tests)) + '/' +str(len(tests))+ Style.RESET_ALL)
print(Fore.RED+"Failed tests : " + str(len(failed_tests)) + '/' +str(len(tests))+ Style.RESET_ALL)

if len(failed_tests) > 0:
sys.exit(1)

0 comments on commit f226d88

Please sign in to comment.