test_transport_simple_send.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. This file is part of GNUnet
  3. Copyright (C) 2021 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your 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. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @file transport/test_transport_api_cmd_simple_send.c
  18. * @brief Test case executing a script which sends a test message between two peers.
  19. * @author t3sserakt
  20. */
  21. #include "platform.h"
  22. #include "gnunet_testing_ng_lib.h"
  23. #include "gnunet_util_lib.h"
  24. #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
  25. /**
  26. * Return value of the test.
  27. *
  28. */
  29. static unsigned int rv = 0;
  30. /**
  31. * Main function to run the test cases.
  32. *
  33. * @param cls not used.
  34. *
  35. */
  36. static void
  37. run (void *cls)
  38. {
  39. struct GNUNET_TESTING_Command commands[] = {
  40. GNUNET_TESTING_cmd_netjail_start ("netjail-start",
  41. "2",
  42. "1"),
  43. GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed",
  44. "2",
  45. "1",
  46. "libgnunet_test_transport_plugin_cmd_simple_send",
  47. &rv),
  48. GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
  49. "netjail-start-testbed",
  50. "2",
  51. "1"),
  52. GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
  53. "2",
  54. "1"),
  55. GNUNET_TESTING_cmd_end ()
  56. };
  57. GNUNET_TESTING_run (NULL,
  58. commands,
  59. TIMEOUT);
  60. }
  61. int
  62. main (int argc,
  63. char *const *argv)
  64. {
  65. GNUNET_log_setup ("test-netjail",
  66. "DEBUG",
  67. NULL);
  68. GNUNET_SCHEDULER_run (&run,
  69. NULL);
  70. GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
  71. "Test finished!\n");
  72. return rv;
  73. }