fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <guaneryu@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH] overlay/07[01]: use existing char/block devices
Date: Mon, 16 Mar 2020 20:53:20 +0200	[thread overview]
Message-ID: <20200316185320.26947-1-amir73il@gmail.com> (raw)

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


                 reply	other threads:[~2020-03-16 18:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200316185320.26947-1-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).