bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: stat tests: fix test failure on MSVC
Date: Tue, 02 Jul 2019 19:45:25 +0200	[thread overview]
Message-ID: <2448141.KIrPEO50rA@omega> (raw)

On MSVC, I'm seeing these three test failures:

FAIL: test-fstatat
==================

c:\testdir-posix-msvc\gltests\test-stat.h:35: assertion 'SAME_INODE (st1, st2)' failed
FAIL test-fstatat.exe (exit status: 127)

FAIL: test-stat
===============

c:\testdir-posix-msvc\gltests\test-stat.h:35: assertion 'SAME_INODE (st1, st2)' failed
FAIL test-stat.exe (exit status: 127)

FAIL: test-statat
=================

c:\testdir-posix-msvc\gltests\test-stat.h:35: assertion 'SAME_INODE (st1, st2)' failed
FAIL test-statat.exe (exit status: 127)

The cause is that the test makes assumptions about the value of the SAME_INODE
macro. On native Windows, the cheap implementation of stat() cannot satisfy
this, as it sets st_dev and st_ino to zero always. We have a module
'windows-stat-inodes' that fixes this (by making stat() more costly), but it
is not enabled by default.


2019-07-02  Bruno Haible  <bruno@clisp.org>

	stat tests: Fix test failure on MSVC.
	* tests/test-stat.h (test_stat_func): Don't test SAME_INODE values on
	native Windows, unless _GL_WINDOWS_STAT_INODES is defined.

diff --git a/tests/test-stat.h b/tests/test-stat.h
index 7d2f989..7fa3073 100644
--- a/tests/test-stat.h
+++ b/tests/test-stat.h
@@ -32,12 +32,18 @@ test_stat_func (int (*func) (char const *, struct stat *), bool print)
   ASSERT (cwd);
   ASSERT (func (".", &st1) == 0);
   ASSERT (func ("./", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
   ASSERT (SAME_INODE (st1, st2));
+#endif
   ASSERT (func (cwd, &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
   ASSERT (SAME_INODE (st1, st2));
+#endif
   ASSERT (func ("/", &st1) == 0);
   ASSERT (func ("///", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
   ASSERT (SAME_INODE (st1, st2));
+#endif
 
   errno = 0;
   ASSERT (func ("", &st1) == -1);



             reply	other threads:[~2019-07-02 19:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02 17:45 Bruno Haible [this message]
2019-07-02 17:48 ` lstat tests: fix test failure on MSVC Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2448141.KIrPEO50rA@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).