masterRes = 0

    os.system('rm -fr adflow_reg.ref adflow_reg adflow_reg.orig')
    os.system('touch adflow_reg.ref adflow_reg adflow_reg.orig')

    # Run each script
    for iTest in tests:
        os.system(
            '%s -np %d python tests_cs/test%d.py complex %s > %s_test%d_reg 2>&1'
            % (args.mpiexec, args.procs, iTest, solveStr, module_name, iTest))

        refFile = 'ref_cs/%s_test%d_reg.ref' % (module_name, iTest)
        curFile = '%s_test%d_reg' % (module_name, iTest)

        # Do the comparison (reference file must be first)
        res = reg.reg_file_comp(refFile, curFile)

        # Set the proper return codes for the script running this:
        if res == reg.REG_FILES_MATCH:
            print '%s test%d: Success!' % (module_name, iTest)
        elif res == reg.REG_FILES_DO_NOT_MATCH:
            print '%s test%d: Failure!' % (module_name, iTest)
            if args.diff:
                os.system('%s %s %s' % (args.diff_cmd, refFile, curFile))
            masterRes += 1
        elif res == reg.REG_ERROR:
            print '%s test%d: Error in regression. Missing files.' % (
                module_name, iTest)
            masterRes += 1

        # Concentenate outputs for reference if it failed:
Exemple #2
0
        mpiexec, module_name))
        
    # If we're training, we done (no comparison)
    sys.exit(0)
else:
    try:
        os.remove('%s_reg'%(module_name))
    except OSError:
        pass

    # Run each script
    os.system("%s -np 1 python solve_script.py --mode='test' --task='all' >> %s_reg 2>&1"%(
        mpiexec, module_name))

    # Do the comparison (reference file must be first)
    res = reg.reg_file_comp('%s_reg.ref'%(module_name),'%s_reg'%(module_name))

# end if

# Set the proper return codes for the script running this:
if res == 0: #reg.REG_FILES_MATCH
    print('%s: Success!'%(module_name))
elif res == 1: #reg.REG_FILES_DO_NOT_MATCH
    print('%s: Failure!'%(module_name))
    if not nodiff:
        os.system('%s %s_reg.ref %s_reg'%(diff_cmd, module_name, module_name))
elif res == -1: #reg.REG_ERROR
    print('%s: Error in regression. Missing files.'%(module_name))
# end if

# Exit with code from reg_file_comp:
    try:
        os.remove("%s_reg" % (module_name))
        os.remove("%s_par_reg" % (module_name))
    except OSError:
        pass

    # Run each script
    os.system("%s -np 1 python solve_script.py  >> %s_reg 2>&1" %
              (mpiexec, module_name))

    # Run each script
    os.system("%s -np 4 python solve_script.py  >> %s_par_reg 2>&1" %
              (mpiexec, module_name))

    # Do the comparison (reference file must be first)
    res = reg.reg_file_comp("%s_reg.ref" % (module_name),
                            "%s_reg" % (module_name))
    res_par = reg.reg_file_comp("%s_par_reg.ref" % (module_name),
                                "%s_par_reg" % (module_name))
# end if

# Set the proper return codes for the script running this:
if res == 0:  # reg.REG_FILES_MATCH
    print("%s: Success!" % (module_name))
elif res == 1:  # reg.REG_FILES_DO_NOT_MATCH
    print("%s: Failure!" % (module_name))
    if not nodiff:
        os.system("%s %s_reg.ref %s_reg" %
                  (diff_cmd, module_name, module_name))
elif res == -1:  # reg.REG_ERROR
    print("%s: Error in regression. Missing files." % (module_name))
# end if