| 1 |
# Copyright 2024 Google LLC |
| 2 |
# |
| 3 |
# Use of this source code is governed by a BSD-style license that can be |
| 4 |
# found in the LICENSE file. |
| 5 |
|
| 6 |
import subprocess |
| 7 |
import sys |
| 8 |
|
| 9 |
# Remove the path. |
| 10 |
adb = sys.argv[1] |
| 11 |
path = sys.argv[2] |
| 12 |
print('Removing %s' % path) |
| 13 |
cmd = [adb, 'shell', 'rm', '-rf', path] |
| 14 |
print(' '.join(cmd)) |
| 15 |
subprocess.check_call(cmd) |
| 16 |
|
| 17 |
# Verify that the path was deleted. |
| 18 |
print('Checking for existence of %s' % path) |
| 19 |
cmd = [adb, 'shell', 'ls', path] |
| 20 |
print(' '.join(cmd)) |
| 21 |
try: |
| 22 |
output = subprocess.check_output( |
| 23 |
cmd, stderr=subprocess.STDOUT).decode('utf-8') |
| 24 |
except subprocess.CalledProcessError as e: |
| 25 |
output = e.output.decode('utf-8') |
| 26 |
print('Output was:') |
| 27 |
print('======') |
| 28 |
print(output) |
| 29 |
print('======') |
| 30 |
if 'No such file or directory' not in output: |
| 31 |
raise Exception('%s exists despite being deleted' % path) |