Ejemplo n.º 1
0
Archivo: report.py Proyecto: rfhy/py
def SendReport():
       ps_downurl,ps_infourl,ps_buildnumurl,ps_buildnum,ps_branch = MyUtil.Geturl('pudding1s')
       pudding2oldnum = GetOldNumber(ps_branch)
       path= wwwserver + str(pudding2oldnum)
       os.chdir(path)
       os.system("adb pull /sdcard/autotestlog . ")
       time.sleep(60)
       os.system("adb pull /sdcard/pudding/log . ")
       time.sleep(60)
       shutil.move(wwwserver+'testreport.html','./testreport'+str(pudding2oldnum)+".html")
       shutil.move('d:\\www\\memoryresult.xls','./memoryresult'+str(pudding2oldnum)+".xls")

       print "Testreport website:" + report + str(pudding2oldnum) + "/testreport" + str(pudding2oldnum) + ".html"
       print "MemoryResult website:" + report + str(pudding2oldnum) + "/memoryresult" + str(pudding2oldnum) + ".xls"
       
       sendmsg = "TestCase website: " + report + str(pudding2oldnum) + "/testreport" + str(pudding2oldnum) + ".html\n"
       sendmsg += "MemoryResult website: " + report + str(pudding2oldnum) + "/memoryresult" + str(pudding2oldnum) + ".xls\n"
       sendmsgtodev = "TestCase website: " + report + str(pudding2oldnum) + "/testreport" + str(pudding2oldnum) + ".html\n"
       
       fhtml = open("D:/www/report/Pudding1sreport/"+ str(pudding2oldnum)+"/testreport" + str(pudding2oldnum) + ".html")
       flines =fhtml.readlines( )
       for line in flines:
              if "Failure" in line:
                     emailmsgtodev(sendmsgtodev)
##                     if "Error" in line:
##                            ss = line.split(" ")[-3]
##                            if int(ss)>0:
##                                   print "Failure : "+ss
##                                   print "send emailmsgtodev"
##                                   emailmsgtodev(sendmsgtodev)
##                     else:
##                            ss = line.split(" ")[-1].split("<")[0]
##                            if int(ss)>0:
##                                   print "Failure : "+ss
##                                   print "send emailmsgtodev"
##                                   emailmsgtodev(sendmsgtodev)
                            
       print "send emailmsgtotest "
       emailmsgtotest(sendmsg)
       fhtml.close()
Ejemplo n.º 2
0
def InstallAPK():

    ps_downurl, ps_infourl, ps_buildnumurl, ps_buildnum, ps_branch = MyUtil.Geturl(
        'pudding1s')
    ve_downurl, ve_infourl, ve_buildnumurl, ve_buildnum, ve_branch = MyUtil.Geturl(
        'puddingve')
    if ps_buildnum == '0':
        pudding2newnum = GetNewNumber(ps_buildnumurl)
    else:
        pudding2newnum = ps_buildnum

    if ve_buildnum == '0':
        puddingVEnewnum = GetNewNumber(ve_buildnumurl)
    else:
        puddingVEnewnum = ve_buildnum

    pudding2oldnum = GetOldNumber(ps_branch)
    puddingVEoldnum = GetOldNumber(ve_branch)
    print "pudding2oldnum: " + str(pudding2oldnum)
    print "pudding2newnum: " + str(pudding2newnum)
    print "puddingVEoldnum: " + str(puddingVEoldnum)
    print "puddingVEnewnum: " + str(puddingVEnewnum)
    if CheckNewBuildStatus(ps_infourl):
        if pudding2newnum > pudding2oldnum:
            #pudding report dir
            print "Create report dir"
            reportpath = reportadress + str(pudding2newnum)
            print "reportpath: ", reportpath
            if os.path.exists(reportpath) == False:
                os.mkdir(reportpath)
            #pudding2.0


##                            Uri = "http://jenkins.365jiating.com:8080/job/pudding2.0/lastSuccessfulBuild/api/json?depth=1"
##                            downloadurl = "http://jenkins.365jiating.com:8080/job/pudding2.0/lastSuccessfulBuild/artifact/"
##                            dirname = 'pudding2.0'
            DownloadAPK(ps_infourl, ps_downurl, str(pudding2newnum), ps_branch)
            print "Download pudding1s APK succeed"
            # if VE build successed
            if CheckNewBuildStatus(ve_infourl):
                if puddingVEnewnum > puddingVEoldnum:
                    #puddingVE
                    ##                                          Uri = "http://jenkins.365jiating.com:8080/job/VoiceEngin_Voice/lastSuccessfulBuild/api/json?depth=1"
                    ##                                          downloadurl = "http://jenkins.365jiating.com:8080/job/VoiceEngin_Voice/lastSuccessfulBuild/artifact/"
                    ##                                          dirname = 'puddingve'
                    DownloadAPK(ve_infourl, ve_downurl, str(puddingVEnewnum),
                                ve_branch)
                    print "Download puddingVE APK succeed"
                    #write config。。。
                    ##                                          strname = ve_branch
                    SetOldNumber(ve_branch, str(puddingVEnewnum))
                    print "Modify puddingve build number ", puddingVEnewnum
                    #install。。。。。。
                    path = buildadress + ve_branch + "/" + str(puddingVEnewnum)
                    print path
                    os.chdir(path)
                    listfile = os.listdir(os.getcwd())
                    apk0 = "adb -s " + sn + " install -r " + listfile[0]
                    print apk0
                    os.system(apk0)
                    time.sleep(180)

            dirpath = buildadress + ps_branch + "/" + str(pudding2newnum)
            print "install apk.."
            parents = os.listdir(dirpath)
            for parent in parents:
                path = os.path.join(dirpath, parent)
                apkcmd = "adb -s " + sn + " install -r " + path
                print apkcmd
                os.system(apkcmd)
                time.sleep(30)
            os.system("adb -s " + sn + " devices")
            #write config。。。
            ##                            strname = 'pudding2.0'
            SetOldNumber(ps_branch, str(pudding2newnum))
            print "Modify pudding2.0 build number ", pudding2newnum
            os.system("adb -s " + sn + "shell \" busybox pkill com.roobo* \"")
            print "busybox pkill com.roobo* "
            os.system("adb -s " + sn + "shell \" busybox pkill com.juan* \"")
            print "busybox pkill com.juan* "
            time.sleep(120)