From: Alexander Popov Date: Mon, 10 Jun 2024 13:13:28 +0000 (+0300) Subject: Code refactoring to improve test coverage (II) X-Git-Tag: v0.6.10~55 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=4586e03b4526a74bcd45662634bf9d76808ae343;p=kconfig-hardened-check.git Code refactoring to improve test coverage (II) Test the `-v` argument. --- diff --git a/.github/workflows/functional_test.sh b/.github/workflows/functional_test.sh index ca50aaf..d894c94 100644 --- a/.github/workflows/functional_test.sh +++ b/.github/workflows/functional_test.sh @@ -70,13 +70,17 @@ 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 coverage run -a --branch bin/kernel-hardening-checker -s $SYSCTL_EXAMPLE -m show_fail +echo ">>>>> test -v (kernel version detection) <<<<<" +cp kernel_hardening_checker/config_files/distros/fedora_34.config ./test.config +coverage run -a --branch bin/kernel-hardening-checker -c ./test.config -v /proc/version + echo "Collect coverage for error handling" echo ">>>>> -c and -p together <<<<<" -coverage run -a --branch bin/kernel-hardening-checker -p X86_64 -c kernel_hardening_checker/config_files/distros/fedora_34.config && exit 1 +coverage run -a --branch bin/kernel-hardening-checker -p X86_64 -c ./test.config && exit 1 echo ">>>>> -c and -g together <<<<<" -coverage run -a --branch bin/kernel-hardening-checker -g X86_64 -c kernel_hardening_checker/config_files/distros/fedora_34.config && exit 1 +coverage run -a --branch bin/kernel-hardening-checker -g X86_64 -c ./test.config && exit 1 echo ">>>>> -l without -c <<<<<" coverage run -a --branch bin/kernel-hardening-checker -l /proc/cmdline && exit 1 @@ -97,8 +101,6 @@ coverage run -a --branch bin/kernel-hardening-checker -p X86_64 -m show_fail && echo ">>>>> wrong mode for -g <<<<<" coverage run -a --branch bin/kernel-hardening-checker -g X86_64 -m show_ok && exit 1 -cp kernel_hardening_checker/config_files/distros/fedora_34.config ./test.config - echo ">>>>> no kconfig file <<<<<" coverage run -a --branch bin/kernel-hardening-checker -c ./nosuchfile && exit 1 @@ -116,10 +118,14 @@ echo ">>>>> no kernel version <<<<<" sed '3d' test.config > error.config coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1 -echo ">>>>> strange kernel version string <<<<<" +echo ">>>>> strange kernel version in kconfig <<<<<" sed '3 s/5./version 5./' test.config > error.config coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1 +echo ">>>>> strange kernel version via -v <<<<<" +sed '3d' test.config > error.config +coverage run -a --branch bin/kernel-hardening-checker -c error.config -v /proc/cmdline && exit 1 + echo ">>>>> no arch <<<<<" sed '305d' test.config > error.config coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1