test: fix apparmor detection

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-12-06 12:10:32 +01:00
parent 79073df3c2
commit 15f23bc6ac
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 8 additions and 12 deletions

View file

@ -16,7 +16,7 @@ function teardown() {
# this test requires apparmor, so skip this test if apparmor is not enabled.
enabled=is_apparmor_enabled
if [[ "$enabled" =~ "0" ]]; then
if [[ "$enabled" = "0" ]]; then
skip "skip this test since apparmor is not enabled."
fi
@ -53,7 +53,7 @@ function teardown() {
# this test requires apparmor, so skip this test if apparmor is not enabled.
enabled=is_apparmor_enabled
if [[ "$enabled" =~ "0" ]]; then
if [[ "$enabled" -eq "0" ]]; then
skip "skip this test since apparmor is not enabled."
fi
@ -92,7 +92,7 @@ function teardown() {
# this test requires apparmor, so skip this test if apparmor is not enabled.
enabled=is_apparmor_enabled
if [[ "$enabled" =~ "0" ]]; then
if [[ "$enabled" -eq "0" ]]; then
skip "skip this test since apparmor is not enabled."
fi
@ -131,7 +131,7 @@ function teardown() {
# this test requires apparmor, so skip this test if apparmor is not enabled.
enabled=is_apparmor_enabled
if [[ "$enabled" =~ "0" ]]; then
if [[ "$enabled" -eq "0" ]]; then
skip "skip this test since apparmor is not enabled."
fi

View file

@ -161,12 +161,10 @@ function is_seccomp_enabled() {
out=$(cat "$BOOT_CONFIG_FILE_PATH" | grep CONFIG_SECCOMP=)
if [[ "$out" =~ "CONFIG_SECCOMP=y" ]]; then
echo 1
else
echo 0
return
fi
else
echo 0
fi
echo 0
}
function is_apparmor_enabled() {
@ -174,10 +172,8 @@ function is_apparmor_enabled() {
out=$(cat "$APPARMOR_PARAMETERS_FILE_PATH")
if [[ "$out" =~ "Y" ]]; then
echo 1
else
echo 0
return
fi
else
echo 0
fi
echo 0
}