Run device tests as the shell user.
A handful of the std::filesystem tests assume non-root (such as
checking readability of a file that has mode 000). We probably
shouldn't be running as root for these tests anyway.
Test: ./run_tests.py --bitness 32
Test: ./run_tests.py --bitness 64
Bug: None
Change-Id: Ifc661bd245c3d802d8816d1c098b0e47d011c4fa
diff --git a/run_tests.py b/run_tests.py
index f510c41..ebbce05 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -142,6 +142,14 @@
return extract_build_cmds(commands, os.path.basename(target))
+def setup_test_directory():
+ """Prepares a device test directory for use by the shell user."""
+ device_dir = '/data/local/tmp/libcxx'
+ check_call(['adb', 'shell', 'rm', '-rf', device_dir])
+ check_call(['adb', 'shell', 'mkdir', '-p', device_dir])
+ check_call(['adb', 'shell', 'chown', '-R', 'shell:shell', device_dir])
+
+
def main():
"""Program entry point."""
logging.basicConfig(level=logging.INFO)
@@ -176,6 +184,9 @@
have_filter_args = True
break # No need to keep scanning.
+ if not args.host:
+ setup_test_directory()
+
lit_args = [
'-sv', android_mode_arg, cxx_under_test_arg, cxx_template_arg,
link_template_arg, libcxx_site_cfg_arg, libcxxabi_site_cfg_arg