summaryrefslogtreecommitdiff
path: root/tests/sysroot.sh
diff options
context:
space:
mode:
authorPierre Pronchery <khorben@FreeBSD.org>2026-04-22 13:13:41 +0000
committerPierre Pronchery <khorben@FreeBSD.org>2026-04-22 13:13:41 +0000
commit6294b6ab217a2d5f1d2bc23a64505a228294c508 (patch)
tree333ee95d0d49af6cfc4390c1ec90098e6493e332 /tests/sysroot.sh
Diffstat (limited to 'tests/sysroot.sh')
-rwxr-xr-xtests/sysroot.sh110
1 files changed, 110 insertions, 0 deletions
diff --git a/tests/sysroot.sh b/tests/sysroot.sh
new file mode 100755
index 000000000000..9d61eaea311c
--- /dev/null
+++ b/tests/sysroot.sh
@@ -0,0 +1,110 @@
+#!/usr/bin/env atf-sh
+
+. $(atf_get_srcdir)/test_env.sh
+
+tests_init \
+ cflags \
+ variable \
+ do_not_eat_slash \
+ do_not_duplicate_sysroot_dir \
+ uninstalled \
+ uninstalled_pkgconf1 \
+ uninstalled_fdo \
+ uninstalled_fdo_pc_sysrootdir
+
+do_not_eat_slash_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="/"
+ atf_check \
+ -o inline:"-fPIC -I/test/include/foo\n" \
+ pkgconf --cflags baz
+}
+
+cflags_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
+ atf_check \
+ -o inline:"-fPIC -I${SYSROOT_DIR}/test/include/foo\n" \
+ pkgconf --cflags baz
+}
+
+variable_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
+ atf_check \
+ -o inline:"${SYSROOT_DIR}/test\n" \
+ pkgconf --variable=prefix foo
+ atf_check \
+ -o inline:"${SYSROOT_DIR}/test/include\n" \
+ pkgconf --variable=includedir foo
+}
+
+do_not_duplicate_sysroot_dir_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="/sysroot"
+
+ atf_check \
+ -o inline:"-I/sysroot/usr/include\n" \
+ pkgconf --cflags sysroot-dir-2
+
+ atf_check \
+ -o inline:"-I/sysroot/usr/include\n" \
+ pkgconf --cflags sysroot-dir-3
+
+ atf_check \
+ -o inline:"-I/sysroot/usr/include\n" \
+ pkgconf --cflags sysroot-dir-5
+
+ export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
+
+ atf_check \
+ -o inline:"-I${SYSROOT_DIR}/usr/include\n" \
+ pkgconf --cflags sysroot-dir-4
+}
+
+uninstalled_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="/sysroot"
+
+ atf_check \
+ -o inline:"-L/test/lib -lomg\n" \
+ pkgconf --libs omg
+}
+
+uninstalled_pkgconf1_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="/sysroot"
+ export PKG_CONFIG_PKGCONF1_SYSROOT_RULES="1"
+
+ atf_check \
+ -o inline:"-L/sysroot/test/lib -lomg\n" \
+ pkgconf --libs omg
+}
+
+uninstalled_fdo_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="/sysroot"
+ export PKG_CONFIG_FDO_SYSROOT_RULES="1"
+
+ atf_check \
+ -o inline:"-L/test/lib -lomg\n" \
+ pkgconf --libs omg
+}
+
+uninstalled_fdo_pc_sysrootdir_body()
+{
+ export PKG_CONFIG_PATH="${selfdir}/lib1"
+ export PKG_CONFIG_SYSROOT_DIR="/sysroot"
+ export PKG_CONFIG_FDO_SYSROOT_RULES="1"
+
+ atf_check \
+ -o inline:"-L/sysroot/test/lib -lomg\n" \
+ pkgconf --libs omg-sysroot
+}