Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    rcb2e8ce r38736854  
    2323# parses the Makefile to find the machine type (32-bit / 64-bit)
    2424def getMachineType():
    25         with open('Makefile') as file:
    26                 makefile = file.read()
    27                 m = re.search("CFA_FLAGS\s*=\s*-m(.*)", makefile)
    28                 return m.group(1) if m else '64'
     25        sh('echo "int main() { return 0; }" > .dummy.c')
     26        sh("make .dummy", print2stdout=False)
     27        _, out = sh("file .dummy", print2stdout=False)
     28        sh("rm -f .dummy.c > /dev/null 2>&1")
     29        sh("rm -f .dummy > /dev/null 2>&1")
     30        return re.search("ELF\s([0-9]+)-bit", out).group(1)
    2931
    3032# reads the directory ./.expect and indentifies the tests
     
    9799                return False
    98100
    99 # find the test data for a given test name
    100 def filterTests(testname) :
    101         found = [test for test in allTests if test.name == testname]
    102         return (found[0] if len(found) == 1 else Test(testname, testname) )
    103 
    104101################################################################################
    105102#               running test functions
     
    139136                if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'.  Stop." % test.name) :
    140137                        retcode = 1;
    141                         error = "\t\tNo make target for test %s!" % test
     138                        error = "\t\tNo make target for test %s!" % test.name
    142139                        sh("rm %s" % out_file, False)
    143140
     
    250247        # already existing tests and create new info for the new tests
    251248        if options.regenerate_expected :
    252                 tests = map(filterTests, options.tests)
     249                for testname in options.tests :
     250                        if testname.endswith(".c") or testname.endswith(".cc") or testname.endswith(".cpp") :
     251                                print('ERROR: "%s", tests are not allowed to end with a C/C++/CFA extension, ignoring it' % testname, file=sys.stderr)
     252                        else :
     253                                found = [test for test in allTests if test.name == testname]
     254                                tests.append( found[0] if len(found) == 1 else Test(testname, testname) )
    253255
    254256        else :
Note: See TracChangeset for help on using the changeset viewer.