summaryrefslogtreecommitdiff
path: root/test/units/testsuite-46.sh
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2020-04-19 16:20:03 +0200
committerLennart Poettering <lennart@poettering.net>2020-04-21 22:09:35 +0200
commitff3518f1f464bfc1b910499b64e26d3f8d60ba71 (patch)
tree9bd124fda2bc677fe75267c3c3eb6d30db71cd6d /test/units/testsuite-46.sh
parentc5ca6d9076b5c620e91985ac8b4e90a70563cf3b (diff)
downloadsystemd-ff3518f1f464bfc1b910499b64e26d3f8d60ba71.tar.gz
test: drop Disk (Size|Free|Floor|Ceiling) fields prior comparing
The disk attributes can take some time to update on certain filesystems, so let's strip them from inputs of both `homectl` and `userdbctl` before comparing them to avoid unexpected fails. Also, switch from `cmp` to `diff` to make a potential test fail a bit more debuggable. Fixes: #14755
Diffstat (limited to 'test/units/testsuite-46.sh')
-rwxr-xr-xtest/units/testsuite-46.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh
index 9ef9f30f1e..00bbdf507e 100755
--- a/test/units/testsuite-46.sh
+++ b/test/units/testsuite-46.sh
@@ -9,9 +9,16 @@ if ! test -x /usr/bin/homectl ; then
fi
inspect() {
+ # As updating disk-size-related attributes can take some time on
+ # some filesystems, let's drop these fields before comparing the
+ # outputs to avoid unexpected fails. To see the full outputs of both
+ # homectl & userdbctl (for debugging purposes) drop the fields just
+ # before the comparison.
homectl inspect $1 | tee /tmp/a
userdbctl user $1 | tee /tmp/b
- cmp /tmp/a /tmp/b
+
+ local PATTERN='/^\s*Disk (Size|Free|Floor|Ceiling):/d'
+ diff <(sed -r "$PATTERN" /tmp/a) <(sed -r "$PATTERN" /tmp/b)
rm /tmp/a /tmp/b
}