Add resolver flags to DNS query CTS tests
This is a following commit for cts of asynchronous DNS query API.
Change test path and adjust for the API changing.
Test: build
atest CtsNativeNetDnsTestCases
Change-Id: I7bc20a4d61293fc1d9e330250455709982639330
diff --git a/tests/cts/net/native/dns_async/Android.bp b/tests/cts/net/native/dns/Android.bp
similarity index 76%
rename from tests/cts/net/native/dns_async/Android.bp
rename to tests/cts/net/native/dns/Android.bp
index 2b9346f..9fbc3fc 100644
--- a/tests/cts/net/native/dns_async/Android.bp
+++ b/tests/cts/net/native/dns/Android.bp
@@ -7,15 +7,18 @@
"-Wall",
"-Wextra",
"-Werror",
- "-fno-builtin",
+ "-Wnullable-to-nonnull-conversion",
+ "-Wsign-compare",
+ "-Wthread-safety",
+ "-Wunused-parameter",
],
srcs: [
- "src/NativeDnsAsyncTest.cpp",
+ "NativeDnsAsyncTest.cpp",
],
shared_libs: [
+ "libandroid",
"liblog",
"libutils",
- "libandroid",
],
}
diff --git a/tests/cts/net/native/dns_async/AndroidTest.xml b/tests/cts/net/native/dns/AndroidTest.xml
similarity index 94%
rename from tests/cts/net/native/dns_async/AndroidTest.xml
rename to tests/cts/net/native/dns/AndroidTest.xml
index e092b36..e63c678 100644
--- a/tests/cts/net/native/dns_async/AndroidTest.xml
+++ b/tests/cts/net/native/dns/AndroidTest.xml
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Config for CTS Native Network dns_async test cases">
+<configuration description="Config for CTS Native Network dns test cases">
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="networking" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
diff --git a/tests/cts/net/native/dns_async/src/NativeDnsAsyncTest.cpp b/tests/cts/net/native/dns/NativeDnsAsyncTest.cpp
similarity index 93%
rename from tests/cts/net/native/dns_async/src/NativeDnsAsyncTest.cpp
rename to tests/cts/net/native/dns/NativeDnsAsyncTest.cpp
index 087eb5e..0d1fb15 100644
--- a/tests/cts/net/native/dns_async/src/NativeDnsAsyncTest.cpp
+++ b/tests/cts/net/native/dns/NativeDnsAsyncTest.cpp
@@ -92,12 +92,12 @@
TEST (NativeDnsAsyncTest, Async_Query) {
// V4
- int fd = android_res_nquery(NETWORK_UNSPECIFIED ,"www.google.com", ns_c_in, ns_t_a);
+ int fd = android_res_nquery(NETWORK_UNSPECIFIED ,"www.google.com", ns_c_in, ns_t_a, 0);
EXPECT_GT(fd, 0);
expectAnswersValid(fd, AF_INET, NOERROR);
// V6
- fd = android_res_nquery(NETWORK_UNSPECIFIED ,"www.google.com", ns_c_in, ns_t_aaaa);
+ fd = android_res_nquery(NETWORK_UNSPECIFIED ,"www.google.com", ns_c_in, ns_t_aaaa, 0);
EXPECT_GT(fd, 0);
expectAnswersValid(fd, AF_INET6, NOERROR);
}
@@ -108,7 +108,7 @@
int len = res_mkquery(QUERY, "www.youtube.com",
ns_c_in, ns_t_a, nullptr, 0, nullptr, buf, sizeof(buf));
EXPECT_GT(len, 0);
- int fd = android_res_nsend(NETWORK_UNSPECIFIED , buf, len);
+ int fd = android_res_nsend(NETWORK_UNSPECIFIED , buf, len, 0);
EXPECT_GT(fd, 0);
expectAnswersValid(fd, AF_INET, NOERROR);
@@ -117,7 +117,7 @@
len = res_mkquery(QUERY, "www.youtube.com",
ns_c_in, ns_t_aaaa, nullptr, 0, nullptr, buf, sizeof(buf));
EXPECT_GT(len, 0);
- fd = android_res_nsend(NETWORK_UNSPECIFIED , buf, len);
+ fd = android_res_nsend(NETWORK_UNSPECIFIED , buf, len, 0);
EXPECT_GT(fd, 0);
expectAnswersValid(fd, AF_INET6, NOERROR);
}
@@ -127,13 +127,13 @@
int len = res_mkquery(QUERY, "test-nx.metric.gstatic.com",
ns_c_in, ns_t_a, nullptr, 0, nullptr, buf, sizeof(buf));
EXPECT_GT(len, 0);
- int fd = android_res_nsend(NETWORK_UNSPECIFIED , buf, len);
+ int fd = android_res_nsend(NETWORK_UNSPECIFIED , buf, len, 0);
EXPECT_GT(fd, 0);
expectAnswersValid(fd, AF_INET, NXDOMAIN);
}
TEST (NativeDnsAsyncTest, Async_Cancel) {
- int fd = android_res_nquery(NETWORK_UNSPECIFIED ,"www.google.com", ns_c_in, ns_t_a);
+ int fd = android_res_nquery(NETWORK_UNSPECIFIED ,"www.google.com", ns_c_in, ns_t_a, 0);
int rcode = -1;
u_char buf[MAXPACKET] = {};
android_res_cancel(fd);