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
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
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