test48: skip some redundant combinations of parameters

Change-Id: I8ebecf4f61a99c653fd6dc0ae9510d5fd154dd4e
This commit is contained in:
Erik van der Kouwe 2015-07-08 09:32:17 +02:00
parent 3433559c50
commit 3e8d796eaa

View file

@ -367,7 +367,7 @@ static struct
static void test_getaddrinfo_all(int use_network)
{
int flag_PASSIVE, flag_CANONNAME, flag_NUMERICHOST, flag_NUMERICSERV;
int exp_results, flags, i, j, k, l, passhints;
int exp_results, flags, flagcount, i, j, k, l, passhints;
unsigned long ipaddr;
/* loop through various parameter values */
@ -381,6 +381,11 @@ static void test_getaddrinfo_all(int use_network)
for (flag_NUMERICSERV = 0; flag_NUMERICSERV < 2; flag_NUMERICSERV++)
for (passhints = 0; passhints < 2; passhints++)
{
/* skip some redundant combinations */
flagcount = flag_PASSIVE + flag_CANONNAME +
flag_NUMERICHOST + flag_NUMERICSERV;
if (flagcount > 1 && flagcount < 4) continue;
/* skip tests that need but cannot use network */
if (!use_network && hosts[i].need_network)
continue;
@ -490,7 +495,7 @@ static int buflens[] = { 0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 255 };
static void test_getnameinfo_all(void)
{
int flag_NUMERICHOST, flag_NAMEREQD, flag_NUMERICSERV, flag_DGRAM;
int exp_results, flags, i, j, k, l, socktypemismatch;
int exp_results, flagcount, flags, i, j, k, l, socktypemismatch;
const char *nodename, *servname;
/* set ports servent structs */
@ -530,6 +535,13 @@ static void test_getnameinfo_all(void)
for (flag_NUMERICSERV = 0; flag_NUMERICSERV < 2; flag_NUMERICSERV++)
for (flag_DGRAM = 0; flag_DGRAM < 2; flag_DGRAM++)
{
/* skip some redundant combinations */
flagcount = flag_NUMERICHOST + flag_NAMEREQD +
flag_NUMERICSERV + flag_DGRAM;
if (flagcount > 1 && flagcount < 4) continue;
if (k > 1 && k < LENGTH(buflens) - 2 &&
l > 1 && l < LENGTH(buflens) - 2) continue;
/* determine flags */
flags = (flag_NUMERICHOST ? NI_NUMERICHOST : 0) |
(flag_NAMEREQD ? NI_NAMEREQD : 0) |