Commit Graph

53 Commits

Author SHA1 Message Date
Carsten Larsen 2811e30d49 Release 1.12.0 2017-04-12 01:21:06 +02:00
David Drysdale 3b1ff9da74 test: Build with MinGW on AppVeyor 2016-03-03 13:57:45 +00:00
David Drysdale 23b9ad9ede test: avoid in6addr_* constants
These aren't available on MinGW, so use explicit addresses instead.
2016-03-03 13:57:16 +00:00
David Drysdale 6917640336 test: add missing #includes for dns-proto.cc 2016-03-03 13:57:16 +00:00
David Drysdale 5b46450af4 test: prefer ON_CALL to EXPECT_CALL to reduce flakes
For UDP tests, there's a chance of a retry.  EXPECT_CALL only
expects a single request to arrive at the server; ON_CALL allows
for a UDP retry and repeats the same answer.

Note that ON_CALL and EXPECT_CALL can't be mixed in the same
test, and that tests that have a varied sequence of responses
for the same repeated request still have to use EXPECT_CALL.
2016-02-13 10:07:19 +00:00
Daniel Stenberg f0d04b2909 test/configure: build silently by default 2016-02-13 10:56:28 +01:00
David Drysdale 7e17c22b0f Use "resolve" as synonym of "dns" in nsswitch.conf
Modern Linux systems may have libnss_resolve from systemd as the
resolver, which is then configured in /etc/nsswitch.conf with
the "resolve" keyword rather than "dns".

Fixes #33
2016-02-11 11:14:40 +00:00
David Drysdale d8a0182af5 Merge pull request #36 from AGWA-forks/master
Add ares_set_socket_configure_callback()
2016-02-11 09:53:23 +00:00
David Drysdale 56cd98b9e4 test: Update init tests to match behaviour
Unreadable config files are now treated the same way
as absent config files.
2016-02-11 09:29:31 +00:00
Andrew Ayer 11e37a92ef Add ares_set_socket_configure_callback()
This function sets a callback that is invoked after the socket is
created, but before the connection is established.  This is an ideal
time to customize various socket options.
2016-02-09 10:05:04 -08:00
David Drysdale 87d641a907 test: ares_set_socket_callback failure behaviour 2016-02-09 16:14:37 +00:00
David Drysdale 2bae2d56d7 test: Check ares_parse_txt_reply_ext() entrypoint 2016-02-04 10:09:22 +00:00
David Drysdale c9579872c8 test: Ignore SIGPIPE in tests 2016-02-02 10:13:49 +00:00
David Drysdale 86beb81892 test: More initialization tests 2016-02-02 10:13:49 +00:00
David Drysdale ff1f7a1c3c test: Improve containerized test mechanism
Aim is to ensure that code coverage information can escape the
container.  To do this:
 - Enter a new mount namespace too, so that we can...
 - Bind mount the expected source directory into the container
 - Share memory with the sub-process so coverage information is
   shared too.
2016-02-02 10:13:49 +00:00
David Drysdale b644412a66 test: Make contained tests easier to write 2016-02-02 10:13:49 +00:00
David Drysdale 5dc450a4b3 test: Add framework for containerized testing
On Linux we can potentially use user and UTS namespaces to run  a test
in a pseudo-container with:
 - arbitrary filesystem (e.g. /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts)
 - arbitrary hostname/domainname.

Include a first pass at the framework code to allow this, along with a
first test case that uses the container.
2016-02-02 10:13:49 +00:00
David Drysdale 439eb45cc0 test: Use a longer timeout for less flakiness
Having occasional test failures from timeout before multiple
queries can complete, so up the default timeout for the test
from 100ms to 1500ms.
2016-02-02 10:13:49 +00:00
David Drysdale 78f9ec5515 test: Make failure tests more robust
Different platforms will do different numbers of allocations
in the processing of a given API call; just check that the
return code is either success or ENOMEM, and free off any
returned state in the former case.

Also cope with ECONNREFUSED as well as ENOTFOUND.
2016-02-02 10:13:48 +00:00
David Drysdale 3478963873 test: Get test code building under Windows
- Initial nmake file based off library nmake file
 - Cast socket call arguments to (char *)
 - Use wrapper sclose() that maps to closesocket() or close()
 - Build a config.h indicating presence of headers
 - Conditionally include netdb.h
 - Remove unnecessary include of sys/socket.h
 - Force longer bitmask for allocation failure tracking
 - Call WSAStartup() / WSACleanup() in main()
 - Set TCP_NODELAY for mock server
 - Turn on tests in AppVeyor build
2016-02-02 10:13:48 +00:00
David Drysdale 830e8fe2b3 test: Disable tests that manipulate env on Windows 2016-02-02 10:13:48 +00:00
David Drysdale d3bccff740 test: Move file lists into Makefile.inc
In preparation for a Win32 build of the test suite.
2016-02-02 10:13:48 +00:00
David Drysdale 9edf9411c7 test: Add a simple multi-server test
Check rotate option does something
2016-02-02 10:13:48 +00:00
David Drysdale d448d6604f test: Allow for multiple mock servers
- Update the MockServer to allow separate specification of
   UDP and TCP ports
 - Have an array of mock servers listening on consecutive
   sets of ports.
 - Rename Process(fd) to ProcessFD(fd) to avoid confusion.
 - Initialize channel by using the new ares_set_servers_ports()
   entrypoint, so multiple ports on the same loopback address
   can be used.
2016-02-02 10:13:48 +00:00
David Drysdale 92656bcc82 test: Update test for set/get_servers variants
Ports are significant in the _ports_ variant functions, so update test to cope.
2016-02-02 10:13:48 +00:00
David Drysdale 3231480a85 test: Make GetNameServers() utility function port-aware
Also make it generally available.
2016-02-02 10:13:48 +00:00
David Drysdale e26a678f26 test: more testing, including of internal static functions 2016-02-02 10:13:48 +00:00
David Drysdale 25adcc413e test: more tests, especially fallback processing
- Make mock server listen on UDP + TCP in parallel.
 - Test UDP->TCP fallback on truncation
 - Test EDNS->no-EDNS fallback
 - Test some environment init options
 - Test nonsense reply

test: short response
2016-02-02 10:13:48 +00:00
David Drysdale a05f240dea test: more tests, particularly of initialization 2016-02-02 10:13:48 +00:00
David Drysdale 83839fde7a test: Run mock tests over both TCP and UDP
With the exception of a few tests that make use of the timed
retry aspect of UDP.
2016-02-02 10:13:48 +00:00
David Drysdale 0c423efd78 test: Run mock tests over both IPv4 and IPv6 2016-02-02 10:13:48 +00:00
David Drysdale 0ef56333a0 test: Add more tests for edge cases 2016-02-02 10:13:48 +00:00
David Drysdale ce3f896572 test: more nooks and crannies of pton functions 2016-02-02 10:13:48 +00:00
David Drysdale f939efe7df test: More tests for PTR parsing 2016-02-02 10:13:48 +00:00
David Drysdale a2c5b1d378 test: Use of HOSTALIAS environment variable 2016-02-02 10:13:48 +00:00
David Drysdale 834c98e9d9 test: Add RAII utility classes for testing
- TempFile holds specific contents
 - EnvValue sets an environment variable
2016-02-02 10:13:48 +00:00
David Drysdale 693e566b66 test: More search domain scenarios 2016-02-02 10:13:47 +00:00
David Drysdale 3ce586feb7 test: Remove duplicate flags from Makefile.am 2016-02-02 10:13:47 +00:00
David Drysdale 6589ebfd6a test: Make test code leak-free 2016-02-02 10:13:47 +00:00
David Drysdale 4a09121923 test: More tests
- test use of sortlist
 - test gethostbyname(AF_UNSPEC)
2016-02-02 10:13:47 +00:00
David Drysdale f2ae5d72da test: Test ares_gethostbyname_file() 2016-02-02 10:13:47 +00:00
David Drysdale 0c03bee6ed test: Add more tests of ares_getnameinfo() 2016-02-02 10:13:47 +00:00
David Drysdale ffc7c52656 test: Tweak tests, add alloc failure test 2016-02-02 10:13:47 +00:00
David Drysdale e3434ef33f test: Test init with options 2016-02-02 10:13:47 +00:00
David Drysdale a48447ee27 test: More tests
- ares_inet_net_pton() variants
 - ares_getsock() variants
2016-02-02 10:13:47 +00:00
David Drysdale f9b9817d1d test: Expose ProcessWork() function 2016-02-02 10:13:47 +00:00
David Drysdale c778f0136b test: More parsing tests
Including:
 - Split each parse function test set out into separate files.
 - Add an allocation failure test for each parsing function.
 - Add error check test for each parsing function.
2016-02-02 10:13:47 +00:00
David Drysdale 79dc327a2d test: Add various additional tests 2016-02-02 10:13:47 +00:00
David Drysdale 5da3201a05 test: More tests
Include tests of internal functions, based on the value of the
CARES_SYMBOL_HIDING macro; need to configure the library with
--disable-symbol-hiding to enable these tests.
2016-02-02 10:13:47 +00:00
David Drysdale 3907b6dc68 test: Allow command line override of mock server port 2016-02-02 10:13:47 +00:00