Changeset 41af19c


Ignore:
Timestamp:
Apr 16, 2020, 12:00:42 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7215000, 9a7c88f
Parents:
1c412aa
Message:

Fixed regenerate-expected with respect to new multi-arch feature

Location:
tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/settings.py

    r1c412aa r41af19c  
    2323class Architecture:
    2424        KnownArchitectures = {
    25                 'x64'           : 'x64',
    26                 'x86-64'        : 'x64',
    27                 'x86_64'        : 'x64',
    28                 'x86'           : 'x86',
    29                 'aarch64'       : 'arm',
    30                 'i386'          : 'x86',
    31                 'i486'          : 'x86',
    32                 'i686'          : 'x86',
    33                 'Intel 80386'   : 'x86',
    34                 'arm'           : 'arm',
    35                 'ARM'           : 'arm',
     25                'x64'         : 'x64',
     26                'x86-64'      : 'x64',
     27                'x86_64'      : 'x64',
     28                'x86'         : 'x86',
     29                'aarch64'     : 'arm',
     30                'i386'        : 'x86',
     31                'i486'        : 'x86',
     32                'i686'        : 'x86',
     33                'Intel 80386' : 'x86',
     34                'arm'         : 'arm',
     35                'ARM'         : 'arm',
    3636        }
    3737
     
    129129        global timeout2gdb
    130130
    131         all_arch     = [Architecture(o) for o in list(dict.fromkeys(options.arch   ))]
     131        all_arch     = [Architecture(o) for o in list(dict.fromkeys(options.arch   ))] if options.arch else [Architecture(None)]
    132132        all_debug    = [Debug(o)        for o in list(dict.fromkeys(options.debug  ))]
    133133        all_install  = [Install(o)      for o in list(dict.fromkeys(options.install))]
  • tests/pybin/test_run.py

    r1c412aa r41af19c  
    4545
    4646        @classmethod
    47         def from_target(_, target):
     47        def new_target(_, target, arch):
    4848                test = Test()
    4949                test.name = os.path.basename(target)
    5050                test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR)
    51                 test.arch = settings.arch.target if settings.arch.cross_compile else ''
     51                test.arch = arch.target if arch else ''
    5252                return test
    5353
  • tests/test.py

    r1c412aa r41af19c  
    6767                for testname in options.tests :
    6868                        testname = canonical_path( testname )
     69                        # first check if this is a valid name to regenerate
    6970                        if Test.valid_name(testname):
     71                                # this is a valid name, let's check if it already exists
    7072                                found = [test for test in all_tests if canonical_path( test.target() ) == testname]
    71                                 tests.append( found[0] if len(found) == 1 else Test.from_target(testname) )
     73                                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 ) )
     81                                elif len(found) == 1 and not found[0].arch:
     82                                        # we found a single test, the user better be wanting to create a cross platform test
     83                                        if options.arch:
     84                                                print('ERROR: "%s", test has no specified architecture but --arch was specified, ignoring it' % testname, file=sys.stderr)
     85                                        else:
     86                                                tests.append( found[0] )
     87                                else:
     88                                        # 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] )
     90
     91                                        # print a warning if it users didn't ask for a specific architecture
     92                                        if not options.arch:
     93                                                print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr)
     94
    7295                        else :
    7396                                print('ERROR: "%s", tests are not allowed to end with a C/C++/CFA extension, ignoring it' % testname, file=sys.stderr)
     
    91114        parser.add_argument('--debug', help='Run all tests in debug or release', type=comma_separated(yes_no), default='yes')
    92115        parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=comma_separated(yes_no), default='no')
    93         parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default='')
     116        parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default=None)
    94117        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_')
    95118        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60)
Note: See TracChangeset for help on using the changeset viewer.