diff options
author | Pavel Reichl <preichl@redhat.com> | 2022-12-20 14:13:29 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2023-03-20 16:32:10 +0000 |
commit | c076dff259e99d84d3822b4d2ad7f3f66532f411 (patch) | |
tree | 0f3d5a57ab30cbc3ba39b7cd54091f2547772908 /tests/prepare.inc.sh | |
parent | 2939c50f7fdd0105e3ddcafab525bfa32c34981c (diff) | |
download | keyutils-master.tar.gz |
Some test results are dependent on the kernel configuration option
CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE.
Check the kernel configuration file for its presence and expect appropriate
test results.
Function has_kernel_config is based on its xfstsests counterpart.
Signed-off-by: Pavel Reichl <preichl@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'tests/prepare.inc.sh')
-rw-r--r-- | tests/prepare.inc.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/prepare.inc.sh b/tests/prepare.inc.sh index 0b66237..4033d69 100644 --- a/tests/prepare.inc.sh +++ b/tests/prepare.inc.sh @@ -4,6 +4,26 @@ includes=${BASH_SOURCE[0]} includes=${includes%/*}/ +# Check if currently running kernel has option set +function has_kernel_config() +{ + local option=$1 + local uname=$(uname -r) + local config_list="$KCONFIG_PATH + /lib/modules/$uname/build/.config + /boot/config-$uname + /lib/kernel/config-$uname" + + for config in $config_list; do + [ ! -f $config ] && continue + grep -qE "^${option}=[my]" $config + return + done + + echo "Failed to find kernel configuration file" + return false +} + # --- need to run in own session keyring watch_fd=0 if [ "$1" != "--inside-test-session" ] |