From 9a1c1c7941e111b67e89cc6e0738455d6edbbd5e Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 5 Oct 2022 19:07:12 -0700 Subject: [PATCH] tools/remote-test-{server,client}: Use /data/local/tmp on Android The /data/tmp directory does not exist, at least not on recent versions of Android, which currently leads to test failures on that platform. I checked a virtual device running AOSP master and a Nexus 5 running Android Marshmallow and on both devices the /data/tmp directory does not exist and /data/local/tmp does, so let's switch to /data/local/tmp. --- src/bootstrap/test.rs | 2 +- src/tools/remote-test-client/src/main.rs | 4 ++-- src/tools/remote-test-server/src/main.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 01f4cacd771..2271c18eb1d 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -23,7 +23,7 @@ use crate::util::{self, add_link_lib_path, dylib_path, dylib_path_var, output, t}; use crate::{envify, CLang, DocTests, GitRepo, Mode}; -const ADB_TEST_DIR: &str = "/data/tmp/work"; +const ADB_TEST_DIR: &str = "/data/local/tmp/work"; /// The two modes of the test runner; tests or benchmarks. #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, PartialOrd, Ord)] diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs index 2d99f2cb8e2..bcda930d093 100644 --- a/src/tools/remote-test-client/src/main.rs +++ b/src/tools/remote-test-client/src/main.rs @@ -93,7 +93,7 @@ fn start_android_emulator(server: &Path) { println!("pushing server"); let status = - Command::new("adb").arg("push").arg(server).arg("/data/tmp/testd").status().unwrap(); + Command::new("adb").arg("push").arg(server).arg("/data/local/tmp/testd").status().unwrap(); assert!(status.success()); println!("forwarding tcp"); @@ -102,7 +102,7 @@ fn start_android_emulator(server: &Path) { assert!(status.success()); println!("executing server"); - Command::new("adb").arg("shell").arg("/data/tmp/testd").spawn().unwrap(); + Command::new("adb").arg("shell").arg("/data/local/tmp/testd").spawn().unwrap(); } fn prepare_rootfs(target: &str, rootfs: &Path, server: &Path, rootfs_img: &Path) { diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 0c60d500a80..bed9d39161d 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -98,7 +98,7 @@ fn main() { let listener = t!(TcpListener::bind(config.bind)); let (work, tmp): (PathBuf, PathBuf) = if cfg!(target_os = "android") { - ("/data/tmp/work".into(), "/data/tmp/work/tmp".into()) + ("/data/local/tmp/work".into(), "/data/local/tmp/work/tmp".into()) } else { let mut work_dir = env::temp_dir(); work_dir.push("work");