summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-08-30 02:36:31 +0200
committerBruno Haible <bruno@clisp.org>2021-08-30 02:36:31 +0200
commitac97e574f58eecc76190d046b7c1f72d2f6f4734 (patch)
treec6e8de2bf6780dd8e5d8d5a59a7292b4c3aefdc7
parentf765c6881f9b237163aa0178df3da5540f282f87 (diff)
downloadgnulib-ac97e574f58eecc76190d046b7c1f72d2f6f4734.tar.gz
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.
-rw-r--r--ChangeLog7
-rw-r--r--tests/test-supersede-fopen.h8
-rw-r--r--tests/test-supersede-open.h8
3 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7933058e8f..df3f0481f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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.
* tests/test-spawn-pipe-child.c: Include <stdbool.h>, <string.h>,
qemu.h.
diff --git a/tests/test-supersede-fopen.h b/tests/test-supersede-fopen.h
index 1cf231bd93..62d5e0e407 100644
--- a/tests/test-supersede-fopen.h
+++ b/tests/test-supersede-fopen.h
@@ -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
}
diff --git a/tests/test-supersede-open.h b/tests/test-supersede-open.h
index c05effa56b..0814eea0da 100644
--- a/tests/test-supersede-open.h
+++ b/tests/test-supersede-open.h
@@ -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
}