diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:26:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:26:09 +0000 |
commit | 02702760aa5a9b695b11244a54142209759c908b (patch) | |
tree | 8ed34bc7efb101090d863e963b287515bcf4a7a1 /src/vpn | |
parent | 4cdecaf4c7815917932a3b80812ecbd840dab4e7 (diff) | |
download | gnunet-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.c | 33 |
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 | */ | ||
467 | static int | ||
468 | test_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 | |||
461 | int | 486 | int |
462 | main (int argc, char *const *argv) | 487 | main (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; |