Merge "Distinguish test executable name and its Soong module name"
diff --git a/authfs/tests/Android.bp b/authfs/tests/Android.bp
index 88c1ba6..92fa428 100644
--- a/authfs/tests/Android.bp
+++ b/authfs/tests/Android.bp
@@ -14,7 +14,7 @@
"VirtualizationTestHelper",
],
test_suites: ["general-tests"],
- target_required: ["open_then_run"],
+ target_required: ["open_then_run_module"],
data: [
":authfs_test_files",
":MicrodroidTestApp.signed",
@@ -22,7 +22,16 @@
}
rust_test {
- name: "open_then_run",
+ // PushFilePreparer can sometimes push the directory (if named "open_then_run", which contains
+ // the actual executable in a per-architecture sub-directory) instead of the executable. This
+ // makes it harder to use because the host Java test have to detect the executable path
+ // dynamically, e.g. if it's a directory, append the device's architecture to build the actual
+ // executable path. By simply renaming the module (thus the host directory), this forces
+ // PushFilePreparer to always push the executable to the destination, so that the Java test can
+ // easily locate the executable with a constant path.
+ name: "open_then_run_module",
+ stem: "open_then_run",
+
crate_name: "open_then_run",
srcs: ["open_then_run.rs"],
edition: "2018",
diff --git a/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java b/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java
index 7229dde..3ed8748 100644
--- a/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java
+++ b/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java
@@ -57,6 +57,9 @@
/** Mount point of authfs on Microdroid during the test */
private static final String MOUNT_DIR = "/data/local/tmp";
+ /** Path to open_then_run on Android */
+ private static final String OPEN_THEN_RUN_BIN = TEST_DIR + "/open_then_run";
+
/** Path to fd_server on Android */
private static final String FD_SERVER_BIN = "/apex/com.android.virt/bin/fd_server";
@@ -374,18 +377,13 @@
}
}
- private String getOpenThenRunPath() {
- // Construct path to match PushFilePreparer's upload path.
- return TEST_DIR + "/open_then_run/" + mArch + "/open_then_run";
- }
-
private void runFdServerOnAndroid(String helperFlags, String fdServerFlags)
throws DeviceNotAvailableException {
String cmd =
"cd "
+ TEST_DIR
+ " && "
- + getOpenThenRunPath()
+ + OPEN_THEN_RUN_BIN
+ " "
+ helperFlags
+ " -- "