tests: use ts_is_mounted in mount/regfile
PATCH 1/1 tests: use ts_is_mounted in mount/regfile
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
Quoted 1 line
From
2bc401aed37d73665b23a17a4c6ad0f6d4572a76Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
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.
--- tests/ts/mount/regfile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tests/ts/mount/regfile +2 -2
@@ -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
Signature · 1 line
1.7.7
Quoted 7 lines · Bernhard Voelker
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
Quoted 2 lines · Bernhard Voelker
tests/ts/mount/regfile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Karel Zak
maintainerQuoted 6 lines · Bernhard Voelker
Quoted 2 lines
$ /home/berny/ul/umount /home/berny/ul/tests/output/mount/regfile.img umount: /home/berny/ul/tests/output/mount/regfile.img: not mountedhmm, also other tests like mount/remount are failing.
Somehow, I have the impression that
TS_MOUNTPOINTshould 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.
Quoted 2 lines
in
function.shints_init_core_envandts_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
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com