summaryrefslogtreecommitdiff
path: root/emu_test/test_console/uninstall_app.py
diff options
context:
space:
mode:
Diffstat (limited to 'emu_test/test_console/uninstall_app.py')
-rw-r--r--emu_test/test_console/uninstall_app.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/emu_test/test_console/uninstall_app.py b/emu_test/test_console/uninstall_app.py
new file mode 100644
index 00000000..847c1bed
--- /dev/null
+++ b/emu_test/test_console/uninstall_app.py
@@ -0,0 +1,23 @@
+"""This script is to run adb to uninstall apps."""
+
+import subprocess
+import sys
+import time
+
+from utils import util
+
+test_apk_package = '%s.test' % util.MAIN_APK_PACKAGE
+
+num_trials = 1
+while True:
+ if num_trials is util.ADB_NUM_MAX_TRIALS:
+ sys.exit(-1)
+ try:
+ print ('Run adb shell to uninstall apps, trial num: %s' % str(num_trials))
+ subprocess.call(['adb', 'uninstall', util.MAIN_APK_PACKAGE])
+ subprocess.call(['adb', 'uninstall', test_apk_package])
+ break
+ except subprocess.CalledProcessError as err:
+ print 'Subprocess call error: {0}'.format(err)
+ time.sleep(util.ADB_TRIAL_WAIT_TIME_S)
+ num_trials += 1