def getTimingDectec(self, opt):
     qd = quantum780_operation.Quantum780Operation()
     """
     To get Timing paras from 
     :param opt:
     0 - generator
     1 - analyzer 
     :return: a dic of timing paras.
     """
     if '0' == opt:
         return qd.generator_timing_dump()
     if '1' == opt:
         return qd.alyz_timing_dump()
Example #2
0
def execute_test(cmdoptions, cmdargs):
    """
    Execute the test;
    :param cmdoptions:
    :param cmdargs:
    :return:
    """
    print("Your Test will be start after 3 seconds, please wait...")
    process()
    #Get config from the data sheet:
    config_d = switchconfig.SwitchConfigOperation(SWITCHCONFIG, 1).load_config()
    log.logger.info(config_d)
    filename = config_d['ConfigFilePath']
    edidfile = config_d['EdidFilePath']
    log.logger.info(cmdoptions)
    tn = telnet.TelnetApp(config_d['MasterIP'],config_d['MasterUsername'],config_d['MasterPassword'])
    log.logger.info("switch_ip:"+config_d['SwitchIP']+"switch_username:"******"Switch_pwd:" \
              +config_d['SwitchPassword'])
    tnswitch = telnet.TelnetApp(config_d['SwitchIP'],config_d['SwitchUsername'],config_d['SwitchPassword'])
    swcregconf = switchconfig.SwitchConfigOperation(filename, 0)
    qd = qdoperation.Quantum780Operation()
    #inportlist = {'HDMI1':'1','HDMI2':'2']
    inportdic = init_port(config_d['InputPortType'])
    log.logger.info("The input port type is:%s."% inportdic)
    #outportlist = ['HDMI1':'1','HDMI2':'2'}
    outportdic = init_port(config_d['OutputPortType'])
    log.logger.info("The output port type is:%s."% outportdic)

    #Test Step:
    #Initialize QD generator
    log.logger.info("Start initialize Quantum Data!")
    qd.sent_qd_generator('1080p60', cmdoptions.patternname, \
                         cmdoptions.colorspace, \
                         cmdoptions.deepcolor, \
                         cmdoptions.outport, \
                         cmdoptions.hdcp)
    #Initialize SUT default input and output
    log.logger.info("Start initialize DUT in/out port!")
    cmd_dut = ''.join('ci' + inportdic['HDMI1'] + 'o' + outportdic['HDMI1'])
    cmd_sw = ''.join('ci'+outportdic['HDMI1']+'oall')
    tn.send_thor_cmd(config_d['SutDPS'], cmd_dut)
    tnswitch.send_thor_cmd(config_d['SwitchDPS'], cmd_sw)
    log.logger.info("Testing begin...")
    repetitions = int(cmdoptions.repetitions)
    log.logger.info("The inputlist is %s" % get_inputlist(swcregconf, cmdoptions.timing))
    while(repetitions): #execute repetions
        for qdcode in get_inputlist(swcregconf, cmdoptions.timing):
            log.logger.info("The current input timing is %s" % qdcode)
            #Set input timing
            qd.sent_qd_generator(qdcode)
            #Check the input timing
            check_input_timing(qd,qdcode,swcregconf)
            #Set Dut switch paraeters, paser "--random";
            if cmdoptions.random != None:
                time.sleep(cmdoptions.interval)
                cmd_dut,cmd_sw = rand_switch_port(cmdoptions.random, inportdic, outportdic )
                log.logger.info("Switch the DUT port is: %s" % cmd_dut)
                tn.send_thor_cmd(config_d['SutDPS'], cmd_dut)
                log.logger.info("Switch the Switch port is: %s" % cmd_sw)
                tnswitch.send_thor_cmd(config_d['SwitchDPS'], cmd_sw)
            #If bypass, Yes:dectected;Not:set output timing
            if 'bypass' == cmdoptions.scaletiming:
                log.logger.info("The scaler mode is %s" % cmdoptions.scaletiming)
                #Set DUT output: bypass;
                tn.send_thor_cmd(config_d['SutDPS'],'VIDOUT_SCALE-BYPASS')
                #Set QD input port
                log.logger.info("Set QD analyze port!")
                qd.set_input_signal(0) #HDMI
                #Check the output
                check_output_timing(qd,qdcode,swcregconf)
            elif 'all'== cmdoptions.scaletiming or 'random'==cmdoptions.scaletiming:
                log.logger.info("The scaler mode is %s" % cmdoptions.scaletiming)
                for scalercode in get_outputlist(swcregconf, cmdoptions.scaletiming):
                    #"for"  set aspect Ratio

                    log.logger.info("Set Scaler Out timing to %s!" % scalercode)
                    # set scaler to auto
                    tn.send_thor_cmd(config_d['SutDPS'], 'vidout_scale-auto')
                    # set qd input port
                    log.logger.info("Set QD analyze port!")
                    qd.set_input_signal(0) #input hdmi
                    # write edid
                    write_edid(swcregconf, scalercode, edidfile, qd)
                    # check output paras
                    check_output_timing(qd,scalercode,swcregconf)
            else:
                log.logger.info("The scaler mode is %s" % cmdoptions.scaletiming)
                log.logger.info("Set Scaler Out timing to %s!" % cmdoptions.scaletiming)
                scalercode = cmdoptions.scaletiming
                # set scaler to manual
                tn.send_thor_cmd(config_d['SutDPS'], 'vidout_scale-manual')
                # set scaler output timing
                code = swcregconf.getTimingExpect(scalercode)
                #write edid to sink
                #write_edid(swcregconf, scalercode, edidfile, qd)
                #VIDOUT_RES_REF
                cmd=''.join('VIDOUT_RES_REF-'+code['HRES']+'x'+code['VRES']+','+str(int(float(code['VRAT']))))
                log.logger.info("The manual scaler timing out is %s" % cmd)
                tn.send_thor_cmd(config_d['SutDPS'], cmd)
                #Check output paras
                check_output_timing(qd,scalercode,swcregconf)
        repetitions = repetitions-1
    log.logger.info("Test Completed!")
