Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5870282 authored by Luke Huang's avatar Luke Huang
Browse files

Add doh_unit_test target

To prepare the doh test coverage.

Test: TH
Bug: 155855709
Change-Id: I7e0938c894a8733eaf13b90a5b8b45ebc6eab6e2
Merged-In: I616933251aec49c60c850198c0594861009c2bb8
parent 72799f37
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -359,3 +359,25 @@ cc_test {
    ],
    min_sdk_version: "29",
}

rust_test {
    name: "doh_unit_test",
    enabled: support_rust_toolchain,
    crate_name: "doh",
    srcs: ["doh.rs"],
    edition: "2018",
    test_suites: ["general-tests"],
    auto_gen_config: true,
    rustlibs: [
        "libandroid_logger",
        "libanyhow",
        "liblazy_static",
        "liblibc",
        "liblog_rust",
        "libquiche",
        "libring",
        "libtokio",
        "liburl",
    ],
    min_sdk_version: "29",
}
+11 −0
Original line number Diff line number Diff line
@@ -472,3 +472,14 @@ pub unsafe extern "C" fn doh_query(
        }
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn doh_init() {
        unsafe {
            // Safety: the returned pointer from doh_init() must be a null terminated string.
            assert_eq!(std::ffi::CStr::from_ptr(super::doh_init()).to_str().unwrap(), "1.0");
        }
    }
}