aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Lechner2020-03-26 22:41:38 -0500
committerDamien George2020-03-30 13:25:58 +1100
commit581f9135a4148e236d62b2d28911f98aa92905e1 (patch)
tree28ddc8e6f09ebb32022379db0b7577018fdf3907 /tests
parent6110cd30780c1b539bf9a67352962bf026b6a2ce (diff)
tests/run-tests: Add commands to print and clean *.exp,out files.
This adds a couple of commands to the run-tests script to print the diffs of failed tests and also to clean up the .exp and .out files after failed tests. (And a spelling error is fixed while we are touching nearby code.) Travis is also updated to use these new commands, including using it for more builds.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run-tests23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/run-tests b/tests/run-tests
index e34c2531f..2240697b6 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -564,7 +564,7 @@ directory with the MicroPython output and the expectations, respectively.
Options -i and -e can be multiple and processed in the order given. Regex
"search" (vs "match") operation is used. An action (include/exclude) of
the last matching regex is used:
- run-tests -i async - exclude all, then include tests containg "async" anywhere
+ run-tests -i async - exclude all, then include tests containing "async" anywhere
run-tests -e '/big.+int' - include all, then exclude by regex
run-tests -e async -i async_foo - include all, exclude async, yet still include async_foo
''')
@@ -584,8 +584,29 @@ the last matching regex is used:
cmd_parser.add_argument('--mpy-cross-flags', default='-mcache-lookup-bc', help='flags to pass to mpy-cross')
cmd_parser.add_argument('--keep-path', action='store_true', help='do not clear MICROPYPATH when running tests')
cmd_parser.add_argument('files', nargs='*', help='input test files')
+ cmd_parser.add_argument('--print-failures', action='store_true', help='print the diff of expected vs. actual output for failed tests and exit')
+ cmd_parser.add_argument('--clean-failures', action='store_true', help='delete the .exp and .out files from failed tests and exit')
args = cmd_parser.parse_args()
+ if args.print_failures:
+ os.chdir(os.path.abspath(os.path.dirname(__file__)))
+
+ for exp in glob("*.exp"):
+ testbase = os.path.basename(exp)[:-4]
+ print()
+ print("FAILURE {0}".format(testbase))
+ os.system("diff -u {0}.exp {0}.out".format(testbase))
+
+ sys.exit(0)
+
+ if args.clean_failures:
+ os.chdir(os.path.abspath(os.path.dirname(__file__)))
+
+ for f in glob("*.exp") + glob("*.out"):
+ os.remove(f)
+
+ sys.exit(0)
+
LOCAL_TARGETS = ('unix', 'qemu-arm',)
EXTERNAL_TARGETS = ('pyboard', 'wipy', 'esp8266', 'esp32', 'minimal', 'nrf')
if args.target in LOCAL_TARGETS or args.list_tests: