Changeset 0fc91db1 for tests/test.py
- Timestamp:
- Sep 15, 2022, 3:43:02 PM (22 months ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 597e395
- Parents:
- 79ee5b3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/test.py
r79ee5b3 r0fc91db1 23 23 24 24 def match_test(path): 25 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\. nast|\.oast)?(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path)25 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\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(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) 30 test.arch = match.group(3)[1:] if match.group(3) else None 40 31 41 32 expected.append(test) … … 81 72 # this is a valid name, let's check if it already exists 82 73 found = [test for test in all_tests if canonical_path( test.target() ) == testname] 83 setup = itertools.product(settings.all_arch if options.arch else [None] , settings.all_ast if options.ast else [None])74 setup = itertools.product(settings.all_arch if options.arch else [None]) 84 75 if not found: 85 # it's a new name, create it according to the name and specified architecture /ast version86 tests.extend( [Test.new_target(testname, arch , ast) for arch, astin setup] )76 # it's a new name, create it according to the name and specified architecture 77 tests.extend( [Test.new_target(testname, arch) for arch in setup] ) 87 78 elif len(found) == 1 and not found[0].arch: 88 79 # we found a single test, the user better be wanting to create a cross platform test 89 80 if options.arch: 90 81 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)93 82 else: 94 83 tests.append( found[0] ) 95 84 else: 96 85 # this test is already cross platform, just add a test for each platform the user asked 97 tests.extend( [Test.new_target(testname, arch , ast) for arch, astin setup] )86 tests.extend( [Test.new_target(testname, arch) for arch in setup] ) 98 87 99 88 # print a warning if it users didn't ask for a specific architecture … … 102 91 print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr) 103 92 104 105 # print a warning if it users didn't ask for a specific ast version106 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 110 93 else : 111 94 print('ERROR: "%s", tests are not allowed to end with a C/C++/CFA extension, ignoring it' % testname, file=sys.stderr) … … 127 110 # create a parser with the arguments for the tests script 128 111 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)130 112 parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default=None) 131 113 parser.add_argument('--debug', help='Run all tests in debug or release', type=comma_separated(yes_no), default='yes') … … 422 404 # for each build configurations, run the test 423 405 with Timed() as total_dur: 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 406 for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install): 426 407 settings.arch = arch 427 408 settings.debug = debug … … 430 411 # filter out the tests for a different architecture 431 412 # tests are the same across debug/install 432 local_tests = settings.ast.filter( tests ) 433 local_tests = settings.arch.filter( local_tests ) 413 local_tests = settings.arch.filter( tests ) 434 414 435 415 # check the build configuration works … … 438 418 439 419 # print configuration 440 print('%s %i tests on %i cores (%s :%s- %s)' % (420 print('%s %i tests on %i cores (%s - %s)' % ( 441 421 'Regenerating' if settings.generating else 'Running', 442 422 len(local_tests), 443 423 jobs, 444 settings.ast.string,445 424 settings.arch.string, 446 425 settings.debug.string
Note: See TracChangeset
for help on using the changeset viewer.