FSTests Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] overlay/07[01]: use existing char/block devices
@ 2020-03-16 18:53 Amir Goldstein
  0 siblings, 0 replies; only message in thread
From: Amir Goldstein @ 2020-03-16 18:53 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Miklos Szeredi, linux-unionfs, fstests

If the arbitrary char/block devices 1:1 do not exist in the system,
the tests fail.
Use /dev/zero and loop device instead of made up device numbers.

Reposted-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 tests/overlay/070 | 10 ++++++++--
 tests/overlay/071 | 10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/overlay/070 b/tests/overlay/070
index 3256e63b..dfa2eb28 100755
--- a/tests/overlay/070
+++ b/tests/overlay/070
@@ -32,6 +32,7 @@ _cleanup()
 	rm -f $tmp.*
 	# Unmount the nested overlay mount
 	$UMOUNT_PROG $mnt2 2>/dev/null
+	[ -z "$loopdev" ] || _destroy_loop_device $loopdev
 }
 
 # get standard environment, filters and checks
@@ -48,6 +49,7 @@ _require_command "$FLOCK_PROG" "flock"
 # We need to require all features together, because nfs_export cannot
 # be enabled when index is disabled
 _require_scratch_overlay_features index nfs_export redirect_dir
+_require_loop
 
 lower=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
 upper=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
@@ -69,6 +71,10 @@ create_dirs()
 
 	# Create the nested overlay upper dirs
 	mkdir -p $upper2 $work2 $mnt2
+
+	# Create a loop device for blkdev tests
+	$XFS_IO_PROG -f -c "truncate 128k" $lower/img >> $seqres.full 2>&1
+	loopdev=`_create_loop_device $lower/img`
 }
 
 # Mount a nested overlay with $SCRATCH_MNT as lower layer
@@ -116,8 +122,8 @@ create_test_files()
 	ln -s $dir/file $dir/symlink
 	touch $dir/link
 	ln $dir/link $dir/link2
-	mknod $dir/chrdev c 1 1
-	mknod $dir/blkdev b 1 1
+	cp -a /dev/zero $dir/chrdev
+	cp -a $loopdev $dir/blkdev
 	mknod $dir/fifo p
 	$here/src/af_unix $dir/socket
 }
diff --git a/tests/overlay/071 b/tests/overlay/071
index b8597e6e..e083c29d 100755
--- a/tests/overlay/071
+++ b/tests/overlay/071
@@ -35,6 +35,7 @@ _cleanup()
 	rm -f $tmp.*
 	# Unmount the nested overlay mount
 	$UMOUNT_PROG $mnt2 2>/dev/null
+	[ -z "$loopdev" ] || _destroy_loop_device $loopdev
 }
 
 # get standard environment, filters and checks
@@ -52,6 +53,7 @@ _require_command "$FLOCK_PROG" "flock"
 # We need to require all features together, because nfs_export cannot
 # be enabled when index is disabled
 _require_scratch_overlay_features index nfs_export redirect_dir
+_require_loop
 
 # Lower overlay lower layer is on test fs, upper is on scratch fs
 lower=$OVL_BASE_TEST_MNT/$OVL_LOWER-$seq
@@ -75,6 +77,10 @@ create_dirs()
 	# Re-create the nested overlay upper dirs
 	rm -rf $lower $upper2 $work2 $mnt2
 	mkdir $lower $upper2 $work2 $mnt2
+
+	# Create a loop device for blkdev tests
+	$XFS_IO_PROG -f -c "truncate 128k" $lower/img >> $seqres.full 2>&1
+	loopdev=`_create_loop_device $lower/img`
 }
 
 # Mount a nested overlay with $SCRATCH_MNT as lower layer
@@ -126,8 +132,8 @@ create_test_files()
 	ln -s $dir/file $dir/symlink
 	touch $dir/link
 	ln $dir/link $dir/link2
-	mknod $dir/chrdev c 1 1
-	mknod $dir/blkdev b 1 1
+	cp -a /dev/zero $dir/chrdev
+	cp -a $loopdev $dir/blkdev
 	mknod $dir/fifo p
 	$here/src/af_unix $dir/socket
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 18:53 [PATCH] overlay/07[01]: use existing char/block devices Amir Goldstein

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git