ares-test.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 #ifndef ARES_TEST_H
3 #define ARES_TEST_H
4 
5 #include "ares_setup.h"
6 #include "ares.h"
7 
8 #include "dns-proto.h"
9 // Include ares internal file for DNS protocol constants
10 #include "ares_nameser.h"
11 
12 #include "gtest/gtest.h"
13 #include "gmock/gmock.h"
14 
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 #if defined(HAVE_USER_NAMESPACE) && defined(HAVE_UTS_NAMESPACE)
19 #define HAVE_CONTAINER
20 #endif
21 
22 #include <functional>
23 #include <list>
24 #include <map>
25 #include <memory>
26 #include <set>
27 #include <string>
28 #include <utility>
29 #include <vector>
30 
31 namespace ares {
32 
33 typedef unsigned char byte;
34 
35 namespace test {
36 
37 extern bool verbose;
38 extern int mock_port;
39 extern const std::vector<int> both_families;
40 extern const std::vector<int> ipv4_family;
41 extern const std::vector<int> ipv6_family;
42 
43 extern const std::vector<std::pair<int, bool>> both_families_both_modes;
44 extern const std::vector<std::pair<int, bool>> ipv4_family_both_modes;
45 extern const std::vector<std::pair<int, bool>> ipv6_family_both_modes;
46 
47 // Which parameters to use in tests
48 extern std::vector<int> families;
49 extern std::vector<std::pair<int, bool>> families_modes;
50 
51 // Process all pending work on ares-owned file descriptors, plus
52 // optionally the given set-of-FDs + work function.
54  std::function<std::set<int>()> get_extrafds,
55  std::function<void(int)> process_extra);
56 std::set<int> NoExtraFDs();
57 
58 // Test fixture that ensures library initialization, and allows
59 // memory allocations to be failed.
60 class LibraryTest : public ::testing::Test {
61  public:
68  }
71  ClearFails();
72  }
73  // Set the n-th malloc call (of any size) from the library to fail.
74  // (nth == 1 means the next call)
75  static void SetAllocFail(int nth);
76  // Set the next malloc call for the given size to fail.
77  static void SetAllocSizeFail(size_t size);
78  // Remove any pending alloc failures.
79  static void ClearFails();
80 
81  static void *amalloc(size_t size);
82  static void* arealloc(void *ptr, size_t size);
83  static void afree(void *ptr);
84  private:
85  static bool ShouldAllocFail(size_t size);
86  static unsigned long long fails_;
87  static std::map<size_t, int> size_fails_;
88 };
89 
90 // Test fixture that uses a default channel.
92  public:
95  EXPECT_NE(nullptr, channel_);
96  }
97 
100  channel_ = nullptr;
101  }
102 
103  // Process all pending work on ares-owned file descriptors.
104  void Process();
105 
106  protected:
108 };
109 
110 // Test fixture that uses a default channel with the specified lookup mode.
112  : public LibraryTest,
113  public ::testing::WithParamInterface<std::string> {
114  public:
116  struct ares_options opts = {0};
117  opts.lookups = strdup(GetParam().c_str());
118  int optmask = ARES_OPT_LOOKUPS;
120  EXPECT_NE(nullptr, channel_);
121  free(opts.lookups);
122  }
123 
126  channel_ = nullptr;
127  }
128 
129  // Process all pending work on ares-owned file descriptors.
130  void Process();
131 
132  protected:
134 };
135 
136 // Mock DNS server to allow responses to be scripted by tests.
137 class MockServer {
138  public:
139  MockServer(int family, int port);
140  ~MockServer();
141 
142  // Mock method indicating the processing of a particular <name, RRtype>
143  // request.
144  MOCK_METHOD2(OnRequest, void(const std::string& name, int rrtype));
145 
146  // Set the reply to be sent next; the query ID field will be overwritten
147  // with the value from the request.
148  void SetReplyData(const std::vector<byte>& reply) { reply_ = reply; }
149  void SetReply(const DNSPacket* reply) { SetReplyData(reply->data()); }
150  void SetReplyQID(int qid) { qid_ = qid; }
151 
152  // The set of file descriptors that the server handles.
153  std::set<int> fds() const;
154 
155  // Process activity on a file descriptor.
156  void ProcessFD(int fd);
157 
158  // Ports the server is responding to
159  int udpport() const { return udpport_; }
160  int tcpport() const { return tcpport_; }
161 
162  private:
163  void ProcessRequest(int fd, struct sockaddr_storage* addr, int addrlen,
164  int qid, const std::string& name, int rrtype);
165 
166  int udpport_;
167  int tcpport_;
168  int udpfd_;
169  int tcpfd_;
170  std::set<int> connfds_;
171  std::vector<byte> reply_;
172  int qid_;
173 };
174 
175 // Test fixture that uses a mock DNS server.
177  public:
178  MockChannelOptsTest(int count, int family, bool force_tcp, struct ares_options* givenopts, int optmask);
180 
181  // Process all pending work on ares-owned and mock-server-owned file descriptors.
182  void Process();
183 
184  protected:
185  // NiceMockServer doesn't complain about uninteresting calls.
187  typedef std::vector< std::unique_ptr<NiceMockServer> > NiceMockServers;
188 
189  std::set<int> fds() const;
190  void ProcessFD(int fd);
191 
192  static NiceMockServers BuildServers(int count, int family, int base_port);
193 
195  // Convenience reference to first server.
198 };
199 
201  : public MockChannelOptsTest,
202  public ::testing::WithParamInterface< std::pair<int, bool> > {
203  public:
205 };
206 
208  : public MockChannelOptsTest,
209  public ::testing::WithParamInterface<int> {
210  public:
212 };
213 
215  : public MockChannelOptsTest,
216  public ::testing::WithParamInterface<int> {
217  public:
219 };
220 
221 // gMock action to set the reply for a mock server.
222 ACTION_P2(SetReplyData, mockserver, data) {
223  mockserver->SetReplyData(data);
224 }
225 ACTION_P2(SetReply, mockserver, reply) {
226  mockserver->SetReply(reply);
227 }
228 ACTION_P2(SetReplyQID, mockserver, qid) {
229  mockserver->SetReplyQID(qid);
230 }
231 // gMock action to cancel a channel.
232 ACTION_P2(CancelChannel, mockserver, channel) {
234 }
235 
236 // C++ wrapper for struct hostent.
237 struct HostEnt {
238  HostEnt() : addrtype_(-1) {}
239  HostEnt(const struct hostent* hostent);
241  std::vector<std::string> aliases_;
242  int addrtype_; // AF_INET or AF_INET6
243  std::vector<std::string> addrs_;
244 };
245 std::ostream& operator<<(std::ostream& os, const HostEnt& result);
246 
247 // Structure that describes the result of an ares_host_callback invocation.
248 struct HostResult {
249  // Whether the callback has been invoked.
250  bool done_;
251  // Explicitly provided result information.
252  int status_;
254  // Contents of the hostent structure, if provided.
256 };
257 std::ostream& operator<<(std::ostream& os, const HostResult& result);
258 
259 // Structure that describes the result of an ares_callback invocation.
260 struct SearchResult {
261  // Whether the callback has been invoked.
262  bool done_;
263  // Explicitly provided result information.
264  int status_;
266  std::vector<byte> data_;
267 };
268 std::ostream& operator<<(std::ostream& os, const SearchResult& result);
269 
270 // Structure that describes the result of an ares_nameinfo_callback invocation.
272  // Whether the callback has been invoked.
273  bool done_;
274  // Explicitly provided result information.
275  int status_;
279 };
280 std::ostream& operator<<(std::ostream& os, const NameInfoResult& result);
281 
284  if (ptr) ares_freeaddrinfo(ptr);
285  }
286 };
287 
288 // C++ wrapper for struct ares_addrinfo.
289 using AddrInfo = std::unique_ptr<ares_addrinfo, AddrInfoDeleter>;
290 
291 std::ostream& operator<<(std::ostream& os, const AddrInfo& result);
292 
293 // Structure that describes the result of an ares_addrinfo_callback invocation.
296  // Whether the callback has been invoked.
297  bool done_;
298  // Explicitly provided result information.
299  int status_;
301  // Contents of the ares_addrinfo structure, if provided.
303 };
304 std::ostream& operator<<(std::ostream& os, const AddrInfoResult& result);
305 
306 // Standard implementation of ares callbacks that fill out the corresponding
307 // structures.
308 void HostCallback(void *data, int status, int timeouts,
309  struct hostent *hostent);
310 void SearchCallback(void *data, int status, int timeouts,
311  unsigned char *abuf, int alen);
312 void NameInfoCallback(void *data, int status, int timeouts,
313  char *node, char *service);
314 void AddrInfoCallback(void *data, int status, int timeouts,
315  struct ares_addrinfo *res);
316 
317 // Retrieve the name servers used by a channel.
318 std::vector<std::string> GetNameServers(ares_channel channel);
319 
320 
321 // RAII class to temporarily create a directory of a given name.
323  public:
324  TransientDir(const std::string& dirname);
325  ~TransientDir();
326 
327  private:
329 };
330 
331 // C++ wrapper around tempnam()
332 std::string TempNam(const char *dir, const char *prefix);
333 
334 // RAII class to temporarily create file of a given name and contents.
336  public:
338  ~TransientFile();
339 
340  protected:
342 };
343 
344 // RAII class for a temporary file with the given contents.
345 class TempFile : public TransientFile {
346  public:
347  TempFile(const std::string& contents);
348  const char* filename() const { return filename_.c_str(); }
349 };
350 
351 #ifdef _WIN32
352 extern "C" {
353 
354 static int setenv(const char *name, const char *value, int overwrite)
355 {
356  char *buffer;
357  size_t buf_size;
358 
359  if (name == NULL)
360  return -1;
361 
362  if (value == NULL)
363  value = ""; /* For unset */
364 
365  if (!overwrite && getenv(name) != NULL) {
366  return -1;
367  }
368 
369  buf_size = strlen(name) + strlen(value) + 1 /* = */ + 1 /* NULL */;
370  buffer = (char *)malloc(buf_size);
371  _snprintf(buffer, buf_size, "%s=%s", name, value);
372  _putenv(buffer);
373  free(buffer);
374  return 0;
375 }
376 
377 static int unsetenv(const char *name)
378 {
379  return setenv(name, NULL, 1);
380 }
381 
382 } /* extern "C" */
383 #endif
384 
385 // RAII class for a temporary environment variable value.
386 class EnvValue {
387  public:
388  EnvValue(const char *name, const char *value) : name_(name), restore_(false) {
389  char *original = getenv(name);
390  if (original) {
391  restore_ = true;
392  original_ = original;
393  }
394  setenv(name_.c_str(), value, 1);
395  }
397  if (restore_) {
398  setenv(name_.c_str(), original_.c_str(), 1);
399  } else {
400  unsetenv(name_.c_str());
401  }
402  }
403  private:
405  bool restore_;
407 };
408 
409 
410 #ifdef HAVE_CONTAINER
411 // Linux-specific functionality for running code in a container, implemented
412 // in ares-test-ns.cc
413 typedef std::function<int(void)> VoidToIntFn;
414 typedef std::vector<std::pair<std::string, std::string>> NameContentList;
415 
416 class ContainerFilesystem {
417  public:
418  ContainerFilesystem(NameContentList files, const std::string& mountpt);
419  ~ContainerFilesystem();
420  std::string root() const { return rootdir_; };
421  std::string mountpt() const { return mountpt_; };
422  private:
423  void EnsureDirExists(const std::string& dir);
424  std::string rootdir_;
425  std::string mountpt_;
426  std::list<std::string> dirs_;
427  std::vector<std::unique_ptr<TransientFile>> files_;
428 };
429 
430 int RunInContainer(ContainerFilesystem* fs, const std::string& hostname,
431  const std::string& domainname, VoidToIntFn fn);
432 
433 #define ICLASS_NAME(casename, testname) Contained##casename##_##testname
434 #define CONTAINED_TEST_F(casename, testname, hostname, domainname, files) \
435  class ICLASS_NAME(casename, testname) : public casename { \
436  public: \
437  ICLASS_NAME(casename, testname)() {} \
438  static int InnerTestBody(); \
439  }; \
440  TEST_F(ICLASS_NAME(casename, testname), _) { \
441  ContainerFilesystem chroot(files, ".."); \
442  VoidToIntFn fn(ICLASS_NAME(casename, testname)::InnerTestBody); \
443  EXPECT_EQ(0, RunInContainer(&chroot, hostname, domainname, fn)); \
444  } \
445  int ICLASS_NAME(casename, testname)::InnerTestBody()
446 
447 #endif
448 
449 /* Assigns virtual IO functions to a channel. These functions simply call
450  * the actual system functions.
451  */
452 class VirtualizeIO {
453 public:
455  ~VirtualizeIO();
456 
458 private:
460 };
461 
462 /*
463  * Slightly white-box macro to generate two runs for a given test case:
464  * One with no modifications, and one with all IO functions set to use
465  * the virtual io structure.
466  * Since no magic socket setup or anything is done in the latter case
467  * this should probably only be used for test with very vanilla IO
468  * requirements.
469  */
470 #define VCLASS_NAME(casename, testname) Virt##casename##_##testname
471 #define VIRT_NONVIRT_TEST_F(casename, testname) \
472  class VCLASS_NAME(casename, testname) : public casename { \
473  public: \
474  VCLASS_NAME(casename, testname)() {} \
475  void InnerTestBody(); \
476  }; \
477  GTEST_TEST_(casename, testname, VCLASS_NAME(casename, testname), \
478  ::testing::internal::GetTypeId<casename>()) { \
479  InnerTestBody(); \
480  } \
481  GTEST_TEST_(casename, testname##_virtualized, \
482  VCLASS_NAME(casename, testname), \
483  ::testing::internal::GetTypeId<casename>()) { \
484  VirtualizeIO vio(channel_); \
485  InnerTestBody(); \
486  } \
487  void VCLASS_NAME(casename, testname)::InnerTestBody()
488 
489 } // namespace test
490 } // namespace ares
491 
492 #endif
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
ares::test::NameInfoResult::done_
bool done_
Definition: ares-test.h:273
ares::test::LibraryTest::ClearFails
static void ClearFails()
Definition: ares-test.cc:121
ares::test::ACTION_P2
ACTION_P2(SetReplyData, mockserver, data)
Definition: ares-test.h:222
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
ares::test::MockUDPChannelTest
Definition: ares-test.h:207
filename
const char * filename
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
ares::DNSPacket
Definition: dns-proto.h:188
ares::test::both_families
const std::vector< int > both_families
Definition: ares-test.cc:38
ares::test::DefaultChannelTest::Process
void Process()
Definition: ares-test.cc:167
testing::WithParamInterface
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1848
ares::test::VirtualizeIO::default_functions
static const ares_socket_functions default_functions
Definition: ares-test.h:457
ares::test::MockChannelOptsTest::fds
std::set< int > fds() const
Definition: ares-test.cc:516
ares_options
Definition: ares.h:259
ares::test::AddrInfoResult
Definition: ares-test.h:294
ares::test::LibraryTest::afree
static void afree(void *ptr)
Definition: ares-test.cc:159
ares::test::SearchResult::status_
int status_
Definition: ares-test.h:264
ares_addrinfo
Definition: ares.h:616
ares::test::AddrInfo
std::unique_ptr< ares_addrinfo, AddrInfoDeleter > AddrInfo
Definition: ares-test.h:289
ares::test::VirtualizeIO::channel_
ares_channel channel_
Definition: ares-test.h:459
ares::test::MockServer::SetReplyData
void SetReplyData(const std::vector< byte > &reply)
Definition: ares-test.h:148
ares::test::NameInfoResult::timeouts_
int timeouts_
Definition: ares-test.h:276
ares::test::LibraryTest::SetAllocFail
static void SetAllocFail(int nth)
Definition: ares-test.cc:109
ares::test::MockUDPChannelTest::MockUDPChannelTest
MockUDPChannelTest()
Definition: ares-test.h:211
false
#define false
Definition: setup_once.h:323
ares.h
ares::test::ipv6_family
const std::vector< int > ipv6_family
Definition: ares-test.cc:40
ares::test::both_families_both_modes
const std::vector< std::pair< int, bool > > both_families_both_modes
Definition: ares-test.cc:42
test
Definition: spinlock_test.cc:36
ares::test::LibraryTest::SetAllocSizeFail
static void SetAllocSizeFail(size_t size)
Definition: ares-test.cc:116
ares::test::MockChannelOptsTest::NiceMockServers
std::vector< std::unique_ptr< NiceMockServer > > NiceMockServers
Definition: ares-test.h:187
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
ares_init
CARES_EXTERN int ares_init(ares_channel *channelptr)
Definition: ares_init.c:98
ares::test::TempFile::filename
const char * filename() const
Definition: ares-test.h:348
cstest_report.opts
opts
Definition: cstest_report.py:81
ares::test::MockServer::udpfd_
int udpfd_
Definition: ares-test.h:168
files_
std::map< std::string, std::unique_ptr< std::string > > files_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc:123
status
absl::Status status
Definition: rls.cc:251
ARES_LIB_INIT_ALL
#define ARES_LIB_INIT_ALL
Definition: ares.h:217
ares::test::HostResult::status_
int status_
Definition: ares-test.h:252
setup.name
name
Definition: setup.py:542
ares::test::MockChannelOptsTest::servers_
NiceMockServers servers_
Definition: ares-test.h:194
ares::test::DefaultChannelTest::DefaultChannelTest
DefaultChannelTest()
Definition: ares-test.h:93
second
StrT second
Definition: cxa_demangle.cpp:4885
ares::test::MockChannelTest::MockChannelTest
MockChannelTest()
Definition: ares-test.h:204
ares::test::MockServer::tcpfd_
int tcpfd_
Definition: ares-test.h:169
ares::test::HostResult::host_
HostEnt host_
Definition: ares-test.h:255
ares::test::DefaultChannelModeTest::Process
void Process()
Definition: ares-test.cc:171
true
#define true
Definition: setup_once.h:324
testing::Test
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:402
ares::test::MockServer::ProcessRequest
void ProcessRequest(int fd, struct sockaddr_storage *addr, int addrlen, int qid, const std::string &name, int rrtype)
Definition: ares-test.cc:371
ares::test::families
std::vector< int > families
Definition: ares-test.cc:58
ARES_OPT_LOOKUPS
#define ARES_OPT_LOOKUPS
Definition: ares.h:161
ares::test::MockChannelOptsTest::MockChannelOptsTest
MockChannelOptsTest(int count, int family, bool force_tcp, struct ares_options *givenopts, int optmask)
Definition: ares-test.cc:424
ares::test::MockServer
Definition: ares-test.h:137
ares::test::MockServer::udpport
int udpport() const
Definition: ares-test.h:159
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
testing::NiceMock
Definition: bloaty/third_party/googletest/googlemock/include/gmock/gmock-nice-strict.h:72
ares::test::TempFile::TempFile
TempFile(const std::string &contents)
Definition: ares-test.cc:790
ares::test::EnvValue::name_
std::string name_
Definition: ares-test.h:404
ares::test::MockChannelOptsTest::~MockChannelOptsTest
~MockChannelOptsTest()
Definition: ares-test.cc:509
ares::test::LibraryTest::~LibraryTest
~LibraryTest()
Definition: ares-test.h:69
ares::test::HostResult::done_
bool done_
Definition: ares-test.h:250
ares::test::MockServer::udpport_
int udpport_
Definition: ares-test.h:166
ares::test::mock_port
int mock_port
Definition: ares-test.cc:36
ares_library_init_mem
CARES_EXTERN int ares_library_init_mem(int flags, void *(*amalloc)(size_t size), void(*afree)(void *ptr), void *(*arealloc)(void *ptr, size_t size))
Definition: ares_library_init.c:156
ares::test::SearchResult::done_
bool done_
Definition: ares-test.h:262
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
xds_interop_client.int
int
Definition: xds_interop_client.py:113
ares_cancel
CARES_EXTERN void ares_cancel(ares_channel channel)
Definition: ares_cancel.c:26
ares::test::MockChannelOptsTest::Process
void Process()
Definition: ares-test.cc:531
ares::test::TransientFile::filename_
std::string filename_
Definition: ares-test.h:341
generate-asm-lcov.fn
fn
Definition: generate-asm-lcov.py:146
ares::test::AddrInfoDeleter::operator()
void operator()(ares_addrinfo *ptr)
Definition: ares-test.h:283
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
root
RefCountedPtr< grpc_tls_certificate_provider > root
Definition: xds_server_config_fetcher.cc:223
ares::test::TransientDir
Definition: ares-test.h:322
EXPECT_NE
#define EXPECT_NE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2028
ares::test::LibraryTest::LibraryTest
LibraryTest()
Definition: ares-test.h:62
ares::test::MockTCPChannelTest::MockTCPChannelTest
MockTCPChannelTest()
Definition: ares-test.h:218
ares::test::MockChannelOptsTest::server_
NiceMockServer & server_
Definition: ares-test.h:196
ares::test::TransientDir::~TransientDir
~TransientDir()
Definition: ares-test.cc:760
ares::test::MockServer::reply_
std::vector< byte > reply_
Definition: ares-test.h:171
update_clang.EnsureDirExists
def EnsureDirExists(path)
Definition: update_clang.py:86
ares::test::MockChannelOptsTest::NiceMockServer
testing::NiceMock< MockServer > NiceMockServer
Definition: ares-test.h:186
ares::test::EnvValue
Definition: ares-test.h:386
ares::test::EnvValue::restore_
bool restore_
Definition: ares-test.h:405
ares::test::MockChannelOptsTest::BuildServers
static NiceMockServers BuildServers(int count, int family, int base_port)
Definition: ares-test.cc:413
ares::test::verbose
bool verbose
Definition: ares-test.cc:34
ares::test::SearchCallback
void SearchCallback(void *data, int status, int timeouts, unsigned char *abuf, int alen)
Definition: ares-test.cc:686
ares::test::NameInfoResult
Definition: ares-test.h:271
ares::test::MockTCPChannelTest
Definition: ares-test.h:214
ares::test::EnvValue::original_
std::string original_
Definition: ares-test.h:406
ares::DNSPacket::data
std::vector< byte > data() const
Definition: dns-proto.cc:592
ares::test::DefaultChannelModeTest::channel_
ares_channel channel_
Definition: ares-test.h:133
ares::test::NameInfoResult::status_
int status_
Definition: ares-test.h:275
ares::test::TempNam
std::string TempNam(const char *dir, const char *prefix)
Definition: ares-test.cc:783
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
ares::test::EnvValue::~EnvValue
~EnvValue()
Definition: ares-test.h:396
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
ares::test::operator<<
std::ostream & operator<<(std::ostream &os, const HostResult &result)
Definition: ares-test.cc:538
ares::test::SearchResult::data_
std::vector< byte > data_
Definition: ares-test.h:266
ares::test::HostEnt::name_
std::string name_
Definition: ares-test.h:240
ARES_SUCCESS
#define ARES_SUCCESS
Definition: ares.h:98
ares::test::EnvValue::EnvValue
EnvValue(const char *name, const char *value)
Definition: ares-test.h:388
ares::test::AddrInfoResult::AddrInfoResult
AddrInfoResult()
Definition: ares-test.h:295
ares_setup.h
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
ares::test::LibraryTest::fails_
static unsigned long long fails_
Definition: ares-test.h:86
ares::test::MockServer::connfds_
std::set< int > connfds_
Definition: ares-test.h:170
ares::test::HostEnt
Definition: ares-test.h:237
value
const char * value
Definition: hpack_parser_table.cc:165
ares::test::DefaultChannelTest
Definition: ares-test.h:91
ares::test::HostEnt::HostEnt
HostEnt()
Definition: ares-test.h:238
ares::test::HostEnt::aliases_
std::vector< std::string > aliases_
Definition: ares-test.h:241
ares::byte
unsigned char byte
Definition: ares-test.h:33
contents
string_view contents
Definition: elf.cc:597
ares_channeldata
Definition: ares_private.h:266
ares::test::HostCallback
void HostCallback(void *data, int status, int timeouts, struct hostent *hostent)
Definition: ares-test.cc:591
ares::test::MockServer::SetReply
void SetReply(const DNSPacket *reply)
Definition: ares-test.h:149
ares::test::LibraryTest::ShouldAllocFail
static bool ShouldAllocFail(size_t size)
Definition: ares-test.cc:128
ares::test::MockServer::~MockServer
~MockServer()
Definition: ares-test.cc:257
ares_freeaddrinfo
CARES_EXTERN void ares_freeaddrinfo(struct ares_addrinfo *ai)
Definition: ares_freeaddrinfo.c:52
ares::test::VirtualizeIO::~VirtualizeIO
~VirtualizeIO()
Definition: ares-test.cc:801
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
ares::test::families_modes
std::vector< std::pair< int, bool > > families_modes
Definition: ares-test.cc:59
ares::test::ipv4_family
const std::vector< int > ipv4_family
Definition: ares-test.cc:39
ares_library_cleanup
CARES_EXTERN void ares_library_cleanup(void)
Definition: ares_library_init.c:171
ares::test::AddrInfoResult::timeouts_
int timeouts_
Definition: ares-test.h:300
ares::test::NameInfoCallback
void NameInfoCallback(void *data, int status, int timeouts, char *node, char *service)
Definition: ares-test.cc:708
ares_destroy
CARES_EXTERN void ares_destroy(ares_channel channel)
Definition: ares_destroy.c:43
ares::test::NameInfoResult::service_
std::string service_
Definition: ares-test.h:278
ares::test::TransientDir::TransientDir
TransientDir(const std::string &dirname)
Definition: ares-test.cc:754
ares::test::DefaultChannelTest::channel_
ares_channel channel_
Definition: ares-test.h:107
ares::test::MockServer::MockServer
MockServer(int family, int port)
Definition: ares-test.cc:175
first
StrT first
Definition: cxa_demangle.cpp:4884
ares::test::ipv4_family_both_modes
const std::vector< std::pair< int, bool > > ipv4_family_both_modes
Definition: ares-test.cc:48
ares::test::AddrInfoResult::ai_
AddrInfo ai_
Definition: ares-test.h:302
ares::test::LibraryTest::arealloc
static void * arealloc(void *ptr, size_t size)
Definition: ares-test.cc:149
prefix
static const char prefix[]
Definition: head_of_line_blocking.cc:28
testing::WithParamInterface< std::string >::GetParam
static const ParamType & GetParam()
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1855
ares::test::DefaultChannelModeTest::DefaultChannelModeTest
DefaultChannelModeTest()
Definition: ares-test.h:115
ares::test::DefaultChannelModeTest::~DefaultChannelModeTest
~DefaultChannelModeTest()
Definition: ares-test.h:124
ares::test::SearchResult::timeouts_
int timeouts_
Definition: ares-test.h:265
ares::test::HostEnt::addrtype_
int addrtype_
Definition: ares-test.h:242
ares::test::DefaultChannelTest::~DefaultChannelTest
~DefaultChannelTest()
Definition: ares-test.h:98
ares::test::VirtualizeIO::VirtualizeIO
VirtualizeIO(ares_channel)
Definition: ares-test.cc:795
ares::test::MockServer::MOCK_METHOD2
MOCK_METHOD2(OnRequest, void(const std::string &name, int rrtype))
ares::test::SearchResult
Definition: ares-test.h:260
ares::test::NoExtraFDs
std::set< int > NoExtraFDs()
Definition: ares-test.cc:163
ares::test::MockServer::tcpport_
int tcpport_
Definition: ares-test.h:167
ares::test::ProcessWork
void ProcessWork(ares_channel channel, std::function< std::set< int >()> get_extrafds, std::function< void(int)> process_extra)
Definition: ares-test.cc:64
ares::test::TempFile
Definition: ares-test.h:345
ares::test::HostResult
Definition: ares-test.h:248
ares::test::TransientFile
Definition: ares-test.h:335
ares::test::MockChannelOptsTest::channel_
ares_channel channel_
Definition: ares-test.h:197
ares::test::LibraryTest::amalloc
static void * amalloc(size_t size)
Definition: ares-test.cc:139
ares::test::LibraryTest::size_fails_
static std::map< size_t, int > size_fails_
Definition: ares-test.h:87
ares::test::MockChannelTest
Definition: ares-test.h:200
ares::test::MockChannelOptsTest
Definition: ares-test.h:176
ares_init_options
CARES_EXTERN int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask)
Definition: ares_init.c:103
ares::test::AddrInfoResult::done_
bool done_
Definition: ares-test.h:297
ares::test::MockServer::SetReplyQID
void SetReplyQID(int qid)
Definition: ares-test.h:150
ares::test::MockServer::fds
std::set< int > fds() const
Definition: ares-test.cc:364
service
__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod NSString * service
Definition: ProtoMethod.h:25
ares_nameser.h
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
ares::test::AddrInfoResult::status_
int status_
Definition: ares-test.h:299
ares::test::MockServer::ProcessFD
void ProcessFD(int fd)
Definition: ares-test.cc:265
ares::test::HostEnt::addrs_
std::vector< std::string > addrs_
Definition: ares-test.h:243
ares::test::DefaultChannelModeTest
Definition: ares-test.h:111
ares::test::MockServer::qid_
int qid_
Definition: ares-test.h:172
getenv
#define getenv(ptr)
Definition: ares_private.h:106
ares::test::AddrInfoDeleter
Definition: ares-test.h:282
ares::test::AddrInfoCallback
void AddrInfoCallback(void *data, int status, int timeouts, struct ares_addrinfo *ai)
Definition: ares-test.cc:664
amalgamate.files
list files
Definition: amalgamate.py:115
ares::test::GetNameServers
std::vector< std::string > GetNameServers(ares_channel channel)
Definition: ares-test.cc:720
ares::test::TransientFile::TransientFile
TransientFile(const std::string &filename, const std::string &contents)
Definition: ares-test.cc:764
ares::test::TransientDir::dirname_
std::string dirname_
Definition: ares-test.h:328
addr
struct sockaddr_in addr
Definition: libuv/docs/code/tcp-echo-server/main.c:10
ares::test::HostResult::timeouts_
int timeouts_
Definition: ares-test.h:253
ares::test::TransientFile::~TransientFile
~TransientFile()
Definition: ares-test.cc:779
ares
Definition: ares-test-ai.h:9
ares::test::NameInfoResult::node_
std::string node_
Definition: ares-test.h:277
ares::test::LibraryTest
Definition: ares-test.h:60
ares::test::ipv6_family_both_modes
const std::vector< std::pair< int, bool > > ipv6_family_both_modes
Definition: ares-test.cc:52
ares::test::MockChannelOptsTest::ProcessFD
void ProcessFD(int fd)
Definition: ares-test.cc:525
ares::test::MockServer::tcpport
int tcpport() const
Definition: ares-test.h:160
strdup
#define strdup(ptr)
Definition: acountry.c:55
ares_socket_functions
Definition: ares.h:401
dns-proto.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:43