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:
intrigeri 2022-07-25 10:04:13 +00:00
parent c0b5d90848
commit c0815d0e0f
2 changed files with 3 additions and 2 deletions

View file

@ -31,8 +31,9 @@ do_tst() {
shift 2
#global tmpdir
${APPARMOR_PARSER} "$@" > "$tmpdir/out" 2>/dev/null
${APPARMOR_PARSER} "$@" > "$tmpdir/out.unsorted" 2>/dev/null
rc=$?
LC_ALL=C sort "$tmpdir/out.unsorted" > "$tmpdir/out"
if [ $rc -ne 0 ] && [ "$expected" != "fail" ] ; then
echo "failed: expected \"$expected\" but parser returned error"
return 1

View file

@ -1,3 +1,3 @@
good_target
a_profile
b_profile
good_target