From 4789b011b30bf2040626fed5f466b66bcae8070e Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 6 Oct 2024 20:46:16 +0300 Subject: [PATCH] Improve and reorder the functional tests --- .github/workflows/functional_test.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/functional_test.sh b/.github/workflows/functional_test.sh index bdeefc4..7c11957 100644 --- a/.github/workflows/functional_test.sh +++ b/.github/workflows/functional_test.sh @@ -92,6 +92,7 @@ coverage run -a --branch bin/kernel-hardening-checker -s /tmp/sysctl_arch | grep echo ">>>>> check sysctl separately <<<<<" coverage run -a --branch bin/kernel-hardening-checker -s $SYSCTL_EXAMPLE +coverage run -a --branch bin/kernel-hardening-checker -s /etc/sysctl.conf coverage run -a --branch bin/kernel-hardening-checker -s $SYSCTL_EXAMPLE -m verbose > /dev/null coverage run -a --branch bin/kernel-hardening-checker -s $SYSCTL_EXAMPLE -m json coverage run -a --branch bin/kernel-hardening-checker -s $SYSCTL_EXAMPLE -m show_ok @@ -131,16 +132,6 @@ coverage run -a --branch bin/kernel-hardening-checker -g X86_64 -m show_ok && ex echo ">>>>> no kconfig file <<<<<" coverage run -a --branch bin/kernel-hardening-checker -c ./nosuchfile && exit 1 -echo ">>>>> no cmdline file <<<<<" -coverage run -a --branch bin/kernel-hardening-checker -c ./test.config -l ./nosuchfile && exit 1 - -echo ">>>>> empty cmdline file <<<<<" -touch ./empty_file -coverage run -a --branch bin/kernel-hardening-checker -c ./test.config -l ./empty_file && exit 1 - -echo ">>>>> no sysctl file <<<<<" -coverage run -a --branch bin/kernel-hardening-checker -s ./nosuchfile && exit 1 - echo ">>>>> no kernel version <<<<<" sed '3d' test.config > error.config coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1 @@ -182,17 +173,27 @@ cp test.config error.config echo 'some strange line' >> error.config coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1 +echo ">>>>> no cmdline file <<<<<" +coverage run -a --branch bin/kernel-hardening-checker -c ./test.config -l ./nosuchfile && exit 1 + +echo ">>>>> empty cmdline file <<<<<" +touch ./empty_file +coverage run -a --branch bin/kernel-hardening-checker -c ./test.config -l ./empty_file && exit 1 + echo ">>>>> multi-line cmdline file <<<<<" echo 'hey man 1' > cmdline echo 'hey man 2' >> cmdline coverage run -a --branch bin/kernel-hardening-checker -c test.config -l cmdline && exit 1 +echo ">>>>> no sysctl file <<<<<" +coverage run -a --branch bin/kernel-hardening-checker -s ./nosuchfile && exit 1 + +echo ">>>>> empty sysctl file <<<<<" +coverage run -a --branch bin/kernel-hardening-checker -c test.config -s empty_file && exit 1 + echo ">>>>> unexpected line in the sysctl file <<<<<" cp $SYSCTL_EXAMPLE error_sysctls echo 'some strange line' >> error_sysctls coverage run -a --branch bin/kernel-hardening-checker -c test.config -s error_sysctls && exit 1 -echo ">>>>> invalid sysctl file <<<<<" -coverage run -a --branch bin/kernel-hardening-checker -c test.config -s empty_file && exit 1 - echo "The end of the functional tests" -- 2.31.1