diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-06-12 17:55:05 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-06-12 17:55:05 +0000 |
commit | 8688388f21444510945e991bcaf455071b7d7a28 (patch) | |
tree | 7defa9ac4247743a92b24e7f1a86782ed79aa0f0 | |
parent | d48aacb1c4d8b5035dd85caea22d8b5faa082bc3 (diff) | |
download | mpfr-8688388f21444510945e991bcaf455071b7d7a28.tar.gz |
Merged the latest changes from the trunk:
r14003:
[tests/tfpif.c] Fixed a bug (in the test) detected on AIX[*], where
an fclose failed due to a previous read failure. At the same time,
check that a read failure no longer occurs. Note: the read failure
made mpfr_fpif_import fail, but this is a test where it is expected
to fail, i.e. we now check that it fails for a good reason.
[*] gcc119.fsffrance.org on the GCC Compile farm.
r14004:
[tests/tests.c] Removed a useless "#include <errno.h>" (added in r5252,
useless since r5253).
r14005:
[README] Added URL of the official GNU MPFR website and a note about the
future migration, since InriaForge will shut down in December 2020.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.1@14006 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | tests/tests.c | 1 | ||||
-rw-r--r-- | tests/tfpif.c | 28 |
3 files changed, 37 insertions, 2 deletions
@@ -63,6 +63,16 @@ For any copyright year range specified as YYYY-ZZZZ in this package, note that the range specifies every single year in that closed interval. +Official GNU MPFR website: + + https://www.mpfr.org/ + + +NOTE: At the time of the release 4.1.0, the MPFR repository is hosted at +InriaForge, but it will need to migrate since InriaForge will shut down in +December 2020. Please go to https://www.mpfr.org/ for the current status. +What follows remains valid until the migration is done. + You can get the latest source code by Subversion at InriaForge: svn checkout svn://scm.gforge.inria.fr/svn/mpfr/trunk mpfr diff --git a/tests/tests.c b/tests/tests.c index a82e6a784..e51962b02 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -25,7 +25,6 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #include <float.h> -#include <errno.h> #ifdef HAVE_LOCALE_H #include <locale.h> diff --git a/tests/tfpif.c b/tests/tfpif.c index 8dda0dd56..49d3ebc55 100644 --- a/tests/tfpif.c +++ b/tests/tfpif.c @@ -20,6 +20,8 @@ along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include <errno.h> + #include "mpfr-test.h" #define FILE_NAME_RW "tfpif_rw.dat" /* temporary name (written then read) */ @@ -242,7 +244,18 @@ check_bad (void) exit (1); } - fh = fopen (filenameCompressed, "w"); + /* Since the file will be read after writing to it and a rewind, we need + to open it in mode "w+". + Note: mode "w" was used previously, and the issue remained undetected + until a test on AIX, where the fclose failed with the error: + check_bad: A file descriptor does not refer to an open file. + (the exit code of fclose has been checked since r13549 / 2019-08-09). + What actually happened is that the fread in mpfr_fpif_import failed, + but this was not tested. So a test of errno has been added below; + with mode "w" (instead of "w+"), it yields: + check_bad: Bad file descriptor + as expected. */ + fh = fopen (filenameCompressed, "w+"); if (fh == NULL) { perror ("check_bad"); @@ -284,7 +297,20 @@ check_bad (void) exit (1); } rewind (fh); + /* The check of errno below is needed to make sure that + mpfr_fpif_import fails due to bad data, not for some + arbitrary system error. */ + errno = 0; status = mpfr_fpif_import (x, fh); + if (errno != 0) + { + perror ("check_bad"); + fprintf (stderr, "mpfr_fpif_import failed with unexpected" + " errno = %d (and status = %d)\n", errno, status); + fclose (fh); + remove (filenameCompressed); + exit (1); + } if (status == 0) { printf ("mpfr_fpif_import did not fail on a bad imported data\n"); |