Esempio n. 1
0
def scenario_keepread(clsvar, msg_client):
    msg_client.SendMsg("begining,entering")

    try:
        clsvar.countlifemeasure = str(100)

        if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar,
                                                          msg_client) == False:
            msg_client.SendMsg("fail,prepare the runtime Random address")
            raise Exception("No runtime Random address")
            return False

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure",
                                         clsvar.countlifemeasure)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart",
                                         str(clsvar.addrstressblock))

        clsvar.listtaskloop = [aa for aa in range(10000)]
        clsvar.listinnerloop = [aa for aa in range(10000)]

        start = clsvar.addrstressblock
        size = 8

        ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size)
        if ret != "0":
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s" %
                               (start, size, "task", "pos_na", ret))
            return
        prevcrc32 = crc32

        for clsvar.currtaskloop in clsvar.listtaskloop:
            msg_client.SendMsg("currtaskloop,%s" % (clsvar.currtaskloop))
            for clsvar.currinnerloop in clsvar.listinnerloop:
                ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size)
                if ret != "0":
                    msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s" %
                                       (start, size, "task", "pos_na", ret))
                    continue
                if crc32 != prevcrc32:
                    msg_client.SendMsg("fail,crc23 changed,%s" % (crc32))
                    prevcrc32 = crc32
                    continue

            msg_client.SendMsg("log,before verify job")
            if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
                msg_client.SendMsg("fail,InspectCRC32Table")
                return False
            msg_client.SendMsg("log,after verify job")

    except Exception as e:
        import traceback
        msgerr = traceback.format_exc()
        msgerr = msgerr.replace("\n", "$")

        ## replace the "\n" with "$"
        msg_client.SendMsg("fail,scenario_keepread")
        msg_client.SendMsg(msgerr)

    msg_client.SendMsg("ending,leaving")
Esempio n. 2
0
def funcOperCmdStop(clsvar, msg_client):
    # stop emmc write operation .
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "1" )

    # stop spmi operation.
    setSPMIValue(clsvar, "cmdstop", "1" )
    clsvar.OnAllStop.set()
    clsvar.OnWaitRestart.set()
    msg_client.SendMsg("finish setting")
Esempio n. 3
0
def funcOperCmdStop(clsvar, msg_client):
    # stop emmc write operation .
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "1")

    # stop spmi operation.
    setSPMIValue(clsvar, "cmdstop", "1")
    clsvar.OnAllStop.set()
    clsvar.OnWaitRestart.set()
    msg_client.SendMsg("finish setting")
Esempio n. 4
0
def scenario_keepread(clsvar, msg_client) :
    msg_client.SendMsg("begining,entering" )

    try:
        clsvar.countlifemeasure = str(100)

        if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar, msg_client) == False :
            msg_client.SendMsg("fail,prepare the runtime Random address")
            raise  Exception("No runtime Random address")
            return False

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure", clsvar.countlifemeasure)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", str(clsvar.addrstressblock))


        clsvar.listtaskloop = [aa for aa in range(10000)]
        clsvar.listinnerloop = [aa for aa in range(10000)]

        start = clsvar.addrstressblock
        size = 8

        ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size )
        if ret != "0" :
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(start, size,"task","pos_na",ret ))
            return
        prevcrc32 = crc32

        for clsvar.currtaskloop in clsvar.listtaskloop :
            msg_client.SendMsg("currtaskloop,%s"%(clsvar.currtaskloop))
            for clsvar.currinnerloop in clsvar.listinnerloop :
                ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size )
                if ret != "0" :
                    msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(start, size,"task","pos_na",ret ))
                    continue
                if crc32 != prevcrc32 :
                    msg_client.SendMsg("fail,crc23 changed,%s"%(crc32))
                    prevcrc32 = crc32
                    continue

            msg_client.SendMsg("log,before verify job")
            if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
                msg_client.SendMsg("fail,InspectCRC32Table")
                return False
            msg_client.SendMsg("log,after verify job")


    except Exception as e:
        import traceback
        msgerr = traceback.format_exc()
        msgerr = msgerr.replace("\n", "$")

        ## replace the "\n" with "$"
        msg_client.SendMsg("fail,scenario_keepread")
        msg_client.SendMsg(msgerr)

    msg_client.SendMsg("ending,leaving" )
Esempio n. 5
0
def makeEmmcWriteReady(clsvar, msg_client):

    # wait for emmc task sleep
    while (clsvar.OnSleepStage.is_set() == False):
        # stop emmc write operation .
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "1")
        msg_client.SendMsg("send cmdstop to 1")

        time.sleep(2)

    msg_client.SendMsg("OnSleepStage,clear")
    clsvar.OnSleepStage.clear()

    return True
Esempio n. 6
0
def makeEmmcWriteReady(clsvar, msg_client):

    # wait for emmc task sleep
    while( clsvar.OnSleepStage.is_set() == False) :
        # stop emmc write operation .
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "1" )
        msg_client.SendMsg("send cmdstop to 1")

        time.sleep(2)

    msg_client.SendMsg("OnSleepStage,clear")
    clsvar.OnSleepStage.clear()


    return True
