summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-06-12 14:47:43 +0200
committerJim Meyering <meyering@redhat.com>2010-06-12 17:36:58 +0200
commit692a15c587c6d741cba6423319efcc957c45c9cb (patch)
tree0899d5739524ef361d346b6c16ec33655078beb6 /tests
parent75ce01c4382e5acf45599baaade587f78ddfa956 (diff)
downloadgnulib-692a15c587c6d741cba6423319efcc957c45c9cb.tar.gz
test-inttostr: avoid spurious failure on Solaris 9
* tests/test-inttostr.c (main): Skip the test when snprintf fails to accept "%ju". Reported by Bruno Haible.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-inttostr.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/test-inttostr.c b/tests/test-inttostr.c
index e53d22a064..bf18621e4c 100644
--- a/tests/test-inttostr.c
+++ b/tests/test-inttostr.c
@@ -65,10 +65,22 @@
int
main (void)
{
- CK (int, inttostr);
- CK (unsigned int, uinttostr);
- CK (off_t, offtostr);
- CK (uintmax_t, umaxtostr);
- CK (intmax_t, imaxtostr);
- return 0;
+ char buf[2];
+
+ /* Ideally we would rely on the snprintf-posix module, in which case
+ this guard would not be required, but due to limitations in gnulib's
+ implementation (see modules/snprintf-posix), we cannot. */
+ if (snprintf (buf, sizeof buf, "%ju", (uintmax_t) 3) == 1
+ && buf[0] == '3' && buf[1] == '\0')
+ {
+ CK (int, inttostr);
+ CK (unsigned int, uinttostr);
+ CK (off_t, offtostr);
+ CK (uintmax_t, umaxtostr);
+ CK (intmax_t, imaxtostr);
+ return 0;
+ }
+
+ /* snprintf doesn't accept %ju; skip this test. */
+ return 77;
}