Add more clap tests.
Bug: 260823636
Test: atest compos_verify.test fd_server.test initrd_bootconfig.test composd_cmd.test
Change-Id: I7fe3fbf5b8c349618ccdef2f096b77737eabed42
diff --git a/authfs/TEST_MAPPING b/authfs/TEST_MAPPING
index 5e144c7..450f133 100644
--- a/authfs/TEST_MAPPING
+++ b/authfs/TEST_MAPPING
@@ -4,6 +4,9 @@
"name": "authfs_device_test_src_lib"
},
{
+ "name": "fd_server.test"
+ },
+ {
"name": "open_then_run.test"
},
{
diff --git a/authfs/fd_server/Android.bp b/authfs/fd_server/Android.bp
index 44407a2..f7cb5e3 100644
--- a/authfs/fd_server/Android.bp
+++ b/authfs/fd_server/Android.bp
@@ -23,3 +23,25 @@
],
apex_available: ["com.android.virt"],
}
+
+rust_test {
+ name: "fd_server.test",
+ srcs: ["src/main.rs"],
+ rustlibs: [
+ "authfs_aidl_interface-rust",
+ "libandroid_logger",
+ "libanyhow",
+ "libauthfs_fsverity_metadata",
+ "libbinder_rs",
+ "libclap",
+ "liblibc",
+ "liblog_rust",
+ "libnix",
+ "librpcbinder_rs",
+ ],
+ prefer_rlib: true,
+ shared_libs: [
+ "libbinder_rpc_unstable",
+ ],
+ test_suites: ["general-tests"],
+}
diff --git a/authfs/fd_server/src/main.rs b/authfs/fd_server/src/main.rs
index 9d97423..f91ebec 100644
--- a/authfs/fd_server/src/main.rs
+++ b/authfs/fd_server/src/main.rs
@@ -148,3 +148,15 @@
server.join();
Ok(())
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use clap::CommandFactory;
+
+ #[test]
+ fn verify_args() {
+ // Check that the command parsing has been configured in a valid way.
+ Args::command().debug_assert();
+ }
+}