Esempio n. 7
0
def subtaskEmmcShakingVDD_inspect(clsvar, msg_client):

    # stop emmc write operation .
    msg_client.SendMsg("send cmdstop to 1")
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "1" )

    # wait for emmc task sleep
    while( clsvar.OnSleepStage.is_set() == False) :
        msg_client.SendMsg("wait for emmc sleep")
        time.sleep(3)

    clsvar.OnSleepStage.clear()

    msg_client.SendMsg("before verify job")
    if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
        msg_client.SendMsg("fail,InspectCRC32Table")
        return False
    msg_client.SendMsg("after verify job")

    return determineRebuildCRC32Table(clsvar, msg_client)
Esempio n. 8
0
def subtaskEmmcShakingVDD_inspect(clsvar, msg_client):

    # stop emmc write operation .
    msg_client.SendMsg("send cmdstop to 1")
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "1")

    # wait for emmc task sleep
    while (clsvar.OnSleepStage.is_set() == False):
        msg_client.SendMsg("wait for emmc sleep")
        time.sleep(3)

    clsvar.OnSleepStage.clear()

    msg_client.SendMsg("before verify job")
    if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
        msg_client.SendMsg("fail,InspectCRC32Table")
        return False
    msg_client.SendMsg("after verify job")

    return determineRebuildCRC32Table(clsvar, msg_client)
Esempio n. 9
0
def main():
    # initialize the variables
    clsvar = emmcfunc.clsVariables()

    # the below is for python 2
    if not hasattr(clsvar,"adb") :
        if sys.version[0] == "2" :
            sys.stdout.flush = funcnull
            sys.stderr.flush = funcnull

        os.chdir("/sdcard/com.hipipal.qpyplus/scripts3")


    clsvar.pathmmc = "/sys/kernel/debug/mmc0/mmc0:0001"
    # clsvar.pathmmc = "/sys/kernel/debug/mmc1/mmc1:0001"
    clsvar.modelname = emmcfunc.getModelName(clsvar)
    clsvar.DeviceSerialNo = emmcfunc.getDeviceSerialNo(clsvar)
    clsvar.EmmcFirmwareVersion = emmcfunc.getEmmcFirmwareVersion(clsvar)
    #
    emmcfunc.gatherEmmcDeviceInfo(clsvar )


    print (clsvar.modelname)
    print (clsvar.serial)
    print (clsvar.EmmcFirmwareVersion)



    # clsvar.modelname = "testmodel"
    # clsvar.DeviceSerialNo = "testNo"

    SERVERIP = '172.21.26.41'
    id = 'ysc'
    passwd = 'lge123'

    # SERVERIP = '192.168.219.180'
    # id = 'jaehyek'
    # passwd = 'choi'

    msg_client = emmctest.clsMsgClent( clsvar.DeviceSerialNo,clsvar.modelname,SERVERIP )
    msg_client.onlylocal = True


    msg_client.SendMsg("EmmcFirmwareVersion,%s"% clsvar.EmmcFirmwareVersion )
    msg_client.SendMsg ("curr dir : %s" % os.path.realpath("."))
    msg_client.SendMsg ("starting msg_client")


    # emmctest.makeKeyEventPowerKey()
    # emmctest.displayoff()

    clsvar.allstop.Value = 0

    # emmctest.taskEmmcRandomWrite(clsvar, msg_client)


    if emmcfunc.setupRandomWriteAddr( clsvar, msg_client) == False :
        msg_client.SendMsg("failed to setupRandomWriteAddr")
        print ("failed to setupRandomWriteAddr")
        return False

    clsvar.countlifemeasure = str(100)
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure", clsvar.countlifemeasure)

    start, size = emmcfunc.getpartitioninfo(clsvar, "userdata")
    start = int(start)
    size = int(size)
    start = start + int(size/2)
    size = int(size/2)

    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", str(start))
    msg_client.SendMsg("addrblockstart,%s"%start)

    loop = 100
    while(loop > 0 ) :
        clsvar.emmccountloop = "-1"
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countloop", "%s" % clsvar.emmccountloop)
        msg_client.SendMsg("Before Looping in funcLoopWritingWithSaving ")
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdeMMCTest", "12" )
        msg_client.SendMsg("After Looping in funcLoopWritingWithSaving ")

        # print the attribute : countrepeated
        msg_client.SendMsg("eMMC countrepeated , %s " % emmcfunc.getEmmcDebugfsAttrValue(clsvar, "countrepeated"))

        loop -= 1
        time.sleep(2)
        print("emmc Write Job again")
