PageRenderTime 32ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/resolv/tst-resolv-ai_idn.c

https://gitlab.com/gbenson/glibc
C | 49 lines | 24 code | 8 blank | 17 comment | 4 complexity | 985ab82e51f9df5d5cbbd629a8d889d2 MD5 | raw file
  1. /* Test getaddrinfo and getnameinfo with AI_IDN, NI_IDN (UTF-8).
  2. Copyright (C) 2018 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #define TEST_USE_UTF8 1
  16. #include "tst-resolv-ai_idn-common.c"
  17. #include <locale.h>
  18. #include <support/xdlfcn.h>
  19. static int
  20. do_test (void)
  21. {
  22. void *handle = dlopen (LIBIDN2_SONAME, RTLD_LAZY);
  23. if (handle == NULL)
  24. FAIL_UNSUPPORTED ("libidn2 not installed");
  25. if (setlocale (LC_CTYPE, "en_US.UTF-8") == NULL)
  26. FAIL_EXIT1 ("setlocale: %m");
  27. struct resolv_test *aux = resolv_test_start
  28. ((struct resolv_redirect_config)
  29. {
  30. .response_callback = response,
  31. });
  32. gai_tests_with_libidn2 ();
  33. gni_tests_with_libidn2 ();
  34. resolv_test_end (aux);
  35. xdlclose (handle);
  36. return 0;
  37. }
  38. #include <support/test-driver.c>