From: Frantisek Sumsal Date: Thu, 18 Nov 2021 16:19:03 +0000 (+0100) Subject: test: make the diff regex BRE-compatible X-Git-Tag: v250-rc1~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1285252823c9d7766987043ba04eb03cb2b67875;p=thirdparty%2Fsystemd.git test: make the diff regex BRE-compatible Since the GNU `diff` utility uses grep-style regular expressions[0], which use the BRE style, we need to tweak the regex to make it work properly (most notably - in BRE the meta characters need to be escaped). ``` $ diff a b 21c21 < Volume Key: 256bit --- > Volume Key: 257bit 25c25 < Disk Ceiling: 323.2M --- > Disk Ceiling: 323.1M $ diff -I '^\s*Disk (Size|Free|Floor|Ceiling):' a b 21c21 < Volume Key: 256bit --- > Volume Key: 257bit 25c25 < Disk Ceiling: 323.2M --- > Disk Ceiling: 323.1M $ diff -I '^\s*Disk \(Size\|Free\|Floor\|Ceiling\):' a b && echo OK 21c21 < Volume Key: 256bit --- > Volume Key: 257bit ``` Caught in one of the nightly CentOS CI cron jobs. [0] https://www.gnu.org/software/diffutils/manual/html_node/Specified-Lines.html --- diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh index 6c70b32d45c..a136e727d79 100755 --- a/test/units/testsuite-46.sh +++ b/test/units/testsuite-46.sh @@ -19,7 +19,8 @@ inspect() { homectl inspect "$USERNAME" | tee /tmp/a userdbctl user "$USERNAME" | tee /tmp/b - diff -I '/^\s*Disk (Size|Free|Floor|Ceiling):/' /tmp/{a,b} + # diff uses the grep BREs for pattern matching + diff -I '^\s*Disk \(Size\|Free\|Floor\|Ceiling\):' /tmp/{a,b} rm /tmp/{a,b} }