2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-01 06:45:38 +00:00

dirtest.sh: error out on unexpected success

... if a test is expected to fail, but succeeds.

Also fix the copyright year - the test was created in 2022, not in 2013.

This fixes my comments on
bd78b6b292
This commit is contained in:
Christian Boltz
2022-04-03 17:45:24 +02:00
parent 83685ba703
commit 2036f6fa9d

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) 2013
# Copyright (c) 2022
# Canonical, Ltd. (All rights reserved)
#
# This program is free software; you can redistribute it and/or
@@ -37,7 +37,11 @@ do_tst() {
echo "failed: expected \"$expected\" but parser returned error"
return 1
fi
if ! diff -q "$tmpdir/out" dirtest/dirtest.out ; then
if [ $rc -eq 0 ] && [ "$expected" = "fail" ] ; then
echo "succeeded unexpectedly: expected \"$expected\" but parser returned success"
return 1
fi
if ! diff -q "$tmpdir/out" dirtest/dirtest.out ; then
echo "failed: expected \"$expected\" but output comparison failed"
diff -u dirtest/dirtest.out "$tmpdir/out"
return 1