summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-10-17 15:52:02 +0000
committerngie <ngie@FreeBSD.org>2017-10-17 15:52:02 +0000
commit2dfbb409bb2b3a1f2b28d3c853040a3cf9dccef9 (patch)
tree1972b5767aa7acfec1b250e2a9e3ad18c8511196 /tests
parentb8515f8f387edbf541e0be5a7b346ad69e2db1ea (diff)
downloadFreeBSD-src-2dfbb409bb2b3a1f2b28d3c853040a3cf9dccef9.zip
FreeBSD-src-2dfbb409bb2b3a1f2b28d3c853040a3cf9dccef9.tar.gz
MFC r324478:
Check the exit code from fsck_ffs instead of relying on MODIFIED being in the output ^/head@r323923 changed when MODIFIED is printed at exit. It's better to follow the documented way of determining whether or not a filesystem is clean per fsck_ffs, i.e., ensure that the exit code is either 0 or 7. The pass/fail determination is brittle prior to this commit, and ^/head@r323923 made the issue apparent -- thus this needs to be fixed independent of ^/head@r323923. PR: 222780 MFC with: r323923
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/geom/class/eli/resize_test.sh33
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/sys/geom/class/eli/resize_test.sh b/tests/sys/geom/class/eli/resize_test.sh
index 67d6291..e5ce6fd 100644
--- a/tests/sys/geom/class/eli/resize_test.sh
+++ b/tests/sys/geom/class/eli/resize_test.sh
@@ -12,6 +12,19 @@ md=$(mdconfig -s40m) || exit 1
unit=${md#md}
i=1
+fsck_md()
+{
+ local is_clean
+
+ out=$(fsck_ffs -Ffy ${md}a.eli)
+ if [ $? -eq 0 -o $? -eq 7 ]; then
+ echo "ok $i - fsck says ${md}a.eli is clean"
+ else
+ echo "not ok $i - fsck says ${md}a.eli is dirty"
+ fi
+ i=$((i + 1))
+}
+
setsize() {
partszMB=$1 unitszMB=$2
@@ -38,12 +51,7 @@ i=$((i + 1))
newfs -U ${md}a.eli >/dev/null || echo -n "not "
echo ok $i - "Initialised the filesystem on ${md}a.eli"
i=$((i + 1))
-out=$(fsck -tufs -y ${md}a.eli)
-echo "$out" | fgrep -q MODIFIED && echo -n "not "
-echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- "lines of output"
-i=$((i + 1))
-
+fsck_md
# Doing a backup, resize & restore must be forced (with -f) as geli
# verifies that the provider size in the metadata matches the consumer.
@@ -78,12 +86,7 @@ growfs -y ${md}a.eli >/dev/null || echo -n "not "
echo ok $i - "Extended the filesystem on ${md}a.eli"
i=$((i + 1))
-out=$(fsck -tufs -y ${md}a.eli)
-echo "$out" | fgrep -q MODIFIED && echo -n "not "
-echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- "lines of output"
-i=$((i + 1))
-
+fsck_md
# Now do the resize properly
@@ -110,11 +113,7 @@ growfs -y ${md}a.eli >/dev/null || echo -n "not "
echo ok $i - "Extended the filesystem on ${md}a.eli"
i=$((i + 1))
-out=$(fsck -tufs -y ${md}a.eli)
-echo "$out" | fgrep -q MODIFIED && echo -n "not "
-echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- "lines of output"
-i=$((i + 1))
+fsck_md
geli detach ${md}a.eli
gpart destroy -F $md >/dev/null
OpenPOWER on IntegriCloud