73aa139585
- libparted: Fix bug with dupe and empty name
48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
From 9e661325e5725c13dbaab898b183f286b193baf7 Mon Sep 17 00:00:00 2001
|
|
From: Jim Meyering <meyering@fb.com>
|
|
Date: Sun, 25 May 2014 16:52:06 -0700
|
|
Subject: [PATCH 121/125] 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
|
|
---
|
|
tests/t6000-dm.sh | 10 ++++++++--
|
|
1 file 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:
|
|
--
|
|
1.9.3
|
|
|