Commit 07ecaaf4 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] customize check logic against extra space for in::A based on inet_pton

this will avoid unittest failure on netbsd, whose inet_pton behaves
differently than others:
parent 66535ab5
......@@ -30,6 +30,9 @@
#include <sstream>
#include <arpa/inet.h>
#include <sys/socket.h>
using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
......@@ -67,13 +70,21 @@ TEST_F(Rdata_IN_A_Test, createFromText) {
// or any meaningless text as an IP address
// NetBSD's inet_pton accepts trailing space after an IPv4 address, which
// would confuse some of the tests below. We check the case differently
// in these cases depending on the strictness of inet_pton (most
// implementations seem to be stricter).
uint8_t v4addr_buf[4];
const bool reject_extra_space =
inet_pton(AF_INET, " ", v4addr_buf) == 0;
// trailing white space: only string version throws
checkFromTextIN_A(" ", true, false);
checkFromTextIN_A(" ", reject_extra_space, false);
// same for beginning white space.
checkFromTextIN_A("", true, false);
// same for trailing non-space garbage (note that lexer version still
// ignore it; it's expected to be detected at a higher layer).
checkFromTextIN_A(" xxx", true, false);
checkFromTextIN_A(" xxx", reject_extra_space, false);
// nul character after a valid textual representation.
string nul_after_addr = "";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment