12ASAN_SETUP = sys.argv[2]
17 print(
'Waiting for device')
18 subprocess.check_call([ADB,
'wait-for-device'])
19 bit1 = subprocess.check_output([ADB,
'shell',
'getprop',
20 'dev.bootcomplete']).
decode(
'utf-8')
21 bit2 = subprocess.check_output([ADB,
'shell',
'getprop',
22 'sys.boot_completed']).
decode(
'utf-8')
23 if '1' in bit1
and '1' in bit2:
24 print(
'Device detected')
27log = subprocess.check_output([ADB,
'root']).
decode(
'utf-8')
31 raise Exception(
'adb root failed')
33output = subprocess.check_output([ADB,
'disable-verity']).
decode(
'utf-8')
36if 'already disabled' not in output:
37 print(
'Rebooting device')
38 subprocess.check_call([ADB,
'reboot'])
44 out = subprocess.check_output([ADB,
'wait-for-device']).
decode(
'utf-8')
48 cmd = [ASAN_SETUP,
'--revert']
49 process = subprocess.Popen(cmd, env={
'ADB': ADB},
50 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
53 (stdout, stderr) = process.communicate()
54 print(stdout.decode(
'utf-8'))
55 print(
'Stderr: %s' % stderr.decode(
'utf-8'))
56 return process.returncode == 0
59 print(
'Trying to revert the ASAN install and then re-install')
63 raise Exception(
'reverting ASAN install failed')
69 raise Exception(
'Tried twice to setup ASAN and failed.')
def print(*args, **kwargs)
def installASAN(revert=False)
static DecodeResult decode(std::string path)