* stat tests: fix test failure on MSVC
@ 2019-07-02 17:45 Bruno Haible
2019-07-02 17:48 ` lstat " Bruno Haible
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Haible @ 2019-07-02 17:45 UTC (permalink / raw)
To: bug-gnulib
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* lstat tests: fix test failure on MSVC
2019-07-02 17:45 stat tests: fix test failure on MSVC Bruno Haible
@ 2019-07-02 17:48 ` Bruno Haible
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2019-07-02 17:48 UTC (permalink / raw)
To: bug-gnulib
Similarly, on MSVC, I'm seeing this test failure:
FAIL: test-lstat
================
c:\testdir-posix-msvc\gltests\test-lstat.h:34: assertion 'SAME_INODE (st1, st2)' failed
FAIL test-lstat.exe (exit status: 127)
The cause is the same: SAME_INODE always returns false in this configuration.
This patch fixes it.
2019-07-02 Bruno Haible <bruno@clisp.org>
lstat tests: Fix test failure on MSVC.
* tests/test-lstat.h (test_lstat_func): Don't test SAME_INODE values on
native Windows, unless _GL_WINDOWS_STAT_INODES is defined.
diff --git a/tests/test-lstat.h b/tests/test-lstat.h
index 97e9593..1573e80 100644
--- a/tests/test-lstat.h
+++ b/tests/test-lstat.h
@@ -31,12 +31,16 @@ test_lstat_func (int (*func) (char const *, struct stat *), bool print)
/* Test for common directories. */
ASSERT (func (".", &st1) == 0);
ASSERT (func ("./", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
ASSERT (SAME_INODE (st1, st2));
+#endif
ASSERT (S_ISDIR (st1.st_mode));
ASSERT (S_ISDIR (st2.st_mode));
ASSERT (func ("/", &st1) == 0);
ASSERT (func ("///", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
ASSERT (SAME_INODE (st1, st2));
+#endif
ASSERT (S_ISDIR (st1.st_mode));
ASSERT (S_ISDIR (st2.st_mode));
ASSERT (func ("..", &st1) == 0);
@@ -85,7 +89,9 @@ test_lstat_func (int (*func) (char const *, struct stat *), bool print)
ASSERT (stat (BASE "link1", &st2) == 0);
ASSERT (S_ISDIR (st1.st_mode));
ASSERT (S_ISDIR (st2.st_mode));
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
ASSERT (SAME_INODE (st1, st2));
+#endif
ASSERT (func (BASE "link2", &st1) == 0);
ASSERT (S_ISLNK (st1.st_mode));
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-02 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 17:45 stat tests: fix test failure on MSVC Bruno Haible
2019-07-02 17:48 ` lstat " Bruno Haible
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).