Mercurial > hg > octave-kai > gnulib-hg
changeset 13418:b65ecb65bb35
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.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sat, 12 Jun 2010 14:47:43 +0200 |
parents | d4657f4efc16 |
children | a18c56544c84 |
files | ChangeLog tests/test-inttostr.c |
diffstat | 2 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-12 Jim Meyering <meyering@redhat.com> + + 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. + 2010-06-11 Jim Meyering <meyering@redhat.com> test-sys_socket: mark variables as used more readably
--- 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; }