Esempio n. 10
0
def main():
    os.chdir("/sdcard/com.hipipal.qpyplus/scripts3")

    ## ______________ initialize the variables class   __________________
    # if os.path.exists("clsvar.pickle") :
    #     with open('clsvar.pickle', 'rb') as handle:
    #         clsvar = pickle.load(handle)
    # else :
    #     clsvar = emmcfunc.clsVariables()

    clsvar = emmcfunc.clsVariables()
    getModelInfo(clsvar)

    os.system("setenforce 0")

    ## ______________ setup of test parameters   __________________
    clsvar.pathmmc = emmcfunc.getEmmcPath(clsvar)
    clsvar.EmmcGBSize = emmcfunc.getEmmcGBSize(clsvar)
    clsvar.modelname = emmcfunc.getModelName(clsvar)
    clsvar.DeviceSerialNo = emmcfunc.getDeviceSerialNo(clsvar)
    clsvar.EmmcFirmwareVersion = emmcfunc.getEmmcFirmwareVersion(clsvar)
    clsvar.addrSPMIEMMCVDD = emmcfunc.getAddrSPMIEMMCVDD(clsvar)
    clsvar.sizetestblock = 8192

    # clsvar.modelname = "testmodel"
    # clsvar.DeviceSerialNo = "testNo"


    clsvar.taskname = "emmccheck"

    msg_client = emmctest.clsMsgClent( "%s_%s_%s"%(clsvar.taskname ,clsvar.DeviceSerialNo, clsvar.EmmcGBSize) ,clsvar.modelname,clsvar.SERVERIP, clsvar.port )
    msg_client.onlylocal = True
    msg_client.SendMsg("starting msg_client")

    #___________________________________________________________________________________
    # just for test
    # emmctest.printprocessmeminfo(clsvar, msg_client)
    # time.sleep(20)
    # exit()

    #___________________________________________________________________________________

    msg_client.SendMsg("clsvar.pathmmc,%s"%(clsvar.pathmmc))
    msg_client.SendMsg("clsvar.EmmcGBSize,%s"%(clsvar.EmmcGBSize))
    msg_client.SendMsg("clsvar.modelname,%s"%(clsvar.modelname))

    msg_client.SendMsg("clsvar.DeviceSerialNo,%s"%(clsvar.DeviceSerialNo))
    msg_client.SendMsg("clsvar.EmmcFirmwareVersion,%s"%(clsvar.EmmcFirmwareVersion))
    msg_client.SendMsg("clsvar.addrSPMIEMMCVDD,%s"%(clsvar.addrSPMIEMMCVDD))
    # msg_client.SendMsg("disableChargingEvent,%s"%(emmcfunc.disableChargingEvent(clsvar, True)))

    msg_client.SendMsg("getenforce,%s"% os.popen("getenforce 0").readline().strip() )


    emmcfunc.gatherEmmcDeviceInfo(clsvar )

    #____________________________________________________________________________________________
    # define the stressblock address if addrstressblock or namestressblock exist .
    addrstressblock = 0
    if hasattr(clsvar, "addrstressblock") and clsvar.addrstressblock != 0 :
        addrstressblock = clsvar.addrstressblock
    elif hasattr(clsvar, "namestressblock") and len(clsvar.namestressblock) != 0 :
        addrblock, size = emmcfunc.getpartitioninfo(clsvar, clsvar.namestressblock)
        addrstressblock = addrblock + ( size - clsvar.sizetestblock )
        # make addressblock to be module of clsvar.sizetestblock
        addrstressblock -= ( addrstressblock % clsvar.sizetestblock )
        if addrstressblock < addrblock :
            addrstressblock = 0


    if addrstressblock != 0 :
        if emmcfunc.fillblockwithblockaddresszero(clsvar, addrstressblock , clsvar.sizetestblock) == False :
            msg_client.SendMsg ("can't use the addrstressblock,%s" % addrstressblock )
            return
        else:
            clsvar.addrstressblock = addrstressblock
            msg_client.SendMsg ("addrstressblock,%s" % addrstressblock )

    #____________________________________________________________________________________________

    # clsvar.deepsleepsec = 30
    clsvar.currPreSleepSec = 1

    if not hasattr(clsvar, "deepsleepsec") or clsvar.deepsleepsec == None :
        clsvar.deepsleepsec = 20

    msg_client.SendMsg("deepsleepsec,%s"%clsvar.deepsleepsec)

    clsdeepsleep = emmcfunc.DeepSleepWake()
    countdeepsleepprev = emmcfunc.getDeepSleepCount(clsvar)
    msg_client.SendMsg("countdeepsleepprev is %s"%( countdeepsleepprev))

    clsvar.currEmmcWriteSize = 10

    for  aa in range(20) :

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countloop", "%s" % clsvar.currEmmcWriteSize)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "retcheck", "%s" % 1)
        # assign  clsvar.addrstressblock to addrblockstart
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", clsvar.addrstressblock )
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdeMMCTest", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO )

        # emmcfunc.disableChargingEvent(clsvar, False)
        # emmcfunc.disableChargingEvent(clsvar, True)

        time.sleep(clsvar.currPreSleepSec)

        clsdeepsleep.sleep(clsvar.deepsleepsec)

        try:
            time.sleep(clsvar.deepsleepsec+5)
            countdeepsleep = emmcfunc.getDeepSleepCount(clsvar)
            if ( countdeepsleepprev == countdeepsleep) :
                msg_client.SendMsg("No_Deep_Sleep")
            else:
                msg_client.SendMsg("countdeepsleep,%s"%countdeepsleep)
            countdeepsleepprev = countdeepsleep

        except:
            msg_client.SendMsg("fail,DeepSleepCountReadingError")

        result = emmcfunc.getEmmcDebugfsAttrValue(clsvar, "result")
        if  result != "0" :
            msg_client.SendMsg("fail,EmmcWriteError,%s"%result)