Example #3
0
def execute_test(cmdoptions, cmdargs):
    """
    Execute the test;
    :param cmdoptions:
    :param cmdargs:
    :return:
    """
    global INPCOUNT, OUTPCOUNT, INFCOUNT, OUTFCOUNT, TESTPARAS, outport, outporttype
    print("Your Test will be start after 3 seconds, please wait...")
    loadProcess()
    #Get config from the data sheet:
    config_d = switchconfig.SwitchConfigOperation(SWITCHCONFIG,
                                                  1).load_config()
    log.logger.info(config_d)
    filename = config_d['ConfigFilePath']
    edidfile = config_d['EdidFilePath']
    log.logger.info(cmdoptions)
    tn = telnet.TelnetApp(config_d['MasterIP'], config_d['MasterUsername'],
                          config_d['MasterPassword'])
    log.logger.info("switch_ip:"+config_d['SwitchIP']+"switch_username:"******"Switch_pwd:" \
              +config_d['SwitchPassword'])
    swcregconf = switchconfig.SwitchConfigOperation(filename, 0)
    swcolorconfig = switchconfig.SwitchConfigOperation(filename, 2)
    qd = qdoperation.Quantum780Operation()
    inportdic = initPort(config_d['InputPortType'])
    log.logger.info("The input port type is:%s." % inportdic)
    outportdic = initPort(config_d['OutputPortType'])
    log.logger.info("The output port type is:%s." % outportdic)
    # initialize the port;
    outport = config_d['SutDPS'].split(":")[1]
    #Test Step:
    #Ignore HDMI proctocal test parametres;
    if cmdoptions.ignore != "None":
        qd.TESTPARAS.remove(cmdoptions.ignore)
        swcregconf.TESTPARAS.remove(cmdoptions.ignore)
    #Initialize QD generator, default:1080p
    log.logger.info("Start initialize Quantum Data!")
    qd.sent_qd_generator('1080p60', cmdoptions.patternname, \
                         cmdoptions.colorspace, \
                         cmdoptions.deepcolor, \
                         cmdoptions.outport, \
                         cmdoptions.hdcp)
    #Initialize SUT default input and output
    log.logger.info("Start initialize DUT in/out port!")
    inport = inportdic['HDMI1']
    inporttype = 'HDMI1'
    outport = outportdic['HDMI1']
    outporttype = 'HDMI1'
    cmd_dut = ''.join('ci' + inportdic['HDMI1'] + 'o' + outportdic['HDMI1'])
    # Set Switch output
    switchport = "".join(re.findall(r"\d", outporttype))
    cmd_sw = ''.join('ci' + switchport + 'oall')
    tn.send_thor_cmd(config_d['SutDPS'], cmd_dut)
    tn.send_thor_cmd(config_d['SwitchDPS'], cmd_sw)
    log.logger.info("Hey,Testing Start......")
    repetitions = int(cmdoptions.repetitions)
    ar = cmdoptions.aspectratio
    incolor = cmdoptions.colorspace
    outcolor = cmdoptions.outcolorspace
    aspectratio = cmdoptions.aspectratio

    # Execute repetions
    while (repetitions):
        for qdcode in getTimingList(swcregconf, cmdoptions.timing, 37):
            log.logger.info("The current input timing is %s" % qdcode)
            # Get the input code to get h,v
            incode = swcregconf.getTimingExpect(qdcode)
            #Set input timing
            qd.sent_qd_generator(qdcode)
            #If input skip protocal test
            if 'protocal' == cmdoptions.skip:
                pass
            else:
                #Check the input timing only
                if checkTiming(qd, qdcode, swcregconf, 'input'):
                    INPCOUNT = INPCOUNT + 1
                else:
                    INFCOUNT = INFCOUNT + 1

            #Set Dut switch paraeters, paser "--random";
            if cmdoptions.random != None:
                time.sleep(int(cmdoptions.interval))
                cmd_dut, cmd_sw, outport, outporttype, inporttype = randSwitchPort(
                    cmdoptions.random, inportdic, outportdic)
                log.logger.info("The input port is %s" % inporttype)
                log.logger.info("The output port is %s" % outporttype)
                #Check if input port support HDBT Big 4K
                if isHdbtSupport(cmdoptions, qdcode, inporttype):
                    pass
                else:
                    continue
                #input support
                log.logger.info("Switch the DUT port is: %s" % cmd_dut)
                tn.send_thor_cmd(config_d['SutDPS'], cmd_dut)
                log.logger.info("Switch the Switch port is: %s" % cmd_sw)
                tn.send_thor_cmd(config_d['SwitchDPS'], cmd_sw)
            #If bypass, Yes:dectected;Not:set output timing
            if 'bypass' == cmdoptions.scaletiming:
                log.logger.info("The scaler mode is %s" %
                                cmdoptions.scaletiming)
                #Set DUT output: bypass;Set port to output
                if cmdoptions.random != 'None':
                    newdps = config_d['SutDPS'].replace(
                        ":1:", ":" + outport + ":")
                    log.logger.info("The new SUT DPS is %s" % newdps)
                    tn.send_thor_cmd(newdps, 'VIDOUT_SCALE-BYPASS')
                else:
                    tn.send_thor_cmd(config_d['SutDPS'], 'VIDOUT_SCALE-BYPASS')
                #Set QD input port
                log.logger.info("Set QD analyze port!")
                setQdInputport(qd, outporttype)
                # HDBT can not support 4096x2160@50/60 YCbCr/RGB input or output
                if isHdbtSupport(cmdoptions, qdcode, outporttype):
                    pass
                else:
                    continue
                #If output skip protocal/pattern test
                if 'protocal' == cmdoptions.skip:
                    #check bypass pattern
                    pixelcount = qd.query_pixelErrCount(100)
                    if pixelcount:
                        print("Bypass no pixel error, pass")
                    else:
                        print("Bypass has %s pixel error!" % pixelcount)
                elif 'pattern' == cmdoptions.skip:
                    #Check the output
                    if checkTiming(qd, qdcode, swcregconf, 'output'):
                        OUTPCOUNT = OUTPCOUNT + 1
                    else:
                        OUTFCOUNT = OUTFCOUNT + 1
                else:
                    #Check the output
                    if checkTiming(qd, qdcode, swcregconf, 'output'):
                        OUTPCOUNT = OUTPCOUNT + 1
                    else:
                        OUTFCOUNT = OUTFCOUNT + 1
                    #check bypass pattern
                    pixelcount = qd.query_pixelErrCount(100)
                    if pixelcount:
                        print("Bypass no pixel error, pass")
                    else:
                        print("Bypass has %s pixel error!" % pixelcount)
            elif 'auto' == cmdoptions.scaletiming:  #or 'random'==cmdoptions.scaletiming:
                log.logger.info("The scaler mode is %s" %
                                cmdoptions.scaletiming)
                for scalercode in getTimingList(swcregconf,
                                                cmdoptions.scaletiming, 38):
                    #HDBT can not support 4096x2160@50/60 YCbCr/RGB input or output
                    if isHdbtSupport(cmdoptions, scalercode, outporttype):
                        pass
                    else:
                        continue

                    log.logger.info("Set Scaler Out timing to %s!" %
                                    scalercode)
                    # set scaler to auto
                    if cmdoptions.random != 'None':
                        newdps = config_d['SutDPS'].replace(
                            ":1:", ":" + outport + ":")
                        log.logger.info("The new SUT DPS is %s" % newdps)
                        tn.send_thor_cmd(newdps, 'vidout_scale-auto')
                    else:
                        newdps = config_d['SutDPS']
                        tn.send_thor_cmd(newdps, 'vidout_scale-auto')
                    #"for"  set aspect Ratio
                    arcmd = 'vidout_aspect_ratio-' + ar
                    tn.send_thor_cmd(newdps, arcmd)
                    log.logger.info("Set aspectratio to %s !" % ar)
                    #set output colorspace
                    cscmd = 'vidout_color_space-' + outcolor
                    tn.send_thor_cmd(newdps, cscmd)
                    log.logger.info("Set output colorspace to %s !" % outcolor)
                    #get the output timing code to get h,v;
                    outcode = swcregconf.getTimingExpect(scalercode)
                    # set qd input port
                    log.logger.info("Set QD analyze port!")
                    setQdInputport(qd, outporttype)
                    # write edid
                    writeEdid(swcregconf, scalercode, edidfile, qd)
                    # if output skip protocal test
                    if 'protocal' == cmdoptions.skip:
                        # check pattern
                        #checkPattern(qd, incode, outcode, swcregconf, ar, colorspace, swcolorconfig)
                        checkPattern(qd,
                                     qdcode,
                                     scalercode,
                                     incode,
                                     outcode,
                                     aspectratio,
                                     incolor,
                                     outcolor,
                                     swcolorconfig,
                                     colorimetry='auto')
                    elif 'pattern' == cmdoptions.skip:
                        # check output paras
                        if checkTiming(qd, scalercode, swcregconf, 'output'):
                            OUTPCOUNT = OUTPCOUNT + 1
                        else:
                            OUTFCOUNT = OUTFCOUNT + 1
                    else:
                        # check output paras
                        if checkTiming(qd, scalercode, swcregconf, 'output'):
                            OUTPCOUNT = OUTPCOUNT + 1
                        else:
                            OUTFCOUNT = OUTFCOUNT + 1
                        # check pattern
                        #checkPattern(qd, incode, outcode, swcregconf, ar, colorspace, swcolorconfig)
                        checkPattern(qd,
                                     qdcode,
                                     scalercode,
                                     incode,
                                     outcode,
                                     aspectratio,
                                     incolor,
                                     outcolor,
                                     swcolorconfig,
                                     colorimetry='auto')

            else:
                log.logger.info("The scaler mode is %s" %
                                cmdoptions.scaletiming)
                #scalercode = cmdoptions.scaletiming
                for scalercode in getTimingList(swcregconf,
                                                cmdoptions.scaletiming, 38):
                    # HDBT can not support 4096x2160@50/60 YCbCr/RGB input or output
                    if isHdbtSupport(cmdoptions, scalercode, outporttype):
                        pass
                    else:
                        continue
                    log.logger.info("Set Scaler Out timing to %s!" %
                                    scalercode)
                    # set scaler to manual
                    if cmdoptions.random != 'None':
                        #config_d['SutDPS'] = config_d['SutDPS'].replace(":1:", ":" + outport + ":") need know why not?
                        newdps = config_d['SutDPS'].replace(
                            ":1:", ":" + outport + ":")
                        log.logger.info("The new SUT DPS is %s" % newdps)
                        #tn.send_thor_cmd(config_d['SutDPS'], 'vidout_scale-manual')
                        tn.send_thor_cmd(newdps, 'vidout_scale-manual')
                    else:
                        newdps = config_d['SutDPS']
                        tn.send_thor_cmd(newdps, 'vidout_scale-manual')
                    #"for"  set aspect Ratio
                    arcmd = 'vidout_aspect_ratio-' + ar
                    tn.send_thor_cmd(newdps, arcmd)
                    log.logger.info("Set aspectratio to %s !" % ar)
                    #set output colorspac
                    cscmd = 'vidout_color_space-' + outcolor
                    tn.send_thor_cmd(newdps, cscmd)
                    log.logger.info("Set output colorspace to %s !" % outcolor)
                    # set scaler output timing
                    outcode = swcregconf.getTimingExpect(scalercode)
                    #write edid to sink
                    #writeEdid(swcregconf, scalercode, edidfile, qd)
                    #VIDOUT_RES_REF
                    cmd = ''.join('VIDOUT_RES_REF-' + outcode['HRES'] + 'x' +
                                  outcode['VRES'] + ',' +
                                  str(round(float(outcode['VRAT']))))
                    log.logger.info("The manual scaler timing out is %s" % cmd)
                    tn.send_thor_cmd(newdps, cmd)
                    #Set QD input port
                    log.logger.info("Set QD analyze port!")
                    setQdInputport(qd, outporttype)
                    # if output skip protocal test
                    if 'protocal' == cmdoptions.skip:
                        # check pattern
                        #checkPattern(qd, incode, outcode, swcregconf, ar, colorspace, swcolorconfig)
                        checkPattern(qd,
                                     qdcode,
                                     scalercode,
                                     incode,
                                     outcode,
                                     aspectratio,
                                     incolor,
                                     outcolor,
                                     swcolorconfig,
                                     colorimetry='auto')
                    elif 'pattern' == cmdoptions.skip:
                        # check output paras
                        if checkTiming(qd, scalercode, swcregconf, 'output'):
                            OUTPCOUNT = OUTPCOUNT + 1
                        else:
                            OUTFCOUNT = OUTFCOUNT + 1
                    else:
                        # check output paras
                        if checkTiming(qd, scalercode, swcregconf, 'output'):
                            OUTPCOUNT = OUTPCOUNT + 1
                        else:
                            OUTFCOUNT = OUTFCOUNT + 1
                        # check pattern
                        #checkPattern(qd, incode, outcode, swcregconf, ar, colorspace, swcolorconfig)
                        checkPattern(qd,
                                     qdcode,
                                     scalercode,
                                     incode,
                                     outcode,
                                     aspectratio,
                                     incolor,
                                     outcolor,
                                     swcolorconfig,
                                     colorimetry='auto')
        repetitions = repetitions - 1
    #Calculate all test result
    log.logger.info("OK,All Test Completed! Total: "+str(INPCOUNT+INFCOUNT+OUTPCOUNT+OUTFCOUNT)+" cases, "\
                    +str(INPCOUNT+OUTPCOUNT)+" was PASS, " +str(INFCOUNT+OUTFCOUNT)+" was FAIL!")
    log.logger.info("INPUT RESULT:"+str(INPCOUNT)+" is PASS, "+str(INFCOUNT)+" is FAIL. "\
                    "OUTPUT RESULT:"+str(OUTPCOUNT)+" is PASS, "+str(OUTFCOUNT)+" is FAIL")
