1rust_test {
2    name: "authfs_device_test_src_lib",
3    defaults: ["authfs_defaults"],
4    test_suites: ["general-tests"],
5    data: [":authfs_test_files"],
6}
7
8filegroup {
9    name: "authfs_test_files",
10    srcs: [
11        "testdata/cert.der",
12        "testdata/input.4k",
13        "testdata/input.4k.fsv_meta",
14        "testdata/input.4k1",
15        "testdata/input.4k1.fsv_meta",
16        "testdata/input.4m",
17        "testdata/input.4m.fsv_meta",
18        "testdata/input.4m.fsv_meta.bad_merkle",
19    ],
20}
21
22java_genrule {
23    name: "authfs_test_apk_assets",
24    out: ["authfs_test_apk_assets.jar"],
25    tools: [
26        "fsverity_manifest_generator",
27        "fsverity",
28        "soong_zip",
29    ],
30    srcs: [
31        "testdata/input.4k",
32        "testdata/input.4k1",
33        "testdata/input.4m",
34    ],
35    /*
36     * Create a JAR file with an assets directory that can merge into the
37     * assets of an APK that depends on it in static_libs. Use this mechanism
38     * to load a generated fsverity manifest for the test input files into the
39     * test VM.
40     */
41    cmd: "mkdir -p $(genDir)/assets" +
42        "&& $(location fsverity_manifest_generator) " +
43        "    --fsverity-path $(location fsverity) " +
44        "    --base-dir $$(dirname $(in) | head -1) " +
45        "    --output $(genDir)/assets/input_manifest.pb " +
46        "    $(in) " +
47        "&& $(location soong_zip) -jar -o $(out) -C $(genDir) -D $(genDir)/assets",
48}
49