Esempio n. 11
0
def scenario_sleepwakeCRC32not(clsvar, msg_client) :

    msg_client.SendMsg("begining,entering" )

    try:
        # open and read the fail emmcblock address
        listreadblockaddress = []
        for line in  open("crc32not.list") :
            listitem = line.split(",")
            if len(listitem) > 7  and clsvar.DeviceSerialNo in listitem[2] :
                listreadblockaddress.append(listitem[7])


        # emmcfunc.disableChargingEvent(clsvar, False)
        # emmcfunc.disableChargingEvent(clsvar, True)
        clsvar.countlifemeasure = str(100)

        if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar, msg_client) == False :
            msg_client.SendMsg("fail,prepare the runtime Random address")
            raise  Exception("No runtime Random address")
            return False

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure", clsvar.countlifemeasure)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", str(clsvar.addrstressblock))

        sec_start = int(round(time.time()))

        clsvar.listtaskloop = [aa for aa in range(40)]
        clsvar.listEmmcWriteMode = [ "random","sequence" ]
        clsvar.listEmmcWriteSize = [10]
        # clsvar.listPreSleepSec = [ 0,5, 10, 15, 20, 25,30]
        clsvar.listdeepsleepcount = [aa for aa in range(100)]

        if not hasattr(clsvar, "deepsleepsec") or clsvar.deepsleepsec == None :
            clsvar.deepsleepsec = 10

        msg_client.SendMsg("deepsleepsec,%s"%clsvar.deepsleepsec)

        clsvar.currPreSleepSec = 1

        clsdeepsleep = emmcfunc.DeepSleepWake()
        countdeepsleepprev = emmcfunc.getDeepSleepCount(clsvar)

        for clsvar.currtaskloop in clsvar.listtaskloop :

            for clsvar.currEmmcWriteMode   in clsvar.listEmmcWriteMode :

                if emmcfunc.setupRandomWriteAddr( clsvar, msg_client) == False:
                    return False

                for clsvar.currEmmcWriteSize in clsvar.listEmmcWriteSize :

                    msg_client.SendMsg("curr set,%s,%s,%s,%s"%(clsvar.currtaskloop,clsvar.currEmmcWriteMode,clsvar.currEmmcWriteSize,clsvar.currPreSleepSec))

                    for  clsvar.currdeepsleepcount  in  clsvar.listdeepsleepcount :

                        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countloop", "%s" % clsvar.currEmmcWriteSize)
                        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "retcheck", "%s" % 1)
                        # assign  clsvar.addrstressblock to addrblockstart
                        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", clsvar.addrstressblock )
                        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdeMMCTest", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO )

                        # emmcfunc.disableChargingEvent(clsvar, False)
                        # emmcfunc.disableChargingEvent(clsvar, True)

                        time.sleep(clsvar.currPreSleepSec)

                        clsdeepsleep.sleep(clsvar.deepsleepsec)

                        try:
                            time.sleep(clsvar.deepsleepsec+5)
                            countdeepsleep = emmcfunc.getDeepSleepCount(clsvar)
                            if ( countdeepsleepprev == countdeepsleep) :
                                msg_client.SendMsg("No_Deep_Sleep")
                            else:
                                msg_client.SendMsg("countdeepsleep,%s"%countdeepsleep)
                            countdeepsleepprev = countdeepsleep

                        except:
                            msg_client.SendMsg("fail,DeepSleepCountReadingError")

                        if  emmcfunc.getEmmcDebugfsAttrValue(clsvar, "result") != "0" :
                            msg_client.SendMsg("fail,EmmcWriteError")

                    msg_client.SendMsg("log,before crc32not")
                    for start in listreadblockaddress :
                        ret, crc32 =  emmcfunc.getcrc32ofblocks(clsvar, start, clsvar.sizetestblock)
                        if ret != "0" :
                            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(start, clsvar.sizetestblock,"wholearea","pos_na",ret ))
                    msg_client.SendMsg("log,after crc32not")


        sec_diff = int(round(time.time())) - sec_start
        msg_client.SendMsg("collapsed time,%s"%(timedelta(seconds = sec_diff)))

        # emmcfunc.disableChargingEvent(clsvar, False)
    #
    except Exception as e:
        import traceback
        msgerr = traceback.format_exc()
        msgerr = msgerr.replace("\n", "$")

        ## replace the "\n" with "$"
        msg_client.SendMsg("fail,scenario_sleepwake")
        msg_client.SendMsg(msgerr)

    msg_client.SendMsg("ending,leaving" )
