import sys
device=sys.argv[1]Dateandname=sys.argv[2]
//取得传入参数print "##########python is run ##########"//打印import os
os.system("touch Strategic_success " + path1)
//执行系统指令import time
time.sleep(10)
//延时start = time.time()
end = time.time()
if ((end - start) > 3600): # 是否大于1小时 3600秒print str((end - start))
//取得程序运行时间def init(): os.system("adb -s " + device + " shell touch /sdcard/finishflag ") # 创建标志,结束内存分陪程序 os.system("adb -s " + device + " root") time.sleep(3) os.system("adb -s " + device + " remount") os.system("adb -s " + device + " push mytest /system/bin") os.system("adb -s " + device + " shell rm / sdcard/runtimes*")#删除次数标志 os.system("adb -s " + device + " shell rm /sdcard/finishflag")#删除结束标志 os.system("adb -s " + device + " shell rm -R /sdcard/test") # 删除创建的内存
//定义函数if os.path.exists(path1): print path1 else: os.makedirs(path1)
//if判断,创建文件夹for i in range(1, 8): print "#####################################" print " run " + str(i) print "#####################################"
//for循环import re
alist = []
alist.append(str2)str1 = alist.pop(0) str2 = alist.pop(0) str3 = alist.pop(0) print str1 print str2 print str3 m1 = re.findall(r'(\w*[0-9]+)\w*',str1) m2 = re.findall(r'(\w*[0-9]+)\w*',str2) m3 = re.findall(r'(\w*[0-9]+)\w*',str3) if m3 > m2 and m2 > m1: print "true" os.system("touch Strategic_success " + path1) print "touch" + path1 + "/Strategic_success" else: print "false" os.system("touch Strategic_fail " + path1)
//把数据存入队列alist,然后从数据中去除数字,然后进行对比app = ["com.xxx.weather2/.ActivityWeatherMain", #天气"com.kugou.android/.app.splash.SplashActivity", #酷狗音乐]#for a in app:# sss = a.split('/')# print "包名+类名 :"+ a# print "包名 :" + sss[0]# print "替换 . :" + sss[0].replace('.','_')#测试函数def myrunmonkey(path): for a in app: strclass = a.split('/')#截取字符串 ttt = strclass[0].replace('.', '_')#把.替换成_ print "替换 . : " + ttt os.system("adb -s " + device + " shell am start " + a)#测试相机 time.sleep(isleep) #print "adb -s " + device + " shell monkey -p "+ a[0] + " --throttle 500 --pct-touch 20 --pct-motion 25 --pct-nav 20 --pct-majornav 15 --pct-appswitch 5 --pct-anyevent 15 --ignore-crashes --ignore-timeouts --monitor-native-crashes --ignore-native-crashes " + str(times) + " > " + path+"/monkeyResult_"\ # + ttt + ".log" os.system("adb -s " + device + " shell monkey -p "+ a[0] + " --throttle 500 --pct-touch 20 --pct-motion 25 --pct-nav 20 --pct-majornav 15 --pct-appswitch 5 --pct-anyevent 15 --ignore-crashes --ignore-timeouts --monitor-native-crashes --ignore-native-crashes " + str(times) + " > " + path+"/monkeyResult_" + ttt + ".log") return ;
彭志才 2016-8-7
python入门
最新推荐文章于 2023-07-13 15:46:51 发布