test_transport_blacklist.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. This file is part of GNUnet.
  3. (C) 2009, 2013 Christian Grothoff (and other contributing authors)
  4. GNUnet is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published
  6. by the Free Software Foundation; either version 3, or (at your
  7. option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNUnet; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17. /**
  18. * @file dv/test_transport_blacklist.c
  19. * @brief base testcase for testing blacklist
  20. */
  21. #include "platform.h"
  22. #include "gnunet_core_service.h"
  23. #include "gnunet_testbed_service.h"
  24. /**
  25. * Return value from main, set to 0 on success.
  26. */
  27. static int ok;
  28. static void
  29. test_connection (void *cls,
  30. struct GNUNET_TESTBED_RunHandle *h,
  31. unsigned int num_peers,
  32. struct GNUNET_TESTBED_Peer **peers,
  33. unsigned int links_succeeded,
  34. unsigned int links_failed)
  35. {
  36. GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed);
  37. if ( (4 == num_peers) && (0 == links_failed) )
  38. {
  39. GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
  40. "Testbed connect peers despite blacklist!\n");
  41. ok = 1;
  42. }
  43. else
  44. {
  45. GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
  46. "Note that getting a message about a timeout during setup is expected for this test.\n");
  47. }
  48. GNUNET_SCHEDULER_shutdown ();
  49. }
  50. int
  51. main (int argc, char *argv[])
  52. {
  53. (void) GNUNET_TESTBED_test_run ("test-transport-blacklist",
  54. "test_transport_blacklist_data.conf",
  55. 4,
  56. 0, NULL, NULL,
  57. &test_connection, NULL);
  58. return ok;
  59. }
  60. /* end of test_transport_blacklist.c */