Esempio n. 12
0
def subtaskEmmcRandomWriteWithaddress(clsvar, msg_client):

    msg_client.SendMsg("begining,entering" )

    # prepare a condition for emmc writing
    clsvar.countlifemeasure = str(100)
    print (os.path.realpath("."))
    
    if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar, msg_client) == False :
        msg_client.SendMsg("fail,prepare the runtime Random address")
        return False
    
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure", clsvar.countlifemeasure)
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", str(clsvar.addrstressblock))


    # make the emmc infinite writing
    clsvar.emmccountloop = "-1"
    currEmmcWriteMode = "0"

    ret, crc32 =  emmcfunc.getcrc32ofblocks(clsvar, clsvar.addrstressblock, int(clsvar.sizetestblock))
    if ret != "0" :
        msg_client.SendMsg("fail,CRC32ed,%s,%s,%s,%s,%s"%(clsvar.addrstressblock, int(clsvar.sizetestblock),"subtask",0,ret ))

    while( True):

        msg_client.SendMsg("OnWaitRestart,waiting job")
        clsvar.OnWaitRestart.wait()

        if  clsvar.OnAllStop.is_set() == True :
            msg_client.SendMsg("OnAllStop,set,job terminating")
            break

        clsvar.OnWaitRestart.clear()

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countloop", "%s" % clsvar.emmccountloop)


        if not hasattr(clsvar, "currEmmcWriteMode") :
            clsvar.currEmmcWriteMode = clsvar.listEmmcWriteMode[0]
        
        if currEmmcWriteMode != clsvar.currEmmcWriteMode : 
            if emmcfunc.setupRandomWriteAddr( clsvar, msg_client) == False:
                return False
            currEmmcWriteMode = clsvar.currEmmcWriteMode

        msg_client.SendMsg("Before Looping in subtaskEmmcRandomWriteWithaddress ")

        ret , crc32 = emmcfunc.getcrc32ofblocks(clsvar, 0, int(clsvar.sizetestblock))
        if ret != "0" :
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(0, int(clsvar.sizetestblock),"subtask",0,ret ))

        ret , crc32 = emmcfunc.getcrc32ofblocks(clsvar, int(clsvar.sizetestblock), int(clsvar.sizetestblock))
        if ret != "0" :
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(int(clsvar.sizetestblock), int(clsvar.sizetestblock),"subtask",0,ret ))

        _ret, _crc32 =  emmcfunc.getcrc32ofblocks(clsvar, clsvar.addrstressblock, int(clsvar.sizetestblock))
        if _ret != "0" :
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(clsvar.addrstressblock, int(clsvar.sizetestblock),"subtask",0,ret ))
        elif crc32 != _crc32 :
            msg_client.SendMsg("fail,CRC32 changed")
            crc32 = _crc32
        else:
            msg_client.SendMsg("pass,CRC32 same")


        if clsvar.fakewriteemmc == False :
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "retcheck", "%s" % 1)
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", clsvar.addrstressblock )
            msg_client.SendMsg("writing,looping,addrstressblock,%s"%(clsvar.addrstressblock))
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdeMMCTest", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO )
            if  emmcfunc.getEmmcDebugfsAttrValue(clsvar, "result") != "0" :
                msg_client.SendMsg("fail,cmdeMMCTest return Failed")
        else:
            # msg_client.SendMsg("fake,stating.....")
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdindex", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO )
            while ( emmcfunc.getEmmcDebugfsAttrValue(clsvar, "cmdstop") != "1"):
                time.sleep(10)
                msg_client.SendMsg("fake,emmc working")
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdindex", "5000" )
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "0" )



        msg_client.SendMsg("After Looping in subtaskEmmcRandomWriteWithaddress ")

        # print the attribute : countrepeated
        msg_client.SendMsg("eMMC countrepeated, %s" % emmcfunc.getEmmcDebugfsAttrValue(clsvar, "countrepeated"))


        clsvar.OnSleepStage.set()
        msg_client.SendMsg("OnSleepStage,set")

    msg_client.SendMsg("ending,leaving" )
