test: Skip landlock specific tests if unavailble during compile time
This commit is contained in:
parent
2a4cee2ece
commit
435bcefa48
12
test.c
12
test.c
@ -199,6 +199,7 @@ static int test_seccomp_group()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HAVE_LANDLOCK == 1
|
||||
int test_landlock()
|
||||
{
|
||||
struct qssb_policy *policy = qssb_init_policy();
|
||||
@ -226,6 +227,17 @@ int test_landlock_deny_write()
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
int test_landlock()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
int test_landlock_deny_write()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
int test_nofs()
|
||||
{
|
||||
|
18
test.sh
18
test.sh
@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
COUNT_SUCCEEDED=0
|
||||
COUNT_FAILED=0
|
||||
COUNT_SKIPPED=0
|
||||
|
||||
function print_fail()
|
||||
{
|
||||
@ -16,6 +18,11 @@ function print_success()
|
||||
echo -e "${GREEN}$@${NC}"
|
||||
}
|
||||
|
||||
function print_skipped()
|
||||
{
|
||||
echo -e "${YELLOW}$@${NC}"
|
||||
}
|
||||
|
||||
function runtest_fail()
|
||||
{
|
||||
print_fail "failed"
|
||||
@ -28,6 +35,12 @@ function runtest_success()
|
||||
COUNT_SUCCEEDED=$((COUNT_SUCCEEDED+1))
|
||||
}
|
||||
|
||||
function runtest_skipped()
|
||||
{
|
||||
print_skipped "skipped"
|
||||
COUNT_SKIPPED=$((COUNT_SKIPPED+1))
|
||||
}
|
||||
|
||||
|
||||
function runtest()
|
||||
{
|
||||
@ -44,6 +57,9 @@ function runtest()
|
||||
if [ $ret -eq 0 ] ; then
|
||||
runtest_success
|
||||
SUCCESS="yes"
|
||||
elif [ $ret -eq 2 ] ; then
|
||||
runtest_skipped
|
||||
SUCCESS="skipped"
|
||||
else
|
||||
runtest_fail
|
||||
fi
|
||||
@ -69,7 +85,7 @@ echo
|
||||
echo "Tests finished. Logs in $(realpath ${LOG_OUTPUT_DIR_PATH})"
|
||||
echo "Succeeded: $COUNT_SUCCEEDED"
|
||||
echo "Failed: $COUNT_FAILED"
|
||||
|
||||
echo "Skipped: $COUNT_SKIPPED"
|
||||
|
||||
if [ $COUNT_FAILED -gt 0 ] ; then
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user