bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

stat tests: fix test failure on MSVC


From: Bruno Haible
Subject: stat tests: fix test failure on MSVC
Date: Tue, 02 Jul 2019 19:45:25 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-151-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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 via email to

[Prev in Thread] Current Thread [Next in Thread]