Esempio n. 13
0
def scenario_keepwrite(clsvar, msg_client) :
    msg_client.SendMsg("begining,entering" )
    try:
        clsvar.countlifemeasure = str(100)

        if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar, msg_client) == False :
            msg_client.SendMsg("fail,prepare the runtime Random address")
            raise  Exception("No runtime Random address")
            return False

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure", clsvar.countlifemeasure)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", str(clsvar.addrstressblock))


        clsvar.listtaskloop = [aa for aa in range(10000)]
        clsvar.listinnerloop = [aa for aa in range(100)]
        clsvar.listwriteloop = [aa for aa in range(100)]

        start = clsvar.addrstressblock
        size = 8192

        ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size )
        if ret != "0" :
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(start, size,"task","pos_na",ret ))
            return
        prevcrc32 = crc32

        clsvar.currEmmcWriteMode = "random"
        clsvar.currEmmcWriteSize = 10
        if emmcfunc.setupRandomWriteAddr( clsvar, msg_client) == False:
            return False

        for clsvar.currtaskloop in clsvar.listtaskloop :

            for clsvar.currinnerloop in clsvar.listinnerloop :
                msg_client.SendMsg("currtaskloop,%s,currinnerloop,%s"%(clsvar.currtaskloop, clsvar.currinnerloop))
                for clsvar.currwriteloop in clsvar.listwriteloop :

                    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countloop", "%s" % clsvar.currEmmcWriteSize)
                    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "retcheck", "%s" % 1)
                    # assign  clsvar.addrstressblock to addrblockstart
                    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart", clsvar.addrstressblock )
                    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdeMMCTest", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO )

                    if  emmcfunc.getEmmcDebugfsAttrValue(clsvar, "result") != "0" :
                        msg_client.SendMsg("fail,EmmcWriteError,currwriteloop,%s"%(clsvar.currwriteloop))

                # check if crc32 is changed
                ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size )
                if ret != "0" :
                    msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s"%(start, size,"task","pos_na",ret ))

                elif crc32 != prevcrc32 :
                    msg_client.SendMsg("fail,crc23 changed,%s"%(crc32))
                    prevcrc32 = crc32

                msg_client.SendMsg("emmclife,%s"%( emmcfunc.getEmmcLifeValueofext_csd(clsvar) ))

            msg_client.SendMsg("log,before verify job")
            if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
                msg_client.SendMsg("fail,InspectCRC32Table")
                return False
            msg_client.SendMsg("log,after verify job")

    except Exception as e:
        import traceback
        msgerr = traceback.format_exc()
        msgerr = msgerr.replace("\n", "$")

        ## replace the "\n" with "$"
        msg_client.SendMsg("fail,scenario_keepwrite")
        msg_client.SendMsg(msgerr)

    msg_client.SendMsg("ending,leaving" )
Esempio n. 14
0
def scenario_sleepwake(clsvar, msg_client):

    msg_client.SendMsg("begining,entering")

    try:
        # emmcfunc.disableChargingEvent(clsvar, False)
        # emmcfunc.disableChargingEvent(clsvar, True)
        clsvar.countlifemeasure = str(100)

        if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar,
                                                          msg_client) == False:
            msg_client.SendMsg("fail,prepare the runtime Random address")
            raise Exception("No runtime Random address")
            return False

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure",
                                         clsvar.countlifemeasure)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart",
                                         str(clsvar.addrstressblock))

        sec_start = int(round(time.time()))

        clsvar.listtaskloop = [aa for aa in range(40)]
        clsvar.listEmmcWriteMode = ["random", "sequence"]
        clsvar.listEmmcWriteSize = [10]
        # clsvar.listPreSleepSec = [ 0,5, 10, 15, 20, 25,30]
        clsvar.listdeepsleepcount = [aa for aa in range(100)]

        if not hasattr(clsvar, "deepsleepsec") or clsvar.deepsleepsec == None:
            clsvar.deepsleepsec = 10

        msg_client.SendMsg("deepsleepsec,%s" % clsvar.deepsleepsec)

        clsvar.currPreSleepSec = 1

        clsdeepsleep = emmcfunc.DeepSleepWake()
        countdeepsleepprev = emmcfunc.getDeepSleepCount(clsvar)

        for clsvar.currtaskloop in clsvar.listtaskloop:

            for clsvar.currEmmcWriteMode in clsvar.listEmmcWriteMode:

                if emmcfunc.setupRandomWriteAddr(clsvar, msg_client) == False:
                    return False

                for clsvar.currEmmcWriteSize in clsvar.listEmmcWriteSize:

                    msg_client.SendMsg(
                        "curr set,%s,%s,%s,%s" %
                        (clsvar.currtaskloop, clsvar.currEmmcWriteMode,
                         clsvar.currEmmcWriteSize, clsvar.currPreSleepSec))

                    for clsvar.currdeepsleepcount in clsvar.listdeepsleepcount:

                        emmcfunc.setEmmcDebugfsAttrValue(
                            clsvar, "countloop",
                            "%s" % clsvar.currEmmcWriteSize)
                        emmcfunc.setEmmcDebugfsAttrValue(
                            clsvar, "retcheck", "%s" % 1)
                        # assign  clsvar.addrstressblock to addrblockstart
                        emmcfunc.setEmmcDebugfsAttrValue(
                            clsvar, "addrblockstart", clsvar.addrstressblock)
                        emmcfunc.setEmmcDebugfsAttrValue(
                            clsvar, "cmdeMMCTest",
                            emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO)

                        # emmcfunc.disableChargingEvent(clsvar, False)
                        # emmcfunc.disableChargingEvent(clsvar, True)

                        time.sleep(clsvar.currPreSleepSec)

                        clsdeepsleep.sleep(clsvar.deepsleepsec)

                        try:
                            time.sleep(clsvar.deepsleepsec + 5)
                            countdeepsleep = emmcfunc.getDeepSleepCount(clsvar)
                            if (countdeepsleepprev == countdeepsleep):
                                msg_client.SendMsg("No_Deep_Sleep")
                            else:
                                msg_client.SendMsg("countdeepsleep,%s" %
                                                   countdeepsleep)
                            countdeepsleepprev = countdeepsleep

                        except:
                            msg_client.SendMsg(
                                "fail,DeepSleepCountReadingError")

                        result = emmcfunc.getEmmcDebugfsAttrValue(
                            clsvar, "result")
                        if result != "0":
                            msg_client.SendMsg("fail,EmmcWriteError,%s" %
                                               result)

                    msg_client.SendMsg("log,before verify job")
                    if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
                        msg_client.SendMsg("fail,InspectCRC32Table")
                        return False
                    msg_client.SendMsg("log,after verify job")

        sec_diff = int(round(time.time())) - sec_start
        msg_client.SendMsg("collapsed time,%s" % (timedelta(seconds=sec_diff)))

        # emmcfunc.disableChargingEvent(clsvar, False)
    #
    except Exception as e:
        import traceback
        msgerr = traceback.format_exc()
        msgerr = msgerr.replace("\n", "$")

        ## replace the "\n" with "$"
        msg_client.SendMsg("fail,scenario_sleepwake")
        msg_client.SendMsg(msgerr)

    msg_client.SendMsg("ending,leaving")
