summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-05-25 16:52:06 -0700
committerJim Meyering <meyering@fb.com>2014-05-28 08:49:13 -0700
commit9e661325e5725c13dbaab898b183f286b193baf7 (patch)
tree11adc8d7238cf7d34e7d3df55cf11578a616ecc2
parent591c7f6f39fff9126d7aa05c24e95961a91fd27f (diff)
downloadparted-9e661325e5725c13dbaab898b183f286b193baf7.tar.gz
tests: avoid false-positive failure due to symlink
* tests/t6000-dm.sh (sanitize): Helper function. Before this change, this test would fail due to difference between absolute name and symlink-including names in "parted print" output
-rwxr-xr-xtests/t6000-dm.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh
index 3513e58..5b29660 100755
--- a/tests/t6000-dm.sh
+++ b/tests/t6000-dm.sh
@@ -47,6 +47,12 @@ f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") || fail=1
f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") || fail=1
+# In the output of parted's print -s command,
+# replace (possibly varying) $dev name with '...'.
+sanitize() {
+ sed 's,^Disk .*: \([0-9][0-9]*\),Disk ...: \1,;s/ *$//' "$@"
+}
+
# This loop used to include "multipath", but lvm2 changed
# in such a way that that no longer works with loop devices.
# FIXME: use two scsi_debug devices instead.
@@ -72,12 +78,12 @@ for type in linear ; do
compare /dev/null out || fail=1
parted -s "$dev" print > out 2>&1 || fail=1
- sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
+ sanitize out > k && mv k out || fail=1
# Create expected output file.
cat <<EOF >> exp || fail=1
Model: Linux device-mapper ($type) (dm)
-Disk $dev: 524kB
+Disk ...: 524kB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: