@@ -209,6 +209,7 @@ verify_ima_policy()
load_ima_policy()
{
local file="$TST_DATAROOT/$REQUIRED_POLICY_CONTENT"
+ local ret
if [ "$LTP_IMA_LOAD_POLICY" != 1 ]; then
if [ "$IMA_MISSING_POLICY_CONTENT" = 1 ]; then
@@ -228,6 +229,7 @@ load_ima_policy()
fi
cat "$file" 2> log > $IMA_POLICY
+ ret=$?
if grep -q "Device or resource busy" log; then
tst_brk TBROK "loading policy failed"
fi
@@ -236,6 +238,10 @@ load_ima_policy()
tst_brk TCONF "loading unsigned policy failed"
fi
+ if [ $ret -ne 0 ]; then
+ tst_brk TBROK "loading policy failed"
+ fi
+
IMA_POLICY_LOADED=1
tst_res TINFO "example policy successfully loaded"
Parsing stderr should be enough, but check also 'cat' exit code in case of error message change or other problem. Signed-off-by: Petr Vorel <pvorel@suse.cz> --- New in v2. testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 6 ++++++ 1 file changed, 6 insertions(+)