Esempio n. 15
0
def subtaskEmmcRandomWriteWithaddress(clsvar, msg_client):

    msg_client.SendMsg("begining,entering")

    # prepare a condition for emmc writing
    clsvar.countlifemeasure = str(100)
    print(os.path.realpath("."))

    if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar,
                                                      msg_client) == False:
        msg_client.SendMsg("fail,prepare the runtime Random address")
        return False

    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure",
                                     clsvar.countlifemeasure)
    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart",
                                     str(clsvar.addrstressblock))

    # make the emmc infinite writing
    clsvar.emmccountloop = "-1"
    currEmmcWriteMode = "0"

    ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, clsvar.addrstressblock,
                                           int(clsvar.sizetestblock))
    if ret != "0":
        msg_client.SendMsg("fail,CRC32ed,%s,%s,%s,%s,%s" %
                           (clsvar.addrstressblock, int(
                               clsvar.sizetestblock), "subtask", 0, ret))

    while (True):

        msg_client.SendMsg("OnWaitRestart,waiting job")
        clsvar.OnWaitRestart.wait()

        if clsvar.OnAllStop.is_set() == True:
            msg_client.SendMsg("OnAllStop,set,job terminating")
            break

        clsvar.OnWaitRestart.clear()

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countloop",
                                         "%s" % clsvar.emmccountloop)

        if not hasattr(clsvar, "currEmmcWriteMode"):
            clsvar.currEmmcWriteMode = clsvar.listEmmcWriteMode[0]

        if currEmmcWriteMode != clsvar.currEmmcWriteMode:
            if emmcfunc.setupRandomWriteAddr(clsvar, msg_client) == False:
                return False
            currEmmcWriteMode = clsvar.currEmmcWriteMode

        msg_client.SendMsg(
            "Before Looping in subtaskEmmcRandomWriteWithaddress ")

        ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, 0,
                                               int(clsvar.sizetestblock))
        if ret != "0":
            msg_client.SendMsg(
                "fail,CRC32 not,%s,%s,%s,%s,%s" %
                (0, int(clsvar.sizetestblock), "subtask", 0, ret))

        ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar,
                                               int(clsvar.sizetestblock),
                                               int(clsvar.sizetestblock))
        if ret != "0":
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s" %
                               (int(clsvar.sizetestblock),
                                int(clsvar.sizetestblock), "subtask", 0, ret))

        _ret, _crc32 = emmcfunc.getcrc32ofblocks(clsvar,
                                                 clsvar.addrstressblock,
                                                 int(clsvar.sizetestblock))
        if _ret != "0":
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s" %
                               (clsvar.addrstressblock,
                                int(clsvar.sizetestblock), "subtask", 0, ret))
        elif crc32 != _crc32:
            msg_client.SendMsg("fail,CRC32 changed")
            crc32 = _crc32
        else:
            msg_client.SendMsg("pass,CRC32 same")

        if clsvar.fakewriteemmc == False:
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "retcheck", "%s" % 1)
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart",
                                             clsvar.addrstressblock)
            msg_client.SendMsg("writing,looping,addrstressblock,%s" %
                               (clsvar.addrstressblock))
            emmcfunc.setEmmcDebugfsAttrValue(
                clsvar, "cmdeMMCTest", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO)
            if emmcfunc.getEmmcDebugfsAttrValue(clsvar, "result") != "0":
                msg_client.SendMsg("fail,cmdeMMCTest return Failed")
        else:
            # msg_client.SendMsg("fake,stating.....")
            emmcfunc.setEmmcDebugfsAttrValue(
                clsvar, "cmdindex", emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO)
            while (emmcfunc.getEmmcDebugfsAttrValue(clsvar, "cmdstop") != "1"):
                time.sleep(10)
                msg_client.SendMsg("fake,emmc working")
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdindex", "5000")
            emmcfunc.setEmmcDebugfsAttrValue(clsvar, "cmdstop", "0")

        msg_client.SendMsg(
            "After Looping in subtaskEmmcRandomWriteWithaddress ")

        # print the attribute : countrepeated
        msg_client.SendMsg(
            "eMMC countrepeated, %s" %
            emmcfunc.getEmmcDebugfsAttrValue(clsvar, "countrepeated"))

        clsvar.OnSleepStage.set()
        msg_client.SendMsg("OnSleepStage,set")

    msg_client.SendMsg("ending,leaving")
