diff options
author | Dan Albert <danalbert@google.com> | 2015-12-03 17:26:08 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-12-04 10:20:39 -0800 |
commit | 35346dfd26cdceb35a56deb961e0db015ab43485 (patch) | |
tree | 780005588da27ee084aa7258d9ef09513a9cfff1 /tests | |
parent | 877b0ba5f2e0f6c6c729bf388910691264406bff (diff) | |
download | ndk-35346dfd26cdceb35a56deb961e0db015ab43485.tar.gz |
Gingerbread support for the test runner.
Wow. Gingerbread didn't support `mkdir -p` or `rm -f`. Avoid using
either of those.
Change-Id: I9f79613465e8608f89bad9a77c232620a3ca8b4e
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run-all.py | 5 | ||||
-rw-r--r-- | tests/tests.py | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/run-all.py b/tests/run-all.py index 168c29a3a..4bdac4810 100644 --- a/tests/run-all.py +++ b/tests/run-all.py @@ -295,6 +295,11 @@ def main(): if args.abi.startswith('armeabi') and args.toolchain == 'clang': asan_device_setup() + # Do this as part of initialization rather than with a `mkdir -p` later + # because Gingerbread didn't actually support -p :( + adb.shell('rm -r /data/local/tmp/ndk-tests') + adb.shell('mkdir /data/local/tmp/ndk-tests') + runner = tests.TestRunner() if 'awk' in suites: runner.add_suite('awk', 'awk', AwkTest) diff --git a/tests/tests.py b/tests/tests.py index 91124f07a..5b75a0b31 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -631,7 +631,10 @@ class DeviceTest(Test): device_dir = posixpath.join('/data/local/tmp/ndk-tests', self.name) - result, out = adb.shell('mkdir -p {}'.format(device_dir)) + # We have to use `ls foo || mkdir foo` because Gingerbread was lacking + # `mkdir -p`, the -d check for directory existence, stat, dirname, and + # every other thing I could think of to implement this aside from ls. + result, out = adb.shell('ls {0} || mkdir {0}'.format(device_dir)) if result != 0: raise RuntimeError('mkdir failed:\n' + '\n'.join(out)) @@ -669,4 +672,4 @@ class DeviceTest(Test): results.append(ExpectedFailure(case_name, config, bug)) return results finally: - adb.shell('rm -rf {}'.format(device_dir)) + adb.shell('rm -r {}'.format(device_dir)) |