From 6593ed36358c27d3a679e0a640b9de31ea40891a Mon Sep 17 00:00:00 2001 From: Matthew Harrigan Date: Sun, 30 May 2021 03:17:02 -0700 Subject: [PATCH] better prints to make the test log cleaner --- shepherd/Tester.py | 2 +- shepherd/testing_script.py | 15 +++++++++------ .../wait_stress_test_client.shepherd | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/shepherd/Tester.py b/shepherd/Tester.py index e830c26b..ec550924 100644 --- a/shepherd/Tester.py +++ b/shepherd/Tester.py @@ -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 diff --git a/shepherd/testing_script.py b/shepherd/testing_script.py index 3ee7c2d9..477e47ae 100644 --- a/shepherd/testing_script.py +++ b/shepherd/testing_script.py @@ -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 @@ -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 @@ -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)) @@ -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: @@ -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__': diff --git a/shepherd/tests/testing_tests/wait_stress_test/wait_stress_test_client.shepherd b/shepherd/tests/testing_tests/wait_stress_test/wait_stress_test_client.shepherd index 394ca5ea..a5e3cc41 100644 --- a/shepherd/tests/testing_tests/wait_stress_test/wait_stress_test_client.shepherd +++ b/shepherd/tests/testing_tests/wait_stress_test/wait_stress_test_client.shepherd @@ -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)