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

Commit 03269664 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

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

Change-Id: Ib3ebaf7963aefcc45a5214600dd458aea3e571c6
(cherry picked from commit 4f6c1643)
Merged-In: Ib3ebaf7963aefcc45a5214600dd458aea3e571c6
Ignore-AOSP-First: To solve the confict between mainline-prod and other branches with newer toolchain.
(cherry picked from commit 744f7c2e)
parent b2d65d40
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -359,3 +359,25 @@ filegroup {
//     ],
//     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");
        }
    }
}