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

Commit 312a132b authored by Luke Huang's avatar Luke Huang Committed by Automerger Merge Worker
Browse files

Merge "Add doh_unit_test target" into sc-dev am: c41a12fd

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/DnsResolver/+/14185043

Change-Id: I0ef6ce435e6011e77b5929af4ff767ea08057082
parents 06c33904 c41a12fd
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -362,3 +362,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");
        }
    }
}