diff options
author | Ben Gras <beng@shrike-systems.com> | 2014-04-27 19:35:01 +0200 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-05-09 21:39:01 +1000 |
commit | 803b63d76e3b73e6624758447dd56be42a616fbe (patch) | |
tree | 5e5b8a9b978cbde18d8253adb4df5b4b2a002009 /tester | |
parent | 47d652c9ff119a266ef55f16df643a988d47bb6d (diff) |
add --filter to specify the set of selected tests.
. parameter is a glob
. default is *.exe as it was
. it is a convenient way to select a particular test to run over and
over again while debugging it, without laboriously manipulating the
.exe's that are present (i.e. moving/deleting them)
Diffstat (limited to 'tester')
-rw-r--r-- | tester/rt/test.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tester/rt/test.py b/tester/rt/test.py index 15da4ee..c667479 100644 --- a/tester/rt/test.py +++ b/tester/rt/test.py @@ -44,6 +44,7 @@ import console import options import report import version +import fnmatch def stacktraces(): import traceback @@ -119,7 +120,7 @@ class test_run(object): if self.result is not None: raise self.result[0], self.result[1], self.result[2] -def find_executables(paths): +def find_executables(paths, glob): executables = [] for p in paths: if path.isfile(p): @@ -127,7 +128,7 @@ def find_executables(paths): elif path.isdir(p): for root, dirs, files in os.walk(p, followlinks = True): for f in files: - if f.lower().endswith('.exe'): + if fnmatch.fnmatch(f.lower(), glob): executables += [path.join(root, f)] return sorted(executables) @@ -178,12 +179,15 @@ def run(command_path = None): import sys stdtty = console.save() opts = None + default_exefilter = '*.exe' try: optargs = { '--rtems-tools': 'The path to the RTEMS tools', '--rtems-bsp': 'The RTEMS BSP to run the test on', '--report-mode': 'Reporting modes, failures (default),all,none', '--list-bsps': 'List the supported BSPs', '--debug-trace': 'Debug trace based on specific flags', + '--filter': 'Glob that executables must match to run (default: ' + + default_exefilter + ')', '--stacktrace': 'Dump a stack trace on a user termination (^C)' } opts = options.load(sys.argv, optargs = optargs, @@ -191,6 +195,11 @@ def run(command_path = None): log.notice('RTEMS Testing - Tester, v%s' % (version.str())) if opts.find_arg('--list-bsps'): list_bsps(opts) + exe_filter = opts.find_arg('--filter') + if exe_filter: + exe_filter = exe_filter[1] + else: + exe_filter = default_exefilter opts.log_info() debug_trace = opts.find_arg('--debug-trace') if debug_trace: @@ -225,7 +234,7 @@ def run(command_path = None): report_mode = report_mode[1] else: report_mode = 'failures' - executables = find_executables(opts.params()) + executables = find_executables(opts.params(), exe_filter) if len(executables) == 0: raise error.general('no executbles supplied') start_time = datetime.datetime.now() |