Skip to content

Commit

Permalink
better prints to make the test log cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
FIREdog5 committed May 30, 2021
1 parent ae12183 commit 6593ed3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion shepherd/Tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def main():
line = line[0:-1]
FILE.append(line)
file.close()
print('Starting test: {}'.format(sys.argv[1]))
print('Starting TEST file: {}'.format(sys.argv[1]))
return 0


Expand Down
15 changes: 9 additions & 6 deletions shepherd/testing_script.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
This file runs the tests in the tests folder and exits with code 0 on success.
This will be used from Travis.
This will be used by Travis.
"""
import os
from os import DirEntry
Expand All @@ -15,7 +15,7 @@
def run_test(name, path, verbose=False):
'''
Reads the instructions file and runs each test in the order specified by the instructions.
Waits until the first process fails or until all processes succesfully exit.
Waits until the first process fails or until all TEST processes succesfully exit.
There is a 0.1 second delay between each process to ensure that the order is maintained.
If you are encountering an infinite loop, try changing this delay
Expand All @@ -26,6 +26,7 @@ def run_test(name, path, verbose=False):
the begining of all your TEST files for additional delay.
'''
global SUCCESS
print(f"[STARTING] {name}")
instructions = open(os.path.join(
path, 'instructions.shepherd'), "r")
files = list(map(lambda s: s.strip().split(" "), instructions))
Expand Down Expand Up @@ -55,10 +56,10 @@ def run_test(name, path, verbose=False):
elif poll != 0:
passed = False
if passed:
print(f"PASSED {name}")
print(f"[PASSED] {name}")
else:
print(f'one or more processes errored when running {name}')
print(f"FAILED {name}")
print(f"[FAILED] {name}")
SUCCESS = False
print("---------------\n")
for process in real_processes:
Expand Down Expand Up @@ -125,14 +126,16 @@ def start():
queued_tests = tests

# and now run them
print(f"Running {len(queued_tests)} out of {len(tests)} possible tests")
print("---------------\n")
for test in queued_tests:
run_test(test, os.path.join('./tests', test), verbose=True)

if SUCCESS:
print("PASSED ALL TESTS")
print("[PASSED ALL TESTS]")
sys.exit(0)
else:
print("DID NOT PASS ALL TESTS")
print("[DID NOT PASS ALL TESTS]")
sys.exit(-1)

if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ RUN go = 0
WHILE go < 10
WAIT SCOREBOARD_HEADER.ALL_INFO FROM LCM_TARGETS.SCOREBOARD
RUN go = go + 1
PRINT 1
END
PRINT got 10 headers(1)
RUN go = 0
WHILE go < 10
WAIT SCOREBOARD_HEADER.ALL_INFO FROM LCM_TARGETS.SCOREBOARD WITH a = 'a'
IF a == 1
RUN go = go + 1
PRINT 2
END
END
PRINT got 10 headers(2)
RUN go = 0
WHILE go < 10
WAIT SCOREBOARD_HEADER.ALL_INFO FROM LCM_TARGETS.SCOREBOARD SET b = 1
IF b == 1
RUN go = go + 1
PRINT 3
END
RUN b = 0
END
PRINT got 10 headers(3)

0 comments on commit 6593ed3

Please sign in to comment.