]> Savannah Git Hosting - gnulib.git/commitdiff
supersede: Fix test failure under QEMU user-mode for Linux/mips.
authorBruno Haible <bruno@clisp.org>
Mon, 30 Aug 2021 00:36:31 +0000 (02:36 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 30 Aug 2021 00:36:31 +0000 (02:36 +0200)
* tests/test-supersede-open.h (test_open_supersede): Copy statbuf.st_dev
into a local variable of type dev_t.
* tests/test-supersede-fopen.h (test_fopen_supersede): Likewise.

ChangeLog
tests/test-supersede-fopen.h
tests/test-supersede-open.h

index 7933058e8f4bd2394a6e1ae72c754b9b9c2da54e..df3f0481f6e8c22a5ad3826873465c0c1fedc5bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-08-29  Bruno Haible  <bruno@clisp.org>
+
+       supersede: Fix test failure under QEMU user-mode for Linux/mips.
+       * tests/test-supersede-open.h (test_open_supersede): Copy statbuf.st_dev
+       into a local variable of type dev_t.
+       * tests/test-supersede-fopen.h (test_fopen_supersede): Likewise.
+
 2021-08-29  Bruno Haible  <bruno@clisp.org>
 
        spawn-pipe: Fix test failure when running under QEMU user-mode.
index 1cf231bd934ed9c5769052cd35febf1f1e7cdaef..62d5e0e40757e1cc069423027d5176b38875878a 100644 (file)
@@ -92,7 +92,9 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist
         /* Verify that the file now has a different inode number, on the same
            device.  */
 #if !(defined _WIN32 && !defined __CYGWIN__)
-        ASSERT (memcmp (&orig_dev, &statbuf.st_dev, sizeof (dev_t)) == 0);
+        /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
+        dev_t new_dev = statbuf.st_dev;
+        ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0);
         ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
 #endif
       }
@@ -162,7 +164,9 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist
             /* Verify that the file now has a different inode number, on the
                same device.  */
 #if !(defined _WIN32 && !defined __CYGWIN__)
-            ASSERT (memcmp (&orig_dev, &statbuf.st_dev, sizeof (dev_t)) == 0);
+            /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
+            dev_t new_dev = statbuf.st_dev;
+            ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0);
             ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
 #endif
           }
index c05effa56b7cd23f01306a33d1e3fb75cfa901cf..0814eea0dae611997a717cb77595a421b66a5b46 100644 (file)
@@ -90,7 +90,9 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist)
         /* Verify that the file now has a different inode number, on the same
            device.  */
 #if !(defined _WIN32 && !defined __CYGWIN__)
-        ASSERT (memcmp (&orig_dev, &statbuf.st_dev, sizeof (dev_t)) == 0);
+        /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
+        dev_t new_dev = statbuf.st_dev;
+        ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0);
         ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
 #endif
       }
@@ -159,7 +161,9 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist)
             /* Verify that the file now has a different inode number, on the
                same device.  */
 #if !(defined _WIN32 && !defined __CYGWIN__)
-            ASSERT (memcmp (&orig_dev, &statbuf.st_dev, sizeof (dev_t)) == 0);
+            /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
+            dev_t new_dev = statbuf.st_dev;
+            ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0);
             ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
 #endif
           }