Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/tests/test.py

    r7895d46 r47f9422  
    1313import stat
    1414import sys
     15import multiprocessing
    1516
    1617################################################################################
     
    2627def getMachineType():
    2728        sh('echo "void ?{}(int*a,int b){}int main(){return 0;}" > .dummy.c')
    28         sh("make .dummy", print2stdout=False)
     29        ret, out = sh("make .dummy", print2stdout=False)
     30        if ret != 0:
     31                print("Failed to identify architecture:")
     32                print(out)
     33                print("Stopping")
     34                sys.exit(1)
    2935        _, out = sh("file .dummy", print2stdout=False)
    3036        sh("rm -f .dummy.c > /dev/null 2>&1")
     
    115121        # find the output file based on the test name and options flag
    116122        out_file = (".out/%s.log" % test.name) if not generate else (".expect/%s.txt" % test.path)
     123        err_file = ".err/%s.log" % test.name
    117124
    118125        # remove any outputs from the previous tests to prevent side effects
     
    137144                        sh("cat %s > %s" % (test.name, out_file), dry_run)
    138145
     146        else :
     147                # command failed save the log to less temporary file
     148                sh("mv %s %s" % (err_file, out_file), dry_run)
     149
    139150        retcode = 0
    140151        error = None
    141152
    142         # fix output to prevent make depth to cause issues
    143         fix_MakeLevel(out_file)
     153        # # fix output to prevent make depth to cause issues
     154        # fix_MakeLevel(out_file)
    144155
    145156        if generate :
     
    152163        else :
    153164                # diff the output of the files
    154                 diff_cmd = ("diff --old-group-format='\t\tmissing lines :\n"
     165                diff_cmd = ("diff --ignore-all-space "
     166                                        "--ignore-blank-lines "
     167                                        "--old-group-format='\t\tmissing lines :\n"
    155168                                        "%%<' \\\n"
    156169                                        "--new-group-format='\t\tnew lines :\n"
     
    212225
    213226        #make sure the required folder are present
    214         sh('mkdir -p .out .expect', dry_run)
     227        sh('mkdir -p .out .expect .err', dry_run)
    215228
    216229        if generate :
     
    309322# check if the user already passed in a number of jobs for multi-threading
    310323make_flags = environ.get('MAKEFLAGS')
    311 make_jobs_fds = re.search("--jobserver-fds=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
     324make_jobs_fds = re.search("--jobserver-(auth|fds)=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
    312325if make_jobs_fds :
    313         tokens = os.read(int(make_jobs_fds.group(1)), 1024)
     326        tokens = os.read(int(make_jobs_fds.group(2)), 1024)
    314327        options.jobs = len(tokens)
    315         os.write(int(make_jobs_fds.group(2)), tokens)
     328        os.write(int(make_jobs_fds.group(3)), tokens)
     329else :
     330        options.jobs = multiprocessing.cpu_count()
    316331
    317332# make sure we have a valid number of jobs that corresponds to user input
     
    320335        sys.exit(1)
    321336
     337options.jobs = min( options.jobs, len(tests) )
     338
    322339print('Running (%s) on %i cores' % ("debug" if options.debug else "no debug", options.jobs))
    323340make_cmd = "make" if make_flags else ("make -j%i" % options.jobs)
Note: See TracChangeset for help on using the changeset viewer.