checkapk: dont require abuild.conf if we have default conf

also add tests
This commit is contained in:
Natanael Copa 2023-10-18 11:22:47 +02:00
parent 643637dd5d
commit fab41364f7
2 changed files with 22 additions and 2 deletions

View File

@ -51,7 +51,7 @@ if [ $# -gt 0 ]; then
exit 2
fi
if ! [ -f "$ABUILD_CONF" ] && ! [ -f "$ABUILD_USERCONF" ]; then
if ! [ -f "$ABUILD_CONF" ] && ! [ -f "$ABUILD_USERCONF" ] && ! [ -f "$ABUILD_DEFCONF" ]; then
die "no abuild.conf found"
fi

View File

@ -3,10 +3,16 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
checkapk_help \
checkapk_invalid_opt
checkapk_invalid_opt \
checkapk_missing_abuild_conf \
checkapk_missing_apkbuild
DATADIR=$(atf_get_srcdir)/testdata
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
export ABUILD_CONF=/dev/null
export ABUILD_USERCONF=/dev/null
checkapk_help_body() {
atf_check -s exit:0 \
-o match:"Usage:" \
@ -18,3 +24,17 @@ checkapk_invalid_opt_body() {
-e match:"Usage:" \
checkapk --invalid
}
checkapk_missing_abuild_conf_body() {
ABUILD_DEFCONF=/dev/null atf_check \
-s not-exit:0 \
-e match:"no abuild.conf found" \
checkapk
}
checkapk_missing_apkbuild_body() {
atf_check \
-s not-exit:0 \
-e match:"must be run in the directory of a built package" \
checkapk
}