Log test life cycle for NativeDnsAsyncTest
Log the start time and the end time of each test to facilitate debugging the tests. Bug: 223731710 Test: atest CtsNativeNetDnsTestCases Change-Id: I104f2c1b70538a09740d00a4a662300a405b5c2e
This commit is contained in:
parent
f1aeb1051e
commit
389b354a83
2 changed files with 13 additions and 6 deletions
|
|
@ -24,6 +24,10 @@ cc_defaults {
|
|||
"liblog",
|
||||
"libutils",
|
||||
],
|
||||
static_libs: [
|
||||
"libbase",
|
||||
"libnetdutils",
|
||||
],
|
||||
// To be compatible with Q devices, the min_sdk_version must be 29.
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <android/multinetwork.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <netdutils/NetNativeTestBase.h>
|
||||
|
||||
namespace {
|
||||
constexpr int MAXPACKET = 8 * 1024;
|
||||
|
|
@ -101,7 +102,9 @@ void expectAnswersNotValid(int fd, int expectedErrno) {
|
|||
|
||||
} // namespace
|
||||
|
||||
TEST (NativeDnsAsyncTest, Async_Query) {
|
||||
class NativeDnsAsyncTest : public NetNativeTestBase {};
|
||||
|
||||
TEST_F(NativeDnsAsyncTest, Async_Query) {
|
||||
// V4
|
||||
int fd1 = android_res_nquery(
|
||||
NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
|
||||
|
|
@ -123,7 +126,7 @@ TEST (NativeDnsAsyncTest, Async_Query) {
|
|||
expectAnswersValid(fd1, AF_INET6, ns_r_noerror);
|
||||
}
|
||||
|
||||
TEST (NativeDnsAsyncTest, Async_Send) {
|
||||
TEST_F(NativeDnsAsyncTest, Async_Send) {
|
||||
// V4
|
||||
uint8_t buf1[MAXPACKET] = {};
|
||||
int len1 = res_mkquery(ns_o_query, "www.googleapis.com",
|
||||
|
|
@ -162,7 +165,7 @@ TEST (NativeDnsAsyncTest, Async_Send) {
|
|||
expectAnswersValid(fd1, AF_INET6, ns_r_noerror);
|
||||
}
|
||||
|
||||
TEST (NativeDnsAsyncTest, Async_NXDOMAIN) {
|
||||
TEST_F(NativeDnsAsyncTest, Async_NXDOMAIN) {
|
||||
uint8_t buf[MAXPACKET] = {};
|
||||
int len = res_mkquery(ns_o_query, "test1-nx.metric.gstatic.com",
|
||||
ns_c_in, ns_t_a, nullptr, 0, nullptr, buf, sizeof(buf));
|
||||
|
|
@ -191,7 +194,7 @@ TEST (NativeDnsAsyncTest, Async_NXDOMAIN) {
|
|||
expectAnswersValid(fd1, AF_INET6, ns_r_nxdomain);
|
||||
}
|
||||
|
||||
TEST (NativeDnsAsyncTest, Async_Cancel) {
|
||||
TEST_F(NativeDnsAsyncTest, Async_Cancel) {
|
||||
int fd = android_res_nquery(
|
||||
NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
|
||||
errno = 0;
|
||||
|
|
@ -202,7 +205,7 @@ TEST (NativeDnsAsyncTest, Async_Cancel) {
|
|||
// otherwise it will hit fdsan double-close fd.
|
||||
}
|
||||
|
||||
TEST (NativeDnsAsyncTest, Async_Query_MALFORMED) {
|
||||
TEST_F(NativeDnsAsyncTest, Async_Query_MALFORMED) {
|
||||
// Empty string to create BLOB and query, we will get empty result and rcode = 0
|
||||
// on DNSTLS.
|
||||
int fd = android_res_nquery(
|
||||
|
|
@ -221,7 +224,7 @@ TEST (NativeDnsAsyncTest, Async_Query_MALFORMED) {
|
|||
EXPECT_EQ(-EMSGSIZE, fd);
|
||||
}
|
||||
|
||||
TEST (NativeDnsAsyncTest, Async_Send_MALFORMED) {
|
||||
TEST_F(NativeDnsAsyncTest, Async_Send_MALFORMED) {
|
||||
uint8_t buf[10] = {};
|
||||
// empty BLOB
|
||||
int fd = android_res_nsend(NETWORK_UNSPECIFIED, buf, 10, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue