[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: stop using private "dev" directory for losetup
From: |
Jim Meyering |
Subject: |
[PATCH] tests: stop using private "dev" directory for losetup |
Date: |
Sat, 06 Oct 2012 11:45:13 +0200 |
This root-only test had been failing for me for a while.
Something changed (kernel? losetup? SELinux?) about how device
files not under /dev/ are handled, so I've removed the
useless-for-loopback-files hack of using a private /dev directory.
>From 478e472bf9f1c76b66a35ea75b45110152e5207d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 6 Oct 2012 11:11:32 +0200
Subject: [PATCH] tests: stop using private "dev" directory for losetup
Something about Fedora 17's losetup changed so that using a private
dev directory no longer worked. Now, simply use /dev/ directly.
* tests/t-lvm.sh: Don't use $G_dev_. Not needed, and actually
caused the t6000-dm root-only test to fail on Fedora 17.
Also, redirect less to stderr: that helps diagnose failure.
---
tests/t-lvm.sh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
index 9cee155..cf1b8b8 100644
--- a/tests/t-lvm.sh
+++ b/tests/t-lvm.sh
@@ -17,14 +17,13 @@ unsafe_losetup_()
{
f=$1
- test -n "$G_dev_" \
- || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
+ G_dev_=/dev
# Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
for slash in '' /; do
for i in 0 1 2 3 4 5 6 7 8 9; do
dev=$G_dev_/loop$slash$i
- losetup $dev > /dev/null 2>&1 && continue;
+ losetup $dev 1>&2 && continue;
losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
break
done
@@ -40,7 +39,7 @@ loop_setup_()
|| { warn_ "loop_setup_ failed: Unable to create tmp file $file"; return
1; }
# NOTE: this requires a new enough version of losetup
- dev=$(unsafe_losetup_ "$file" 2>/dev/null) \
+ dev=$(unsafe_losetup_ "$file") \
|| { warn_ "loop_setup_ failed: Unable to create loopback device"; return
1; }
echo "$dev"
--
1.8.0.rc0.18.gf84667d
- [PATCH] tests: stop using private "dev" directory for losetup,
Jim Meyering <=