Skip to content

Commit 422e812

Browse files
committed
test: simplify and skip UNIX backup files
- Drop 'local', not available in POSIX shell scripts - Check for an assortment of backup file combos - Simplify nested if-statements, skip whitelist first Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 631b205 commit 422e812

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/case/repo/defconfig.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,25 @@ disabled_root_login()
2323
# For all defconfigs
2424
check()
2525
{
26-
local total=$#
27-
local num=1
28-
local base=
26+
total=$#
27+
num=1
28+
base=
2929

3030
echo "1..$total"
3131
for defconfig in "$@"; do
32+
# Skip UNIX backup files
33+
case "$defconfig" in
34+
*~|*.bak|'#'*'#'|.#*)
35+
continue
36+
;;
37+
esac
3238
base=$(basename "$defconfig")
33-
if disabled_root_login "$defconfig"; then
39+
if whitelist "$base"; then
40+
echo "ok $num - $base is exempted # skip"
41+
elif disabled_root_login "$defconfig"; then
3442
echo "ok $num - $base disables root logins"
3543
else
36-
if whitelist "$base"; then
37-
echo "ok $num - $base is exempted # skip"
38-
else
39-
echo "not ok $num - $base has not disabled root login"
40-
fi
44+
echo "not ok $num - $base has not disabled root login"
4145
fi
4246
num=$((num + 1))
4347
done

0 commit comments

Comments
 (0)