util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests: use ts_is_mounted in mount/regfile
@ 2012-07-27  9:06 Bernhard Voelker
  2012-07-27  9:15 ` Bernhard Voelker
  2012-07-30 15:14 ` Karel Zak
  0 siblings, 2 replies; 4+ messages in thread
From: Bernhard Voelker @ 2012-07-27  9:06 UTC (permalink / raw)
  To: util-linux@vger.kernel.org

The following patch fixes a test framework failure.

However, even with this patch applied, mount/regfile still fails
because umount fails:

  $ /home/berny/ul/umount /home/berny/ul/tests/output/mount/regfile.img
  umount: /home/berny/ul/tests/output/mount/regfile.img: not mounted

  $ mount | grep regfile
  /media/sdb5/berny/git/util-linux/tests/output/mount/regfile.img on
/media/sdb5/berny/git/util-linux/tests/output/mount/regfile-mnt type ext3
(rw,relatime,errors=continue,barrier=1,data=ordered)

  $ ls -l /home/berny/ul/tests/output/mount/regfile.img $(readlink -f /home/berny/ul/tests/output/mount/regfile.img )
  -rw-r--r-- 1 root root 5242880 Jul 27 10:51 /home/berny/ul/tests/output/mount/regfile.img
  -rw-r--r-- 1 root root 5242880 Jul 27 10:51 /media/sdb5/berny/git/util-linux/tests/output/mount/regfile.img

:(

Have a nice day,
Berny



>From 2bc401aed37d73665b23a17a4c6ad0f6d4572a76 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Fri, 27 Jul 2012 11:00:17 +0200
Subject: [PATCH] tests: use ts_is_mounted in mount/regfile

If the test directory is on a symlink, then mount/regfile failed because
it did not search for the mount point in /proc/mounts canonicalized.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
---
 tests/ts/mount/regfile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ts/mount/regfile b/tests/ts/mount/regfile
index c47c7d7..8d786ad 100755
--- a/tests/ts/mount/regfile
+++ b/tests/ts/mount/regfile
@@ -21,7 +21,7 @@ $TS_CMD_MOUNT $IMAGE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT

 DEVICE=$(awk '/regfile/ { print $1 }' /proc/mounts)

-grep -q "$TS_MOUNTPOINT" /proc/mounts || ts_die "Cannot find $TS_MOUNTPOINT in /proc/mounts"
+ts_is_mounted "$TS_MOUNTPOINT" || ts_die "Cannot find $TS_MOUNTPOINT in /proc/mounts"

 if [ -f "/sys/block/$(basename $DEVICE)/loop/backing_file" ]; then
 	$TS_CMD_UMOUNT $IMAGE || ts_die "Cannot umount $IMAGE"
@@ -30,7 +30,7 @@ else
 	ts_skip "too old kernel"
 fi

-grep -q "$TS_MOUNTPOINT" /proc/mounts && ts_die "$TS_MOUNTPOINT still in /proc/mounts"
+ts_is_mounted "$TS_MOUNTPOINT" && ts_die "$TS_MOUNTPOINT still in /proc/mounts"

 ts_log "Success"
 ts_finalize
-- 
1.7.7



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests: use ts_is_mounted in mount/regfile
  2012-07-27  9:06 [PATCH] tests: use ts_is_mounted in mount/regfile Bernhard Voelker
@ 2012-07-27  9:15 ` Bernhard Voelker
  2012-07-30 15:20   ` Karel Zak
  2012-07-30 15:14 ` Karel Zak
  1 sibling, 1 reply; 4+ messages in thread
From: Bernhard Voelker @ 2012-07-27  9:15 UTC (permalink / raw)
  To: util-linux@vger.kernel.org



On 07/27/2012 11:06 AM, Bernhard Voelker wrote:
> The following patch fixes a test framework failure.
> 
> However, even with this patch applied, mount/regfile still fails
> because umount fails:
> 
>   $ /home/berny/ul/umount /home/berny/ul/tests/output/mount/regfile.img
>   umount: /home/berny/ul/tests/output/mount/regfile.img: not mounted

hmm, also other tests like mount/remount are failing.

Somehow, I have the impression that TS_MOUNTPOINT should be canonicalized
in function.sh in ts_init_core_env and ts_init_core_subtest_env, but on the
other side, this would eclipse errors like the above. WDYT?

Have a nice day,
Berny

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests: use ts_is_mounted in mount/regfile
  2012-07-27  9:06 [PATCH] tests: use ts_is_mounted in mount/regfile Bernhard Voelker
  2012-07-27  9:15 ` Bernhard Voelker
@ 2012-07-30 15:14 ` Karel Zak
  1 sibling, 0 replies; 4+ messages in thread
From: Karel Zak @ 2012-07-30 15:14 UTC (permalink / raw)
  To: Bernhard Voelker; +Cc: util-linux@vger.kernel.org

On Fri, Jul 27, 2012 at 11:06:10AM +0200, Bernhard Voelker wrote:
>  tests/ts/mount/regfile |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests: use ts_is_mounted in mount/regfile
  2012-07-27  9:15 ` Bernhard Voelker
@ 2012-07-30 15:20   ` Karel Zak
  0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2012-07-30 15:20 UTC (permalink / raw)
  To: Bernhard Voelker; +Cc: util-linux@vger.kernel.org

On Fri, Jul 27, 2012 at 11:15:16AM +0200, Bernhard Voelker wrote:
> >   $ /home/berny/ul/umount /home/berny/ul/tests/output/mount/regfile.img
> >   umount: /home/berny/ul/tests/output/mount/regfile.img: not mounted
> 
> hmm, also other tests like mount/remount are failing.
> 
> Somehow, I have the impression that TS_MOUNTPOINT should be canonicalized

 Good point.

 I have added ts_canonicalize() and improved ts_init() to use it for
 all basic paths. It's probably more robust to use realpaths everywhere.

> in function.sh in ts_init_core_env and ts_init_core_subtest_env, but on the
> other side, this would eclipse errors like the above. WDYT?

 Well, important is to detect if the filesystem is mounted. We have
 special tests for mounting by symlinks where ts_canonicalize() is not
 called for the mountpoint.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-30 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-27  9:06 [PATCH] tests: use ts_is_mounted in mount/regfile Bernhard Voelker
2012-07-27  9:15 ` Bernhard Voelker
2012-07-30 15:20   ` Karel Zak
2012-07-30 15:14 ` Karel Zak

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).