mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
dirtest.sh: don't rely on apparmor_parser -N's output sort order to be deterministic
I've seen this test fail because "apparmor_parser -N" returned the expected lines, but in a different order than what's expected (dirtest.out). To fix this, sort both the expected and actual output.
This commit is contained in:
parent
c0b5d90848
commit
c0815d0e0f
@ -31,8 +31,9 @@ do_tst() {
|
|||||||
shift 2
|
shift 2
|
||||||
#global tmpdir
|
#global tmpdir
|
||||||
|
|
||||||
${APPARMOR_PARSER} "$@" > "$tmpdir/out" 2>/dev/null
|
${APPARMOR_PARSER} "$@" > "$tmpdir/out.unsorted" 2>/dev/null
|
||||||
rc=$?
|
rc=$?
|
||||||
|
LC_ALL=C sort "$tmpdir/out.unsorted" > "$tmpdir/out"
|
||||||
if [ $rc -ne 0 ] && [ "$expected" != "fail" ] ; then
|
if [ $rc -ne 0 ] && [ "$expected" != "fail" ] ; then
|
||||||
echo "failed: expected \"$expected\" but parser returned error"
|
echo "failed: expected \"$expected\" but parser returned error"
|
||||||
return 1
|
return 1
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
good_target
|
|
||||||
a_profile
|
a_profile
|
||||||
b_profile
|
b_profile
|
||||||
|
good_target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user