Esempio n. 16
0
def scenario_keepwrite(clsvar, msg_client):
    msg_client.SendMsg("begining,entering")
    try:
        clsvar.countlifemeasure = str(100)

        if emmcfunc.makeRuntimeBlockAddressNoJournalBlock(clsvar,
                                                          msg_client) == False:
            msg_client.SendMsg("fail,prepare the runtime Random address")
            raise Exception("No runtime Random address")
            return False

        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "countlifemeasure",
                                         clsvar.countlifemeasure)
        emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart",
                                         str(clsvar.addrstressblock))

        clsvar.listtaskloop = [aa for aa in range(10000)]
        clsvar.listinnerloop = [aa for aa in range(100)]
        clsvar.listwriteloop = [aa for aa in range(100)]

        start = clsvar.addrstressblock
        size = 8192

        ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size)
        if ret != "0":
            msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s" %
                               (start, size, "task", "pos_na", ret))
            return
        prevcrc32 = crc32

        clsvar.currEmmcWriteMode = "random"
        clsvar.currEmmcWriteSize = 10
        if emmcfunc.setupRandomWriteAddr(clsvar, msg_client) == False:
            return False

        for clsvar.currtaskloop in clsvar.listtaskloop:

            for clsvar.currinnerloop in clsvar.listinnerloop:
                msg_client.SendMsg("currtaskloop,%s,currinnerloop,%s" %
                                   (clsvar.currtaskloop, clsvar.currinnerloop))
                for clsvar.currwriteloop in clsvar.listwriteloop:

                    emmcfunc.setEmmcDebugfsAttrValue(
                        clsvar, "countloop", "%s" % clsvar.currEmmcWriteSize)
                    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "retcheck",
                                                     "%s" % 1)
                    # assign  clsvar.addrstressblock to addrblockstart
                    emmcfunc.setEmmcDebugfsAttrValue(clsvar, "addrblockstart",
                                                     clsvar.addrstressblock)
                    emmcfunc.setEmmcDebugfsAttrValue(
                        clsvar, "cmdeMMCTest",
                        emmcfunc.CMD_FILLBLOCKRANDOMADDRESSZERO)

                    if emmcfunc.getEmmcDebugfsAttrValue(clsvar,
                                                        "result") != "0":
                        msg_client.SendMsg(
                            "fail,EmmcWriteError,currwriteloop,%s" %
                            (clsvar.currwriteloop))

                # check if crc32 is changed
                ret, crc32 = emmcfunc.getcrc32ofblocks(clsvar, start, size)
                if ret != "0":
                    msg_client.SendMsg("fail,CRC32 not,%s,%s,%s,%s,%s" %
                                       (start, size, "task", "pos_na", ret))

                elif crc32 != prevcrc32:
                    msg_client.SendMsg("fail,crc23 changed,%s" % (crc32))
                    prevcrc32 = crc32

                msg_client.SendMsg(
                    "emmclife,%s" %
                    (emmcfunc.getEmmcLifeValueofext_csd(clsvar)))

            msg_client.SendMsg("log,before verify job")
            if emmcfunc.InspectCRC32Table(clsvar, msg_client) == False:
                msg_client.SendMsg("fail,InspectCRC32Table")
                return False
            msg_client.SendMsg("log,after verify job")

    except Exception as e:
        import traceback
        msgerr = traceback.format_exc()
        msgerr = msgerr.replace("\n", "$")

        ## replace the "\n" with "$"
        msg_client.SendMsg("fail,scenario_keepwrite")
        msg_client.SendMsg(msgerr)

    msg_client.SendMsg("ending,leaving")