diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-12-01 15:04:21 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-12-01 15:04:21 +0000 |
commit | 8651d829f8522f9cf8c0619fce152ef3c4eeddf8 (patch) | |
tree | dfea7447b7b64c92ca33767e944459d9386cfc5e | |
parent | 1172c68375c186209def8b8ba46238c16293ecb0 (diff) | |
download | mpfr-8651d829f8522f9cf8c0619fce152ef3c4eeddf8.tar.gz |
Solved an output issue on AIX due to the use of setbuf() after output
in tversion. Indeed, this is disallowed by ISO C.
* doc/README.dev: added a note about tests_start_mpfr and this issue.
* tests/tests.c: moved test_version() after setbuf().
* tests/tversion.c: moved tests_start_mpfr() earlier, before any
printf().
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11877 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | doc/README.dev | 4 | ||||
-rw-r--r-- | tests/tests.c | 11 | ||||
-rw-r--r-- | tests/tversion.c | 6 |
3 files changed, 15 insertions, 6 deletions
diff --git a/doc/README.dev b/doc/README.dev index 33d1e193e..82d2478e2 100644 --- a/doc/README.dev +++ b/doc/README.dev @@ -1279,6 +1279,10 @@ of mismatch between a header and a library, an error message is output 3. Otherwise test_version() returns with value 0 (everything is fine). +Note: The tests_start_mpfr function does a setbuf on stdout to disable +buffering. As a consequence, no operations on stdout (such as printf) +must be done before this function is called. + With Automake 1.13+, the tests are run in parallel if a -j make option is used. In case of failure, information can be found in the log file of each failed test program and in the global tests/test-suite.log file diff --git a/tests/tests.c b/tests/tests.c index 766e576b1..3b9d32922 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -137,7 +137,8 @@ void (*dummy_func)(mpfr_srcptr) = mpfr_dump; of "make check") but a different library that is already installed, i.e. any test result would be meaningless; in such a case, we exit immediately with an error (exit status = 1). - Return value: 0 for no errors, 1 in case of any non-fatal error. */ + Return value: 0 for no errors, 1 in case of any non-fatal error. + Note: If the return value is 0, no data must be sent to stdout. */ int test_version (void) { @@ -248,11 +249,13 @@ test_version (void) void tests_start_mpfr (void) { - test_version (); - - /* don't buffer, so output is not lost if a test causes a segv etc */ + /* Don't buffer, so output is not lost if a test causes a segv, etc. + Warning! No operations must have already been done on stdout + (this is a requirement of ISO C, and this is important on AIX). */ setbuf (stdout, NULL); + test_version (); + #if defined HAVE_LOCALE_H && defined HAVE_SETLOCALE /* Added on 2005-07-09. This allows to test MPFR under various locales. New bugs will probably be found, in particular with diff --git a/tests/tversion.c b/tests/tversion.c index 817ffe5eb..6384cfa95 100644 --- a/tests/tversion.c +++ b/tests/tversion.c @@ -37,6 +37,8 @@ main (void) if (test_version ()) exit (1); + tests_start_mpfr (); + /*********************** MPFR version and patches ************************/ printf ("[tversion] MPFR %s\n", MPFR_VERSION_STRING); @@ -368,7 +370,6 @@ main (void) /************************** Runtime information **************************/ - tests_start_mpfr (); if (locale != NULL) printf ("[tversion] Locale: %s\n", locale); /* The memory limit should not be changed for "make check". @@ -378,9 +379,10 @@ main (void) if (tests_memory_limit != DEFAULT_MEMORY_LIMIT) printf ("[tversion] Warning! Memory limit changed to %" MPFR_EXP_FSPEC "u\n", (mpfr_ueexp_t) tests_memory_limit); - tests_end_mpfr (); /*************************************************************************/ + tests_end_mpfr (); + return err; } |