nbdkit/0003-tests-Use-mke2fs-d-to-...

81 lines
2.5 KiB
Diff

From 771a8c9386893f3c908dae5a551121db02b1f96c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Dec 2021 20:21:26 +0000
Subject: [PATCH] tests: Use mke2fs -d to create ext4 test image
We used guestfish for this, but that was very slow (albeit working) on
armv7. Since this is a plain ext4 filesystem without wrapper, we can
use mke2fs -d. That was already a dependency so this doesn't change
anything.
After this change, configure tests for GUESTFISH and HAVE_GUESTFISH
are no longer used so we can remove them.
(cherry picked from commit 9b1476895a060c562e67b59a3d1aee16efafaff9)
---
configure.ac | 4 ----
tests/Makefile.am | 22 +++++++++-------------
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/configure.ac b/configure.ac
index 19514ef6..b194da61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1173,10 +1173,6 @@ AS_IF([test "$with_libguestfs" != "no"],[
])
AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
-dnl Check for guestfish (only needed for some of the tests).
-AC_CHECK_PROG([GUESTFISH], [guestfish], [guestfish], [no])
-AM_CONDITIONAL([HAVE_GUESTFISH], [test "x$GUESTFISH" != "xno"])
-
dnl Check for ext2fs and com_err, for the ext2 filter.
AC_ARG_WITH([ext2],
[AS_HELP_STRING([--without-ext2],
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5ef90b6f..2b7ae9f3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1506,7 +1506,6 @@ EXTRA_DIST += test-exportname.sh
# ext2 filter test.
if HAVE_MKE2FS_WITH_D
if HAVE_EXT2
-if HAVE_GUESTFISH
LIBGUESTFS_TESTS += test-ext2
@@ -1520,21 +1519,18 @@ EXTRA_DIST += test-ext2-exportname.sh
check_DATA += ext2.img
CLEANFILES += ext2.img
+# NB: truncate + explicit size is required because of a bug in mke2fs:
+# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1813759.html
ext2.img: disk test-ext2-exportname.sh
- rm -f $@ $@-t
- echo /disks/disk.img > manifest
- guestfish \
- sparse $@-t 2G : \
- run : \
- mkfs ext4 /dev/sda : \
- mount /dev/sda / : \
- mkdir /disks : \
- upload $< /disks/disk.img : \
- upload manifest /manifest
- rm manifest
+ rm -rf $@ $@-t ext2.img.d
+ mkdir -p ext2.img.d/disks
+ cp $< ext2.img.d/disks/disk.img
+ echo /disks/disk.img > ext2.img.d/manifest
+ truncate -s 2147483648 $@-t
+ mke2fs -q -F -t ext4 -d ext2.img.d $@-t 2147483648
+ rm -r ext2.img.d
mv $@-t $@
-endif HAVE_GUESTFISH
endif HAVE_EXT2
endif HAVE_MKE2FS_WITH_D
--
2.31.1