1 /* Check _dl_debug_vdprintf.
2 Copyright The GNU Toolchain Authors.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
23 #include <support/check.h>
24 #include <support/xunistd.h>
28 #define TEST(fmt, ...) \
31 char str1[BUFSZ], str2[BUFSZ]; \
32 int len1 = snprintf (str1, BUFSZ, fmt, __VA_ARGS__); \
33 TEST_VERIFY_EXIT (len1 >= 0); \
34 TEST_VERIFY_EXIT (len1 < BUFSZ); \
35 _dl_dprintf (fds[1], fmt, __VA_ARGS__); \
36 ssize_t len2 = read (fds[0], str2, BUFSZ); \
37 TEST_VERIFY_EXIT (len2 >= 0); \
38 TEST_VERIFY_EXIT (len2 < BUFSZ); \
40 TEST_COMPARE_STRING (str1, str2); \
53 TEST ("%d", INT_MIN
+ 1);
57 TEST ("%u", UINT_MAX
);
60 TEST ("%x", UINT_MAX
);
63 TEST ("%ld", LONG_MAX
);
65 TEST ("%ld", LONG_MIN
+ 1);
66 TEST ("%ld", LONG_MIN
);
69 TEST ("%lu", ULONG_MAX
);
72 TEST ("%lx", ULONG_MAX
);
78 #include <support/test-driver.c>