Changes in tests/test.py [0fc91db1:7831e8fb]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/test.py
r0fc91db1 r7831e8fb 23 23 24 24 def match_test(path): 25 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\. [\w\-_]+)?\.txt$" % settings.SRCDIR, path)25 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.nast|\.oast)?(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path) 26 26 if match : 27 27 test = Test() 28 28 test.name = match.group(2) 29 29 test.path = match.group(1) 30 test.arch = match.group(3)[1:] if match.group(3) else None 30 test.arch = match.group(4)[1:] if match.group(4) else None 31 32 astv = match.group(3)[1:] if match.group(3) else None 33 if astv == 'oast': 34 test.astv = 'old' 35 elif astv == 'nast': 36 test.astv = 'new' 37 elif astv: 38 print('ERROR: "%s", expect file has astv but it is not "nast" or "oast"' % testname, file=sys.stderr) 39 sys.exit(1) 31 40 32 41 expected.append(test) … … 72 81 # this is a valid name, let's check if it already exists 73 82 found = [test for test in all_tests if canonical_path( test.target() ) == testname] 74 setup = itertools.product(settings.all_arch if options.arch else [None] )83 setup = itertools.product(settings.all_arch if options.arch else [None], settings.all_ast if options.ast else [None]) 75 84 if not found: 76 # it's a new name, create it according to the name and specified architecture 77 tests.extend( [Test.new_target(testname, arch ) for archin setup] )85 # it's a new name, create it according to the name and specified architecture/ast version 86 tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] ) 78 87 elif len(found) == 1 and not found[0].arch: 79 88 # we found a single test, the user better be wanting to create a cross platform test 80 89 if options.arch: 81 90 print('ERROR: "%s", test has no specified architecture but --arch was specified, ignoring it' % testname, file=sys.stderr) 91 elif options.ast: 92 print('ERROR: "%s", test has no specified ast version but --ast was specified, ignoring it' % testname, file=sys.stderr) 82 93 else: 83 94 tests.append( found[0] ) 84 95 else: 85 96 # this test is already cross platform, just add a test for each platform the user asked 86 tests.extend( [Test.new_target(testname, arch ) for archin setup] )97 tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] ) 87 98 88 99 # print a warning if it users didn't ask for a specific architecture … … 91 102 print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr) 92 103 104 105 # print a warning if it users didn't ask for a specific ast version 106 found_astv = [f.astv for f in found if f.astv] 107 if found_astv and not options.ast: 108 print('WARNING: "%s", test has ast version specific expected files but --ast was not specified, regenerating only for current ast' % testname, file=sys.stderr) 109 93 110 else : 94 111 print('ERROR: "%s", tests are not allowed to end with a C/C++/CFA extension, ignoring it' % testname, file=sys.stderr) … … 110 127 # create a parser with the arguments for the tests script 111 128 parser = argparse.ArgumentParser(description='Script which runs cforall tests') 129 parser.add_argument('--ast', help='Test for specific ast', type=comma_separated(str), default=None) 112 130 parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default=None) 113 131 parser.add_argument('--debug', help='Run all tests in debug or release', type=comma_separated(yes_no), default='yes') … … 333 351 334 352 # print the possible options 335 print("-h --help --debug --dry-run --list --a rch --all --regenerate-expected --archive-errors --install --timeout --global-timeout --timeout-with-gdb -j --jobs -I --include -E --exclude --continue ", end='')353 print("-h --help --debug --dry-run --list --ast=new --ast=old --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout --timeout-with-gdb -j --jobs -I --include -E --exclude --continue ", end='') 336 354 print(" ".join(map(lambda t: "%s" % (t.target()), tests))) 337 355 … … 404 422 # for each build configurations, run the test 405 423 with Timed() as total_dur: 406 for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install): 424 for ast, arch, debug, install in itertools.product(settings.all_ast, settings.all_arch, settings.all_debug, settings.all_install): 425 settings.ast = ast 407 426 settings.arch = arch 408 427 settings.debug = debug … … 411 430 # filter out the tests for a different architecture 412 431 # tests are the same across debug/install 413 local_tests = settings.arch.filter( tests ) 432 local_tests = settings.ast.filter( tests ) 433 local_tests = settings.arch.filter( local_tests ) 414 434 415 435 # check the build configuration works … … 418 438 419 439 # print configuration 420 print('%s %i tests on %i cores (%s - %s)' % (440 print('%s %i tests on %i cores (%s:%s - %s)' % ( 421 441 'Regenerating' if settings.generating else 'Running', 422 442 len(local_tests), 423 443 jobs, 444 settings.ast.string, 424 445 settings.arch.string, 425 446 settings.debug.string
Note:
See TracChangeset
for help on using the changeset viewer.