Changeset 0fc91db1
- Timestamp:
- Sep 15, 2022, 3:43:02 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 597e395
- Parents:
- 79ee5b3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
r79ee5b3 r0fc91db1 24 24 #Trasforming cc1 will break compilation 25 25 M4CFA_PROGRAM_NAME 26 27 #==============================================================================28 # New AST toggling support29 AH_TEMPLATE([CFA_USE_NEW_AST],[Sets whether or not to use the new-ast, this is adefault value and can be overrided by --old-ast and --new-ast])30 DEFAULT_NEW_AST="True"31 AC_ARG_ENABLE(new-ast,32 [ --enable-new-ast whether or not to use new ast as the default AST algorithm],33 [case "${enableval}" in34 yes) newast=true ; DEFAULT_NEW_AST="True" ;;35 no) newast=false; DEFAULT_NEW_AST="False" ;;36 *) AC_MSG_ERROR([bad value ${enableval} for --enable-new-ast]) ;;37 esac],[newast=true])38 AC_DEFINE_UNQUOTED([CFA_USE_NEW_AST], $newast)39 AC_SUBST(DEFAULT_NEW_AST)40 26 41 27 #============================================================================== … … 139 125 \'--enable-gprofiler=*) ;; 140 126 \'--disable-gprofiler) ;; 141 142 # skip the target hosts143 \'--enable-new-ast=*) ;;144 \'--disable-new-ast) ;;145 127 146 128 # skip this, it only causes problems -
src/CompilationState.cc
r79ee5b3 r0fc91db1 31 31 genproto = false, 32 32 deterministic_output = false, 33 useNewAST = CFA_USE_NEW_AST,33 useNewAST = true, 34 34 nomainp = false, 35 35 parsep = false, -
src/config.h.in
r79ee5b3 r0fc91db1 27 27 /* Location of cfa install. */ 28 28 #undef CFA_PREFIX 29 30 /* Sets whether or not to use the new-ast, this is adefault value and can be31 overrided by --old-ast and --new-ast */32 #undef CFA_USE_NEW_AST33 29 34 30 /* Major.Minor */ -
tests/config.py.in
r79ee5b3 r0fc91db1 9 9 HOSTARCH = "@host_cpu@" 10 10 DISTRIBUTE = @HAS_DISTCC@ 11 NEWAST = @DEFAULT_NEW_AST@ -
tests/pybin/settings.py
r79ee5b3 r0fc91db1 97 97 self.path = "debug" if value else "nodebug" 98 98 99 class AST:100 def __init__(self, ast):101 if ast == "new":102 self.target = ast103 self.string = "New AST"104 self.flags = """"""105 elif ast == "old":106 self.target = ast107 self.string = "Old AST"108 self.flags = """"""109 elif ast == None:110 self.target = "new" if config.NEWAST else "old"111 self.string = "Default AST (%s)" % self.target112 self.flags = """"""113 else:114 print("""ERROR: Invalid ast configuration, must be "old", "new" or left unspecified, was %s""" % (value), file=sys.stderr)115 sys.exit(1)116 117 def filter(self, tests):118 119 return [test for test in tests if not test.astv or self.target == test.astv]120 121 99 class Install: 122 100 def __init__(self, value): … … 141 119 142 120 def init( options ): 143 global all_ast144 121 global all_arch 145 122 global all_debug 146 123 global all_install 147 global ast148 124 global arch 149 125 global debug … … 160 136 global timeout2gdb 161 137 162 all_ast = [AST(o) for o in list(dict.fromkeys(options.ast ))] if options.ast else [AST(None)]163 138 all_arch = [Architecture(o) for o in list(dict.fromkeys(options.arch ))] if options.arch else [Architecture(None)] 164 139 all_debug = [Debug(o) for o in list(dict.fromkeys(options.debug ))] -
tests/pybin/test_run.py
r79ee5b3 r0fc91db1 11 11 self.path = '' 12 12 self.arch = '' 13 self.astv = ''14 13 15 14 def toString(self): 16 return "{:25s} ({:5s} arch , {:s} ast: {:s})".format( self.name, self.arch if self.arch else "Any", self.astv if self.astvelse "Any", self.target() )15 return "{:25s} ({:5s} arch: {:s})".format( self.name, self.arch if self.arch else "Any", self.target() ) 17 16 18 17 def prepare(self): … … 22 21 def expect(self): 23 22 arch = '' if not self.arch else ".%s" % self.arch 24 astv = '' if not self.astv else ".nast" if self.astv == "new" else ".oast" 25 return os.path.normpath( os.path.join(settings.SRCDIR , self.path, ".expect", "%s%s%s.txt" % (self.name,astv,arch)) ) 23 return os.path.normpath( os.path.join(settings.SRCDIR , self.path, ".expect", "%s%s.txt" % (self.name,arch)) ) 26 24 27 25 def error_log(self): … … 58 56 59 57 @staticmethod 60 def new_target(target, arch , astv):58 def new_target(target, arch): 61 59 test = Test() 62 60 test.name = os.path.basename(target) 63 61 test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR) 64 62 test.arch = arch.target if arch else '' 65 test.astv = astv.target if astv else ''66 63 return test 67 64 -
tests/pybin/tools.py
r79ee5b3 r0fc91db1 182 182 '-s' if silent else None, 183 183 test_param, 184 settings.ast.flags,185 184 settings.arch.flags, 186 185 settings.debug.flags, -
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.