Changeset f3b9efc for src/tests/test.py


Ignore:
Timestamp:
Dec 5, 2017, 1:29:12 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
86ad276
Parents:
099a40d
Message:

Tests now properly work with multiple architectures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    r099a40d rf3b9efc  
    1717        expected = []
    1818
    19         def findTest(path):
     19        def matchTest(path):
    2020                match = re.search("(\.[\w\/\-_]*)\/.expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt", path)
    2121                if match :
     
    2424                        test.path = match.group(1)
    2525                        test.arch = match.group(3)[1:] if match.group(3) else None
    26                         expected.append(test)
    27 
    28         pathWalk( findTest )
     26                        if settings.arch.match(test.arch):
     27                                expected.append(test)
     28
     29        pathWalk( matchTest )
    2930
    3031        return expected
     
    7778
    7879        # make sure we have at least some test to run
    79         if tests :
     80        if not tests :
    8081                print('ERROR: No valid test to run', file=sys.stderr)
    8182                sys.exit(1)
     
    139140        )
    140141
    141         retcode = 0
    142         error = None
    143 
    144142        # if the make command succeds continue otherwise skip to diff
    145143        if make_ret == 0 or settings.dry_run:
     
    149147                else :
    150148                        # simply cat the result into the output
    151                         sh("cat %s > %s" % (test.target(), out_file))
     149                        retcode, _ = sh("cat %s > %s" % (test.target(), out_file))
    152150        else:
    153                 sh("mv %s %s" % (err_file, out_file))
     151                retcode, _ = sh("mv %s %s" % (err_file, out_file))
    154152
    155153
     
    161159                                error = "\t\tNo make target for test %s!" % test.target()
    162160                                sh("rm %s" % out_file, False)
     161                        else:
     162                                error = None
    163163                else :
    164164                        # fetch return code and error from the diff command
     
    250250                tests = allTests
    251251
     252        #otherwise we need to validate that the test list that was entered is valid
    252253        else :
    253                 #otherwise we need to validate that the test list that was entered is valid
    254254                tests = validTests( options )
    255255
    256256        # sort the test alphabetically for convenience
    257         tests.sort(key=lambda t: t.target())
     257        tests.sort(key=lambda t: (t.arch if t.arch else '') + t.target())
    258258
    259259        # users may want to simply list the tests
    260260        if options.list_comp :
    261                 print("-h --help --debug --dry-run --list --all --regenerate-expected -j --jobs ", end='')
     261                print("-h --help --debug --dry-run --list --arch --all --regenerate-expected -j --jobs ", end='')
    262262                print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
    263263
    264264        elif options.list :
    265                 print("Listing for %s:%s"% (settings.arch.toString(), settings.debug))
     265                print("Listing for %s:%s"% (settings.arch.string, settings.debug.string))
    266266                print("\n".join(map(lambda t: "%s" % (t.toString()), tests)))
    267267
     
    272272                print('%s (%s:%s) on %i cores' % (
    273273                        'Regenerate tests' if settings.generating else 'Running',
    274                         settings.arch.toString(),
    275                         settings.debug,
     274                        settings.arch.string,
     275                        settings.debug.string,
    276276                        options.jobs
    277277                ))
Note: See TracChangeset for help on using the changeset viewer.