From 74cfbbbcf463149d531091c201e7b87f5c6ffd16 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 10 Oct 2024 19:20:53 +0200
Subject: [PATCH] test: add test for -libs subpackage

---
 tests/abuild_test | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tests/abuild_test b/tests/abuild_test
index e6de1930..d69164f0 100755
--- a/tests/abuild_test
+++ b/tests/abuild_test
@@ -14,6 +14,7 @@ init_tests \
 	abuild_checksum_generation \
 	abuild_checksum_duplicates \
 	abuild_subpkg_dep_leak \
+	abuild_subpkg_libs \
 	abuild_py_providers_creation \
 	abuild_py_dependency_scan \
 	abuild_py_dependency_scan_conflict \
@@ -335,6 +336,35 @@ abuild_subpkg_dep_leak_body() {
 		|| atf_fail "subpkg-dep-leak-subpkg should not depend on tar"
 }
 
+abuild_subpkg_libs_body() {
+	init_keys
+	mkdir -p testrepo/pkg
+	cd testrepo/pkg
+	cat > APKBUILD <<-EOF
+		maintainer="Natanael Copa <ncopa@alpinelinux.org>"
+		pkgname="pkg"
+		pkgver=1.0
+		pkgrel=0
+		pkgdesc="Dummy test package"
+		url="https://gitlab.alpinelinux.org/alpine/aports"
+		arch="noarch"
+		license="MIT"
+		subpackages="\$pkgname-libs"
+		options="!check"
+
+		package() {
+			mkdir -p "\$pkgdir"/usr/lib
+			touch "\$pkgdir"/usr/lib/libfoo.so.1
+		}
+	EOF
+	abuild clean unpack prepare build rootpkg || atf_fail "abuild failed"
+	if ! [ -e pkg/pkg-libs/usr/lib/libfoo.so.1 ]; then
+		find pkg
+		atf_fail "libfoo.so.1 was not moved"
+	fi
+}
+
+
 abuild_py_providers_creation_body() {
 	init_keys
 	cp -ra "$testrepo" .
-- 
GitLab