projects
/
kconfig-hardened-check.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae11f04
)
Code refactoring to improve test coverage (II)
author
Alexander Popov
<alex.popov@linux.com>
Mon, 10 Jun 2024 13:13:28 +0000
(16:13 +0300)
committer
Alexander Popov
<alex.popov@linux.com>
Mon, 10 Jun 2024 13:13:28 +0000
(16:13 +0300)
Test the `-v` argument.
.github/workflows/functional_test.sh
patch
|
blob
|
history
diff --git
a/.github/workflows/functional_test.sh
b/.github/workflows/functional_test.sh
index ca50aafaa733e14ddd333478d84a7e86e516c1f5..d894c94a2a18b11331d2e82e18769ba42c5bbaba 100644
(file)
--- 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
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 <<<<<"
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 <<<<<"
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 ">>>>> -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
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
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
sed '3d' test.config > error.config
coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1
-echo ">>>>> strange kernel version
strin
g <<<<<"
+echo ">>>>> strange kernel version
in kconfi
g <<<<<"
sed '3 s/5./version 5./' test.config > error.config
coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1
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
echo ">>>>> no arch <<<<<"
sed '305d' test.config > error.config
coverage run -a --branch bin/kernel-hardening-checker -c error.config && exit 1