tests: abuild: add test for invalid filename

This commit is contained in:
Natanael Copa 2022-06-15 17:27:53 +02:00
parent a845a0bf1d
commit 1b66d65805

View File

@ -6,7 +6,8 @@ init_tests \
abuild_invalid_opt \
abuild_version \
abuild_simple_pkg_without_deps \
abuild_build_fail
abuild_build_fail \
abuild_invalid_filename
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
export ABUILD_CONF=/dev/null
@ -48,7 +49,7 @@ abuild_simple_pkg_without_deps_body() {
abuild_build_fail_body() {
mkdir buildfail
cat >buildfail/APKBUILD <<-EOF
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Joe User <juser@example.com>
pkgname="buildfail"
pkgver="1.0"
pkgrel=0
@ -72,5 +73,36 @@ abuild_build_fail_body() {
atf_check -s exit:1 \
-e match:"ERROR: buildfail: build failed" \
abuild
}
abuild_invalid_filename_body() {
mkdir invalid-filename
cd invalid-filename
cat >APKBUILD <<-EOF
# Maintainer: Joe User <juser@example.com>
pkgname="invalid-filename"
pkgver="1.0"
pkgrel=0
pkgdesc="Dummy test package that fails to build"
url="https://gitlab.alpinelinux.org/alpine/aports"
arch="noarch"
license="MIT"
prepare() {
mkdir -p "\$builddir"
}
build() {
touch $'bad\nfile'
}
check() {
true
}
package() {
mkdir -p "\$pkgdir"
cp -r * "\$pkgdir"/
}
EOF
atf_check -s exit:1 \
-e match:"ERROR:.*: Found filenames with newline" \
abuild
}