0001-test-disable-test-when-UCLIBC_HAS_XLOCALE-is-n.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. From 7f42d10dfdfe506df0c6b4850a16da7d2ce8293a Mon Sep 17 00:00:00 2001
  2. From: Waldemar Brodkorb <wbx@openadk.org>
  3. Date: Thu, 28 Aug 2014 14:09:51 +0200
  4. Subject: [PATCH 1/2] test: disable test when UCLIBC_HAS_XLOCALE is n
  5. wcsftime() is only implemented when locale support in uClibc
  6. is activated. So test will always fail when locale is deactivated
  7. by the user. Rename file name to be consistent with other test file
  8. names.
  9. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  10. ---
  11. test/time/Makefile.in | 2 +-
  12. test/time/tst-wcsftime.c | 39 +++++++++++++++++++++++++++++++++++++++
  13. test/time/tst_wcsftime.c | 39 ---------------------------------------
  14. 3 files changed, 40 insertions(+), 40 deletions(-)
  15. create mode 100644 test/time/tst-wcsftime.c
  16. delete mode 100644 test/time/tst_wcsftime.c
  17. diff --git a/test/time/Makefile.in b/test/time/Makefile.in
  18. index 05f73a4..3f1d1a1 100644
  19. --- a/test/time/Makefile.in
  20. +++ b/test/time/Makefile.in
  21. @@ -5,7 +5,7 @@ TESTS_DISABLED := bug-asctime bug-asctime_r time tst-mktime2 tst-posixtz \
  22. tst-strftime tst-strptime tst-timezone
  23. ifneq ($(UCLIBC_HAS_XLOCALE),y)
  24. -TESTS_DISABLED += tst-ftime_l
  25. +TESTS_DISABLED += tst-ftime_l tst-wcsftime
  26. endif
  27. CFLAGS_tst-strptime2 := -std=c99
  28. diff --git a/test/time/tst-wcsftime.c b/test/time/tst-wcsftime.c
  29. new file mode 100644
  30. index 0000000..6e35f1e
  31. --- /dev/null
  32. +++ b/test/time/tst-wcsftime.c
  33. @@ -0,0 +1,39 @@
  34. +#include <stdio.h>
  35. +#include <time.h>
  36. +#include <features.h>
  37. +#ifdef __UCLIBC_HAS_WCHAR__
  38. +#include <wchar.h>
  39. +
  40. +int
  41. +main (int argc, char *argv[])
  42. +{
  43. + wchar_t buf[200];
  44. + time_t t;
  45. + struct tm *tp;
  46. + int result = 0;
  47. + size_t n;
  48. +
  49. + time (&t);
  50. + tp = gmtime (&t);
  51. +
  52. + n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]),
  53. + L"%H:%M:%S %Y-%m-%d\n", tp);
  54. + if (n != 21)
  55. + result = 1;
  56. +
  57. + wprintf (L"It is now %ls", buf);
  58. +
  59. + wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp);
  60. +
  61. + wprintf (L"The weekday is %ls", buf);
  62. +
  63. + return result;
  64. +}
  65. +
  66. +#else
  67. +int main(void)
  68. +{
  69. + puts("Test requires WCHAR support; skipping");
  70. + return 0;
  71. +}
  72. +#endif
  73. diff --git a/test/time/tst_wcsftime.c b/test/time/tst_wcsftime.c
  74. deleted file mode 100644
  75. index 6e35f1e..0000000
  76. --- a/test/time/tst_wcsftime.c
  77. +++ /dev/null
  78. @@ -1,39 +0,0 @@
  79. -#include <stdio.h>
  80. -#include <time.h>
  81. -#include <features.h>
  82. -#ifdef __UCLIBC_HAS_WCHAR__
  83. -#include <wchar.h>
  84. -
  85. -int
  86. -main (int argc, char *argv[])
  87. -{
  88. - wchar_t buf[200];
  89. - time_t t;
  90. - struct tm *tp;
  91. - int result = 0;
  92. - size_t n;
  93. -
  94. - time (&t);
  95. - tp = gmtime (&t);
  96. -
  97. - n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]),
  98. - L"%H:%M:%S %Y-%m-%d\n", tp);
  99. - if (n != 21)
  100. - result = 1;
  101. -
  102. - wprintf (L"It is now %ls", buf);
  103. -
  104. - wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp);
  105. -
  106. - wprintf (L"The weekday is %ls", buf);
  107. -
  108. - return result;
  109. -}
  110. -
  111. -#else
  112. -int main(void)
  113. -{
  114. - puts("Test requires WCHAR support; skipping");
  115. - return 0;
  116. -}
  117. -#endif
  118. --
  119. 1.8.5.2 (Apple Git-48)