def executeTest(cmdoptions, cmdargs):
    """
    Execute the test;
    :param cmdoptions:
    :param cmdargs:
    :return:
    """
    global INPCOUNT, OUTPCOUNT,INFCOUNT,OUTFCOUNT, PATPCOUNT, PATFCOUNT, TESTPARAS, outport, outporttype
    print("Your Test will be start after 3 seconds, please wait...")
    loadProcess()
    #Get config vars from the data sheet:
    config_d = switchconfig.SwitchConfigOperation(SWITCHCONFIG, 1).load_config()
    log.logger.info(config_d)
    filename = BASEDIR+"\\"+config_d['ConfigFilePath']
    edidfile = BASEDIR+"\\"+config_d['EdidFilePath']
    log.logger.info(cmdoptions)
    tn = telnet.TelnetApp(config_d['MasterIP'],config_d['MasterUsername'],config_d['MasterPassword'])
    log.logger.info("switch_ip:"+config_d['SwitchIP']+"switch_username:"******"Switch_pwd:" \
              +config_d['SwitchPassword'])
    swcregconf = switchconfig.SwitchConfigOperation(filename, 0)
    swcolorconfig = switchconfig.SwitchConfigOperation(filename, 2)
    qd = qdoperation.Quantum780Operation()
    inportdic = initPort(config_d['InputPortType'])
    log.logger.info("The input port type is:%s."% inportdic)
    outportdic = initPort(config_d['OutputPortType'])
    log.logger.info("The output port type is:%s."% outportdic)
    repetitions = int(cmdoptions.repetitions)
    ar = cmdoptions.aspectratio
    incolor = cmdoptions.colorspace
    outcolor = cmdoptions.outcolorspace
    if 'YCbCr444'==outcolor:
        outputcolor = 'YUV444'
    else: outputcolor = outcolor
    aspectratio = cmdoptions.aspectratio
    patterntest = cmdoptions.patterntest
    #hdcpout = cmdoptions.hdcpout
    hdcpin = cmdoptions.hdcpin
    hdcpdut = cmdoptions.hdcpdut
    #initialize the port;
    outport = config_d['SutDPS'].split(":")[1]
    #Test Step:
    #Initialize QD generator, default:1080p
    log.logger.info("Start initialize Quantum Data!")
    qd.sent_qd_generator('1080p60', cmdoptions.patternname, \
                         cmdoptions.colorspace, \
                         cmdoptions.deepcolor, \
                         cmdoptions.outport, \
                         cmdoptions.hdcpout)
    qd.switch_hpformats('0') #disable hotplug formats
    #Initialize SUT default input and output
    log.logger.info("Start initialize DUT in/out port!")
    inport = inportdic['HDMI1']
    inporttype = 'HDMI1'
    outport = outportdic['HDMI1']
    outporttype = 'HDMI1'
    cmd_dut = ''.join('ci' + inportdic['HDMI1'] + 'o' + outportdic['HDMI1'])
    # Set Switch output
    switchport = "".join(re.findall(r"\d", outporttype))
    cmd_sw = ''.join('ci' + switchport + 'oall')
    tn.send_thor_cmd(config_d['SutDPS'], cmd_dut)
    tn.send_thor_cmd(config_d['SwitchDPS'], cmd_sw)
    # Initial RX HDCP to follow
    tn.send_thor_cmd(config_d['SutDPS'], 'VIDOUT_HDCP-FOLLOW')
    log.logger.info("Hey,Testing Start......")
    # Execute repetions
    while(repetitions):
        for qdcode in getTimingList(swcregconf, cmdoptions.timing, 37):
            log.logger.info("The current input timing is %s" % qdcode)
            # Get the input code to get h,v
            incode= swcregconf.getTimingExpect(qdcode)
            #Set input timing
            qd.sent_qd_generator(qdcode)
            #Set Dut switch paraeters, paser "--random";
            if cmdoptions.random != None:
                time.sleep(int(cmdoptions.interval))
                cmd_dut,cmd_sw, outport, outporttype, inporttype = randSwitchPort(cmdoptions.random, inportdic, outportdic)
                log.logger.info("The input port is %s" % inporttype)
                log.logger.info("The output port is %s" % outporttype)
                #Check if input port support HDBT Big 4K
                if isHdbtSupport(cmdoptions, qdcode, inporttype):
                    pass
                else:
                    continue
                #input support
                log.logger.info("Switch the DUT port is: %s" % cmd_dut)
                tn.send_thor_cmd(config_d['SutDPS'], cmd_dut)
                log.logger.info("Switch the Switch port is: %s" % cmd_sw)
                tn.send_thor_cmd(config_d['SwitchDPS'], cmd_sw)
            # Config hdcp, if duthdcp was not follow, then execute hdcpdut, or hdcpin
            if hdcpdut != 'follow':
                if 'None' == hdcpdut:
                    tn.send_thor_cmd(config_d['SutDPS'], 'VIDOUT_HDCP-NO HDCP')
                elif '14' == hdcpdut:
                    tn.send_thor_cmd(config_d['SutDPS'], 'VIDOUT_HDCP-HDCP1.4')
                elif '22' == hdcpdut:
                    tn.send_thor_cmd(config_d['SutDPS'], 'VIDOUT_HDCP-HDCP2.2')
                else:
                    raise ("Unknow hdcp ICSP command parameters!")
            else:
                configHDCP(qd, hdcpin)
            #Set scaler mode
            if 'auto'== cmdoptions.scaletiming: #or 'random'==cmdoptions.scaletiming:
                log.logger.info("The auto scaler mode is %s" % cmdoptions.scaletiming)
                for scalercode in getTimingList(swcregconf, cmdoptions.scaletiming, 38):
                    #HDBT can not support 4096x2160@50/60 YCbCr/RGB input or output
                    if isHdbtSupport(cmdoptions, scalercode, outporttype):
                        pass
                    else:
                        continue
                    log.logger.info("Set Scaler Out timing to %s!" % scalercode)
                    # set scaler to auto
                    if cmdoptions.random != 'None':
                        newdps = config_d['SutDPS'].replace(":1:", ":" + outport + ":")
                        log.logger.info("The new SUT DPS is %s" % newdps)
                        tn.send_thor_cmd(newdps, 'vidout_scale-auto')
                    else:
                        newdps = config_d['SutDPS']
                        tn.send_thor_cmd(newdps, 'vidout_scale-auto')
                    #Set aspect Ratio
                    arcmd='vidout_aspect_ratio-'+ar
                    tn.send_thor_cmd(newdps, arcmd)
                    log.logger.info("Set aspectratio to %s !" % ar)
                    #set output colorspace
                    cscmd = 'vidout_color_space-'+outputcolor
                    tn.send_thor_cmd(newdps, cscmd)
                    log.logger.info("Set output colorspace to %s !" % outcolor)
                    outcode = swcregconf.getTimingExpect(scalercode)
                    # set qd input port
                    log.logger.info("Set QD analyze port!")
                    setQdInputport(qd, outporttype)
                    # write edid
                    writeEdid(swcregconf, scalercode, edidfile, qd)
                    #check pattern
                    if checkPattern(qd, qdcode, scalercode, incode, outcode, patterntest, incolor, outcolor, swcolorconfig,
                                     colorimetry='auto'):
                            PATPCOUNT=PATPCOUNT+1
                    else:PATFCOUNT=PATFCOUNT+1
            else:
                log.logger.info("The manual scaler mode is %s" % cmdoptions.scaletiming)
                #scalercode = cmdoptions.scaletiming
                for scalercode in getTimingList(swcregconf, cmdoptions.scaletiming, 38):
                    # HDBT can not support 4096x2160@50/60 YCbCr/RGB input or output
                    if isHdbtSupport(cmdoptions, scalercode, outporttype):
                        pass
                    else:
                        continue
                    log.logger.info("Set Scaler Out timing to %s!" % scalercode)
                    # set scaler to manual
                    if cmdoptions.random != 'None':
                        #config_d['SutDPS'] = config_d['SutDPS'].replace(":1:", ":" + outport + ":") need know why not?
                        newdps = config_d['SutDPS'].replace(":1:", ":" + outport + ":")
                        log.logger.info("The new SUT DPS is %s" % newdps)
                        #tn.send_thor_cmd(config_d['SutDPS'], 'vidout_scale-manual')
                        tn.send_thor_cmd(newdps, 'vidout_scale-manual')
                    else:
                        newdps = config_d['SutDPS']
                        tn.send_thor_cmd(newdps, 'vidout_scale-manual')
                    #"for"  set aspect Ratio
                    arcmd='vidout_aspect_ratio-'+ar
                    tn.send_thor_cmd(newdps, arcmd)
                    log.logger.info("Set aspectratio to %s !" % ar)
                    #set output colorspac
                    cscmd = 'vidout_color_space-'+outputcolor
                    tn.send_thor_cmd(newdps, cscmd)
                    log.logger.info("Set output colorspace to %s !" % outcolor)
                    # set scaler output timing
                    outcode = swcregconf.getTimingExpect(scalercode)
                    cmd=''.join('VIDOUT_RES_REF-'+outcode['HRES']+'x'+outcode['VRES']+','+str(round(float(outcode['VRAT']))))
                    log.logger.info("The manual scaler timing out is %s" % cmd)
                    tn.send_thor_cmd(newdps, cmd)
                    #Set pattern test pattern
                    pcmd = 'vidout_testpat-' + patterntest
                    tn.send_thor_cmd(newdps, pcmd)
                    log.logger.info("The %s pattern test!"% patterntest)
                    #Set QD input port
                    log.logger.info("Set QD analyze port!")
                    setQdInputport(qd, outporttype)
                    #Check pattern
                    if checkPattern(qd, qdcode, scalercode, incode, outcode, patterntest, incolor, outcolor, swcolorconfig,
                                     colorimetry='auto'):
                        PATPCOUNT=PATPCOUNT+1
                    else:PATFCOUNT=PATFCOUNT+1
        repetitions = repetitions-1
    #Calculate all test result
    log.logger.info("OK,All Test Completed! Total: %d "%(INPCOUNT+INFCOUNT+OUTPCOUNT+OUTFCOUNT+PATPCOUNT+PATFCOUNT)+" cases, %d"\
                    %(INPCOUNT+OUTPCOUNT+PATPCOUNT)+" is PASS, %d" %(INFCOUNT+OUTFCOUNT+PATFCOUNT)+" is FAIL!")
    log.logger.info("INPUT Timing RESULT:%d"%(INPCOUNT)+" is PASS, %d"%(INFCOUNT)+" is FAIL. "\
                    "OUTPUT Timing RESULT: %d"%(OUTPCOUNT)+" is PASS, %d"%(OUTFCOUNT)+" is FAIL."\
                    "PATTERN TEST RESULT: %d"%(PATPCOUNT)+" is PASS, %d"%(PATFCOUNT)+" is FAIL.")
    totalnumber = INPCOUNT+INFCOUNT+OUTPCOUNT+OUTFCOUNT+PATPCOUNT+PATFCOUNT
    passnumber = INPCOUNT+OUTPCOUNT+PATPCOUNT
    failnumber = INFCOUNT+OUTFCOUNT+PATFCOUNT
    notrunnumber = totalnumber-passnumber-failnumber
    return passnumber, failnumber, notrunnumber