diff options
author | Jim Meyering <meyering@redhat.com> | 2010-06-12 14:47:43 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-06-12 17:36:58 +0200 |
commit | 692a15c587c6d741cba6423319efcc957c45c9cb (patch) | |
tree | 0899d5739524ef361d346b6c16ec33655078beb6 /tests | |
parent | 75ce01c4382e5acf45599baaade587f78ddfa956 (diff) | |
download | gnulib-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.c | 24 |
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; } |