Changeset 139775e for tests


Ignore:
Timestamp:
Nov 6, 2020, 4:48:52 PM (4 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
75baaa3
Parents:
55acc3a (diff), 836c9925 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
tests
Files:
7 added
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    r55acc3a r139775e  
    5353
    5454# adjust CC to current flags
    55 CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
     55CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS} ${AST_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS} ${AST_FLAGS})
    5656CFACC = $(CC)
    5757
     
    6060
    6161# adjusted CC but without the actual distcc call
    62 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
     62CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS} ${AST_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS} ${AST_FLAGS})
    6363CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'))
    6464
  • tests/config.py.in

    r55acc3a r139775e  
    99HOSTARCH = "@host_cpu@"
    1010DISTRIBUTE = @HAS_DISTCC@
     11NEWAST = @DEFAULT_NEW_AST@
  • tests/pybin/settings.py

    r55acc3a r139775e  
    8585        def filter(self, tests):
    8686                return [test for test in tests if not test.arch or self.target == test.arch]
    87                 return True if not arch else self.target == arch
    8887
    8988        @staticmethod
     
    9897                self.path   = "debug" if value else "nodebug"
    9998
     99class AST:
     100        def __init__(self, ast):
     101                if ast == "new":
     102                        self.target = ast
     103                        self.string = "New AST"
     104                        self.flags  = """AST_FLAGS=-XCFA,--new-ast"""
     105                elif ast == "old":
     106                        self.target = ast
     107                        self.string = "Old AST"
     108                        self.flags  = """AST_FLAGS=-XCFA,--old-ast"""
     109                elif ast == None:
     110                        self.target = "new" if config.NEWAST else "old"
     111                        self.string = "Default AST (%s)" % self.target
     112                        self.flags  = """AST_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
    100121class Install:
    101122        def __init__(self, value):
     
    120141
    121142def init( options ):
     143        global all_ast
    122144        global all_arch
    123145        global all_debug
    124146        global all_install
     147        global ast
    125148        global arch
     149        global debug
    126150        global archive
     151        global install
     152
    127153        global continue_
    128         global debug
    129154        global dry_run
    130155        global generating
    131         global install
    132156        global make
    133157        global output_width
     
    135159        global timeout2gdb
    136160
     161        all_ast      = [AST(o)          for o in list(dict.fromkeys(options.ast    ))] if options.ast  else [AST(None)]
    137162        all_arch     = [Architecture(o) for o in list(dict.fromkeys(options.arch   ))] if options.arch else [Architecture(None)]
    138163        all_debug    = [Debug(o)        for o in list(dict.fromkeys(options.debug  ))]
  • tests/pybin/test_run.py

    r55acc3a r139775e  
    1111                self.path = ''
    1212                self.arch = ''
     13                self.astv = ''
    1314
    1415        def toString(self):
    15                 return "{:25s} ({:5s} {:s})".format( self.name, self.arch if self.arch else "Any", self.target() )
     16                return "{:25s} ({:5s} arch, {:s} ast: {:s})".format( self.name, self.arch if self.arch else "Any", self.astv if self.astv else "Any", self.target() )
    1617
    1718        def prepare(self):
     
    2021
    2122        def expect(self):
    22                 return os.path.normpath( os.path.join(settings.SRCDIR  , self.path, ".expect", "%s%s.txt" % (self.name,'' if not self.arch else ".%s" % self.arch)) )
     23                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)) )
    2326
    2427        def error_log(self):
     
    4548
    4649        @staticmethod
    47         def new_target(target, arch):
     50        def new_target(target, arch, astv):
    4851                test = Test()
    4952                test.name = os.path.basename(target)
    5053                test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR)
    5154                test.arch = arch.target if arch else ''
     55                test.astv = astv.target if astv else ''
    5256                return test
    5357
  • tests/pybin/tools.py

    r55acc3a r139775e  
    181181                '-s' if silent else None,
    182182                test_param,
     183                settings.ast.flags,
    183184                settings.arch.flags,
    184185                settings.debug.flags,
  • tests/test.py

    r55acc3a r139775e  
    2424
    2525        def match_test(path):
    26                 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path)
     26                match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.nast|\.oast)?(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path)
    2727                if match :
    2828                        test = Test()
    2929                        test.name = match.group(2)
    3030                        test.path = match.group(1)
    31                         test.arch = match.group(3)[1:] if match.group(3) else None
     31                        test.arch = match.group(4)[1:] if match.group(4) else None
     32
     33                        astv = match.group(3)[1:] if match.group(3) else None
     34                        if astv == 'oast':
     35                                test.astv = 'old'
     36                        elif astv == 'nast':
     37                                test.astv = 'new'
     38                        elif astv:
     39                                print('ERROR: "%s", expect file has astv but it is not "nast" or "oast"' % testname, file=sys.stderr)
     40                                sys.exit(1)
     41
    3242                        expected.append(test)
    3343
     
    6676        if options.regenerate_expected :
    6777                for testname in options.tests :
    68                         testname = canonical_path( testname )
     78                        testname = os.path.normpath( os.path.join(settings.SRCDIR, testname) )
     79
    6980                        # first check if this is a valid name to regenerate
    7081                        if Test.valid_name(testname):
    7182                                # this is a valid name, let's check if it already exists
    7283                                found = [test for test in all_tests if canonical_path( test.target() ) == testname]
     84                                setup = itertools.product(settings.all_arch if options.arch else [None], settings.all_ast if options.ast else [None])
    7385                                if not found:
    74                                         # it's a new name, create it according to the name and specified architecture
    75                                         if options.arch:
    76                                                 # user specified one or multiple architectures, assume the tests will have architecture specific results
    77                                                 tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
    78                                         else:
    79                                                 # user didn't specify an architecture, just create a cross platform test
    80                                                 tests.append( Test.new_target( testname, None ) )
     86                                        # it's a new name, create it according to the name and specified architecture/ast version
     87                                        tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] )
    8188                                elif len(found) == 1 and not found[0].arch:
    8289                                        # we found a single test, the user better be wanting to create a cross platform test
    8390                                        if options.arch:
    8491                                                print('ERROR: "%s", test has no specified architecture but --arch was specified, ignoring it' % testname, file=sys.stderr)
     92                                        elif options.ast:
     93                                                print('ERROR: "%s", test has no specified ast version but --ast was specified, ignoring it' % testname, file=sys.stderr)
    8594                                        else:
    8695                                                tests.append( found[0] )
    8796                                else:
    8897                                        # this test is already cross platform, just add a test for each platform the user asked
    89                                         tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
     98                                        tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] )
    9099
    91100                                        # print a warning if it users didn't ask for a specific architecture
    92101                                        if not options.arch:
    93102                                                print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr)
     103
     104
     105                                        # print a warning if it users didn't ask for a specific ast version
     106                                        if not options.ast:
     107                                                print('WARNING: "%s", test has ast version specific expected files but --ast was not specified, regenerating only for current ast' % testname, file=sys.stderr)
    94108
    95109                        else :
     
    112126        # create a parser with the arguments for the tests script
    113127        parser = argparse.ArgumentParser(description='Script which runs cforall tests')
     128        parser.add_argument('--ast', help='Test for specific ast', type=comma_separated(str), default=None)
     129        parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default=None)
    114130        parser.add_argument('--debug', help='Run all tests in debug or release', type=comma_separated(yes_no), default='yes')
    115131        parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=comma_separated(yes_no), default='no')
    116         parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default=None)
    117132        parser.add_argument('--continue', help='When multiple specifications are passed (debug/install/arch), sets whether or not to continue if the last specification failed', type=yes_no, default='yes', dest='continue_')
    118133        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=120)
     
    251266        except KeyboardInterrupt:
    252267                return False, ""
    253         except Exception as ex:
    254                 print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
    255                 sys.stderr.flush()
    256                 return False, ""
     268        # except Exception as ex:
     269        #       print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
     270        #       sys.stderr.flush()
     271        #       return False, ""
    257272
    258273
     
    362377                # for each build configurations, run the test
    363378                with Timed() as total_dur:
    364                         for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install):
     379                        for ast, arch, debug, install in itertools.product(settings.all_ast, settings.all_arch, settings.all_debug, settings.all_install):
     380                                settings.ast     = ast
    365381                                settings.arch    = arch
    366382                                settings.debug   = debug
     
    369385                                # filter out the tests for a different architecture
    370386                                # tests are the same across debug/install
    371                                 local_tests = settings.arch.filter( tests )
     387                                local_tests = settings.ast.filter( tests )
     388                                local_tests = settings.arch.filter( local_tests )
    372389                                options.jobs, forceJobs = job_count( options, local_tests )
    373390                                settings.update_make_cmd(forceJobs, options.jobs)
     
    377394
    378395                                # print configuration
    379                                 print('%s %i tests on %i cores (%s:%s)' % (
     396                                print('%s %i tests on %i cores (%s:%s - %s)' % (
    380397                                        'Regenerating' if settings.generating else 'Running',
    381398                                        len(local_tests),
    382399                                        options.jobs,
     400                                        settings.ast.string,
    383401                                        settings.arch.string,
    384402                                        settings.debug.string
    385403                                ))
     404                                if not local_tests :
     405                                        print('WARNING: No tests for this configuration')
     406                                        continue
    386407
    387408                                # otherwise run all tests and make sure to return the correct error code
Note: See TracChangeset for help on using the changeset viewer.