On 13/01/16 18:30, Pádraig Brady wrote:
>> opensuse421-test-suite.log
>> > 
>> > FAIL: tests/df/df-symlink
>> > =========================
>> > + diff -u exp out
>> > --- exp    2016-01-13 12:07:31.789282664 -0500
>> > +++ out    2016-01-13 12:07:31.793282621 -0500
>> > @@ -1,2 +1,2 @@
>> >  Filesystem     Mounted on
>> > -/dev/vda2      /
>> > +/dev/vda2      /tmp
>> > + fail=1
> $ df --out=source '.'
> /dev/vda2
> $ df --out=source,target /dev/vda2
> /dev/vda2      /
> $ df --out=source,target '.'
> /dev/vda2      /tmp

This is triggered by /home being a BTRFS subvolume.
Avoidance patch attached.

> Upon failure we really should have df tests
> output /proc/mounts and /proc/self/mountinfo if they exist
> to help debug.

Patch attached.

cheers,
Pádraig
From fa9ae62a9ee2bbdf85f30b288f41101c0c890238 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Sat, 16 Jan 2016 13:53:48 +0000
Subject: [PATCH] tests: show mount list on failure for df tests

* init.cfg (dump_mount_list_): A new function to output the
system mount list.
* tests/df/df-symlink.sh: Call dump_mount_list_ upon failure.
* tests/df/over-mount-device.sh: Likewise.
* tests/df/problematic-chars.sh: Likewise.
* tests/df/skip-rootfs.sh: Likewise.
* tests/df/total-verify.sh: Likewise.
* tests/df/unreadable.sh: Likewise.
---
 init.cfg                      | 8 ++++++++
 tests/df/df-symlink.sh        | 2 ++
 tests/df/over-mount-device.sh | 2 ++
 tests/df/problematic-chars.sh | 2 ++
 tests/df/skip-rootfs.sh       | 2 ++
 tests/df/total-verify.sh      | 2 ++
 tests/df/unreadable.sh        | 2 ++
 7 files changed, 20 insertions(+)

diff --git a/init.cfg b/init.cfg
index 108fd20..db86194 100644
--- a/init.cfg
+++ b/init.cfg
@@ -92,6 +92,14 @@ require_mount_list_()
     skip_ "$mount_list_fail"
 }
 
+dump_mount_list_()
+{
+  cat /proc/self/mountinfo ||
+  cat /proc/self/mounts ||
+  cat /proc/mounts ||
+  cat /etc/mtab
+}
+
 require_local_dir_()
 {
   require_mount_list_
diff --git a/tests/df/df-symlink.sh b/tests/df/df-symlink.sh
index a9d8c96..01dff24 100755
--- a/tests/df/df-symlink.sh
+++ b/tests/df/df-symlink.sh
@@ -39,4 +39,6 @@ if test "$(df --output=source | grep -F "$disk" | wc -l)" = 1; then
   compare exp out || fail=1
 fi
 
+test "$fail" = 1 && dump_mount_list_
+
 Exit $fail
diff --git a/tests/df/over-mount-device.sh b/tests/df/over-mount-device.sh
index eb8af92..479d36d 100755
--- a/tests/df/over-mount-device.sh
+++ b/tests/df/over-mount-device.sh
@@ -54,4 +54,6 @@ test $(wc -l < out) = 2 || fail=1
 
 compare exp err || fail=1
 
+test "$fail" = 1 && dump_mount_list_
+
 Exit $fail
diff --git a/tests/df/problematic-chars.sh b/tests/df/problematic-chars.sh
index 2020a12..59ee055 100755
--- a/tests/df/problematic-chars.sh
+++ b/tests/df/problematic-chars.sh
@@ -41,4 +41,6 @@ test $skip = 1 \
 
 test $(df "$mnt" | wc -l) = 2 || fail=1
 
+test "$fail" = 1 && dump_mount_list_
+
 Exit $fail
diff --git a/tests/df/skip-rootfs.sh b/tests/df/skip-rootfs.sh
index e79d424..c893144 100755
--- a/tests/df/skip-rootfs.sh
+++ b/tests/df/skip-rootfs.sh
@@ -48,4 +48,6 @@ grep '^rootfs' out || { fail=1; cat out; }
 df -a -x rootfs >out || fail=1
 grep '^rootfs' out && { fail=1; cat out; }
 
+test "$fail" = 1 && dump_mount_list_
+
 Exit $fail
diff --git a/tests/df/total-verify.sh b/tests/df/total-verify.sh
index d0b2b7b..79722e4 100755
--- a/tests/df/total-verify.sh
+++ b/tests/df/total-verify.sh
@@ -62,4 +62,6 @@ cat inode
 $PERL check-df space || fail=1
 $PERL check-df inode || fail=1
 
+test "$fail" = 1 && dump_mount_list_
+
 Exit $fail
diff --git a/tests/df/unreadable.sh b/tests/df/unreadable.sh
index c1c990f..c575472 100755
--- a/tests/df/unreadable.sh
+++ b/tests/df/unreadable.sh
@@ -24,4 +24,6 @@ touch unreadable || fail=1
 chmod a-r unreadable || fail=1
 df unreadable || fail=1
 
+test "$fail" = 1 && dump_mount_list_
+
 Exit $fail
-- 
2.5.0

From 2a5494271c3ffa371cdc8773cd12682f3d5c678f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Sat, 16 Jan 2016 13:34:07 +0000
Subject: [PATCH] tests: avoid false failure with BTRFS subvolumes

* tests/df/df-symlink.sh: Only check the symmetry of
the source <-> target lookup, when the source is only mounted once,
which isn't the case if '.' is a BTRFS subvolume for example.
Reported by Assaf Gordon on a default OpenSUSE 42.1 install.
---
 tests/df/df-symlink.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/df/df-symlink.sh b/tests/df/df-symlink.sh
index ed4c788..a9d8c96 100755
--- a/tests/df/df-symlink.sh
+++ b/tests/df/df-symlink.sh
@@ -32,7 +32,11 @@ compare exp out || fail=1
 # This was not the case in coreutil-8.22 on systems
 # where the device in the mount list was a symlink itself.
 # I.e., '.' => /dev/mapper/fedora-home -> /dev/dm-2
-df --out=source,target '.' > out || fail=1
-compare exp out || fail=1
+# Restrict this test to systems with a 1:1 mapping between
+# source and target.  This excludes for example BTRFS sub-volumes.
+if test "$(df --output=source | grep -F "$disk" | wc -l)" = 1; then
+  df --out=source,target '.' > out || fail=1
+  compare exp out || fail=1
+fi
 
 Exit $fail
-- 
2.5.0

Reply via email to