<commit_before>/*
 *
 *    Copyright (c) 2013-2017 <NAME>, Inc.
 *    All rights reserved.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

/**
 *    @file
 *      This file tests DNS resolution using the InetLayer APIs.
 *
 */

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif

#include <stdint.h>
#include <string.h>
#include <unistd.h>

#include "ToolCommon.h"
#include <nlunit-test.h>
#include <SystemLayer/SystemClock.h>
#include <SystemLayer/SystemTimer.h>

#if INET_CONFIG_ENABLE_DNS_RESOLVER

using namespace nl::Inet;

#define TOOL_NAME "TestDNSResolution"
#define DEFAULT_TEST_DURATION_MILLISECS               (10000)
#define DEFAULT_CANCEL_TEST_DURATION_MILLISECS        (2000)

static uint32_t sNumResInProgress = 0;
constexpr uint8_t kMaxResults = 20;

struct DNSResolutionTestCase
{
    const char * hostName;
    uint8_t dnsOptions;
    uint8_t maxResults;
    INET_ERROR expectErr;
    bool expectIPv4Addrs;
    bool expectIPv6Addrs;
};

struct DNSResolutionTestContext
{
    nlTestSuite * testSuite;<commit_msg>Double the timeout to address an issue where TestDNSResolution experiences a timeout when running against Ubuntu 18 on a VMware Fusion 11 virtual machine with NAT networking.<commit_after>/*
 *
 *    Copyright (c) 2013-2017 <NAME>, Inc.
 *    All rights reserved.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

/**
 *    @file
 *      This file tests DNS resolution using the InetLayer APIs.
 *
 */

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif

#include <stdint.h>
#include <string.h>
#include <unistd.h>

#include "ToolCommon.h"
#include <nlunit-test.h>
#include <SystemLayer/SystemClock.h>
#include <SystemLayer/SystemTimer.h>

#if INET_CONFIG_ENABLE_DNS_RESOLVER

using namespace nl::Inet;

#define TOOL_NAME "TestDNSResolution"
#define DEFAULT_TEST_DURATION_MILLISECS               (20000)
#define DEFAULT_CANCEL_TEST_DURATION_MILLISECS        (2000)

static uint32_t sNumResInProgress = 0;
constexpr uint8_t kMaxResults = 20;

struct DNSResolutionTestCase
{
    const char * hostName;
    uint8_t dnsOptions;
    uint8_t maxResults;
    INET_ERROR expectErr;
    bool expectIPv4Addrs;
    bool expectIPv6Addrs;
};

struct DNSResolutionTestContext
{
    nlTestSuite * testSuite;
{'fraction_non_alphanumeric': 0.07724676886083559, 'fraction_numerical': 0.019837691614066726, 'mean_word_length': 3.727272727272727, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5198703', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1045, 'n_words': 339}