aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-30 12:26:09 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-30 12:26:09 +0000
commit02702760aa5a9b695b11244a54142209759c908b (patch)
tree8ed34bc7efb101090d863e963b287515bcf4a7a1 /src/vpn
parent4cdecaf4c7815917932a3b80812ecbd840dab4e7 (diff)
downloadgnunet-02702760aa5a9b695b11244a54142209759c908b.tar.gz
gnunet-02702760aa5a9b695b11244a54142209759c908b.zip
-add test for unsupported AFs (#2123)
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/test_gnunet_vpn.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/vpn/test_gnunet_vpn.c b/src/vpn/test_gnunet_vpn.c
index 4df9e7eb0..d66e6fc7b 100644
--- a/src/vpn/test_gnunet_vpn.c
+++ b/src/vpn/test_gnunet_vpn.c
@@ -458,6 +458,31 @@ stop_peer (struct PeerContext *p)
458} 458}
459 459
460 460
461/**
462 * Test if the given AF is supported by this system.
463 *
464 * @param af to test
465 * @return GNUNET_OK if the AF is supported
466 */
467static int
468test_af (int af)
469{
470 int s;
471
472 s = socket (af, SOCK_STREAM, 0);
473 if (-1 == s)
474 {
475 if (EAFNOSUPPORT == errno)
476 return GNUNET_NO;
477 fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno));
478 return GNUNET_SYSERR;
479 }
480 close (s);
481 return GNUNET_OK;
482}
483
484
485
461int 486int
462main (int argc, char *const *argv) 487main (int argc, char *const *argv)
463{ 488{
@@ -535,6 +560,14 @@ main (int argc, char *const *argv)
535 fprintf (stderr, "invalid binary suffix `%s'\n", type); 560 fprintf (stderr, "invalid binary suffix `%s'\n", type);
536 return 1; 561 return 1;
537 } 562 }
563 if ( (GNUNET_OK != test_af (src_af)) ||
564 (GNUNET_OK != test_af (dest_af)) )
565 {
566 fprintf (stderr,
567 "Required address families not supported by this system, skipping test.\n");
568 return 0;
569 }
570
538 571
539 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 572 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
540 return 2; 573 return 2;