From d79771aa21bba72864a1077f2e04a8b0433d5561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 22 Jan 2019 00:00:00 +0000 Subject: [PATCH] test-userland: allow selecting just a few tests --- test-userland | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/test-userland b/test-userland index b8b237e..4d7e002 100755 --- a/test-userland +++ b/test-userland @@ -5,32 +5,47 @@ import os import common class Main(common.LkmcCliFunction): + def __init__(self): + super().__init__() + self.add_argument( + 'tests', + metavar='tests', + nargs='*', + help='''\ +If given, run only the given tests. Otherwise, run all tests. +''' + ) + def timed_main(self): run = self.import_path('run').Main() - sources = [ - 'add.c', - 'hello.c', - 'hello_cpp.cpp', - 'print_argv.c', - ] if self.env['emulator'] == 'gem5': extra_args = { 'userland_build_id': 'static', } else: extra_args = {} - if self.env['arch'] == 'x86_64': - arch_sources = [ - 'asm_hello' - ] - elif self.env['arch'] == 'aarch64': - arch_sources = [ - 'asm_hello' + if self.env['tests'] == []: + sources = [ + 'add.c', + 'hello.c', + 'hello_cpp.cpp', + 'print_argv.c', ] + if self.env['arch'] == 'x86_64': + arch_sources = [ + 'asm_hello' + ] + elif self.env['arch'] == 'aarch64': + arch_sources = [ + 'asm_hello' + ] + else: + arch_sources = [] + arch_sources[:] = [os.path.join('arch', self.env['arch'], arch_source) for arch_source in arch_sources] + sources.extend(arch_sources) else: - arch_sources = [] - arch_sources[:] = [os.path.join('arch', self.env['arch'], arch_source) for arch_source in arch_sources] - for source in sources + arch_sources: + sources = self.env['tests'] + for source in sources: exit_status = run( archs=[self.env['arch']], dry_run=self.env['dry_run'],