test_testing_servicestartup.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. This file is part of GNUnet
  3. Copyright (C) 2008, 2009, 2012 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 testing/test_testing_new_servicestartup.c
  18. * @brief test case for testing service startup using new testing API
  19. * @author Sree Harsha Totakura
  20. */
  21. #include "platform.h"
  22. #include "gnunet_util_lib.h"
  23. #include "gnunet_testing_lib.h"
  24. #define LOG(kind,...) \
  25. GNUNET_log (kind, __VA_ARGS__)
  26. /**
  27. * Global test status
  28. */
  29. static int test_success;
  30. /**
  31. * The testing callback function
  32. *
  33. * @param cls NULL
  34. * @param cfg the configuration with which the current testing service is run
  35. */
  36. static void
  37. test_run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
  38. struct GNUNET_TESTING_Peer *peer)
  39. {
  40. GNUNET_assert (NULL == cls);
  41. GNUNET_assert (NULL != cfg);
  42. LOG (GNUNET_ERROR_TYPE_DEBUG, "Service arm started successfully\n");
  43. test_success = GNUNET_YES;
  44. GNUNET_SCHEDULER_shutdown ();
  45. }
  46. /**
  47. * The main point of execution
  48. */
  49. int main (int argc, char *argv[])
  50. {
  51. test_success = GNUNET_NO;
  52. GNUNET_assert (0 == GNUNET_TESTING_service_run ("test-testing-servicestartup",
  53. "arm",
  54. "test_testing_defaults.conf",
  55. &test_run,
  56. NULL));
  57. return (GNUNET_YES == test_success) ? 0 : 1;
  58. }
  59. /* end of test_testing_servicestartup.c */