Files
infix/test/case/repo/defconfig.sh
T
Tobias Waldekranz 8baca7df03 test: unit: defconfig: Skip root login checks for all boot configs
Also, hoist the whitelist check up one level, so that we can report
which configs we are exempting, and which ones we are actually
checking.
2024-06-17 14:59:27 +02:00

49 lines
802 B
Bash
Executable File

#!/bin/sh
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
CONFIGS="$SCRIPT_PATH/../../../configs"
whitelist()
{
case "$1" in
*_boot_defconfig)
return 0
;;
esac
return 1
}
# Check for disabled root login
disabled_root_login()
{
grep -q "# BR2_TARGET_ENABLE_ROOT_LOGIN is not set" "$1"
}
# For all defconfigs
check()
{
local total=$#
local num=1
local base=
echo "1..$total"
for defconfig in "$@"; do
base=$(basename "$defconfig")
if disabled_root_login "$defconfig"; then
echo "ok $num - $base disables root logins"
else
if whitelist "$base"; then
echo "ok $num - $base is exempted # skip"
else
echo "not ok $num - $base has not disabled root login"
fi
fi
num=$((num + 1))
done
}
check "$CONFIGS"/* || exit 1
exit 0