Changes in / [a3f5208a:4406887]


Ignore:
Location:
tests
Files:
1 added
8 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/settings.py

    ra3f5208a r4406887  
    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
    8788
    8889        @staticmethod
     
    100101        def __init__(self, ast):
    101102                if ast == "new":
    102                         self.target = ast
    103103                        self.string = "New AST"
    104104                        self.flags  = """AST_FLAGS=-XCFA,--new-ast"""
    105105                elif ast == "old":
    106                         self.target = ast
    107106                        self.string = "Old AST"
    108107                        self.flags  = """AST_FLAGS=-XCFA,--old-ast"""
    109108                elif ast == None:
    110                         self.target = "new" if config.NEWAST else "old"
    111                         self.string = "Default AST (%s)" % self.target
     109                        self.string = "Default AST (%s)" % ("new" if config.NEWAST else "old")
    112110                        self.flags  = """AST_FLAGS="""
    113111                else:
    114112                        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]
    120113
    121114class Install:
  • tests/pybin/test_run.py

    ra3f5208a r4406887  
    1111                self.path = ''
    1212                self.arch = ''
    13                 self.astv = ''
    1413
    1514        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.astv else "Any", self.target() )
     15                return "{:25s} ({:5s} {:s})".format( self.name, self.arch if self.arch else "Any", self.target() )
    1716
    1817        def prepare(self):
     
    2120
    2221        def expect(self):
    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)) )
     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)) )
    2623
    2724        def error_log(self):
     
    4845
    4946        @staticmethod
    50         def new_target(target, arch, astv):
     47        def new_target(target, arch):
    5148                test = Test()
    5249                test.name = os.path.basename(target)
    5350                test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR)
    5451                test.arch = arch.target if arch else ''
    55                 test.astv = astv.target if astv else ''
    5652                return test
    5753
  • tests/test.py

    ra3f5208a r4406887  
    2424
    2525        def match_test(path):
    26                 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.nast|\.oast)?(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path)
     26                match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\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(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 
     31                        test.arch = match.group(3)[1:] if match.group(3) else None
    4232                        expected.append(test)
    4333
     
    7666        if options.regenerate_expected :
    7767                for testname in options.tests :
    78                         testname = os.path.normpath( os.path.join(settings.SRCDIR, testname) )
    79 
     68                        testname = canonical_path( testname )
    8069                        # first check if this is a valid name to regenerate
    8170                        if Test.valid_name(testname):
    8271                                # this is a valid name, let's check if it already exists
    8372                                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])
    8573                                if not found:
    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] )
     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 ) )
    8881                                elif len(found) == 1 and not found[0].arch:
    8982                                        # we found a single test, the user better be wanting to create a cross platform test
    9083                                        if options.arch:
    9184                                                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)
    9485                                        else:
    9586                                                tests.append( found[0] )
    9687                                else:
    9788                                        # this test is already cross platform, just add a test for each platform the user asked
    98                                         tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] )
     89                                        tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
    9990
    10091                                        # print a warning if it users didn't ask for a specific architecture
    10192                                        if not options.arch:
    10293                                                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)
    10894
    10995                        else :
     
    266252        except KeyboardInterrupt:
    267253                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, ""
     254        except Exception as ex:
     255                print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
     256                sys.stderr.flush()
     257                return False, ""
    272258
    273259
     
    385371                                # filter out the tests for a different architecture
    386372                                # tests are the same across debug/install
    387                                 local_tests = settings.ast.filter( tests )
    388                                 local_tests = settings.arch.filter( local_tests )
     373                                local_tests = settings.arch.filter( tests )
    389374                                options.jobs, forceJobs = job_count( options, local_tests )
    390375                                settings.update_make_cmd(forceJobs, options.jobs)
     
    398383                                        len(local_tests),
    399384                                        options.jobs,
    400                                         settings.ast.string,
    401385                                        settings.arch.string,
    402                                         settings.debug.string
     386                                        settings.debug.string,
     387                                        settings.ast.string
    403388                                ))
    404                                 if not local_tests :
    405                                         print('WARNING: No tests for this configuration')
    406                                         continue
    407389
    408390                                # otherwise run all tests and make sure to return the correct error code
Note: See TracChangeset for help on using the changeset viewer.