Use a test helper executable to open files
In the test, we used a trick to open files from the shell, the pass the
FDs to fd_server. It will not work for directories.
This change replaces the trick with a test helper executable, which
supports opening directories as FD, in order to make the future test
cases that involved directory FD possible.
Bug: 203251769
Test: AuthFsHostTest
Change-Id: I77fdfa463f168bce99d1fccc91d0739bbc6ba00a
diff --git a/authfs/tests/Android.bp b/authfs/tests/Android.bp
index 8061c56..fd45e13 100644
--- a/authfs/tests/Android.bp
+++ b/authfs/tests/Android.bp
@@ -14,8 +14,26 @@
"VirtualizationTestHelper",
],
test_suites: ["general-tests"],
+ target_required: ["open_then_run"],
data: [
":authfs_test_files",
":MicrodroidTestApp.signed",
],
}
+
+rust_test {
+ name: "open_then_run",
+ crate_name: "open_then_run",
+ srcs: ["open_then_run.rs"],
+ edition: "2018",
+ rustlibs: [
+ "libandroid_logger",
+ "libanyhow",
+ "libclap",
+ "libcommand_fds",
+ "liblog_rust",
+ "libnix",
+ ],
+ test_suites: ["general-tests"],
+ test_harness: false,
+}