2016-09-18 20:48:13 +00:00
|
|
|
#!/usr/bin/env atf-sh
|
|
|
|
|
|
|
|
. $(atf_get_srcdir)/test_env.sh
|
|
|
|
|
|
|
|
tests_init \
|
2016-11-05 04:07:18 +00:00
|
|
|
case_sensitivity \
|
|
|
|
depgraph_break_1 \
|
|
|
|
depgraph_break_2 \
|
|
|
|
depgraph_break_3 \
|
2016-11-05 04:30:21 +00:00
|
|
|
define_variable \
|
2016-09-18 20:48:13 +00:00
|
|
|
variable \
|
|
|
|
keep_system_libs \
|
|
|
|
libs \
|
|
|
|
libs_only \
|
2016-11-05 04:30:21 +00:00
|
|
|
libs_never_mergeback \
|
2016-09-18 20:48:13 +00:00
|
|
|
cflags_only \
|
2016-11-05 04:30:21 +00:00
|
|
|
cflags_never_mergeback \
|
2016-09-18 20:48:13 +00:00
|
|
|
incomplete_libs \
|
2016-11-05 04:07:18 +00:00
|
|
|
incomplete_cflags \
|
|
|
|
isystem_munge_order \
|
|
|
|
isystem_munge_sysroot \
|
2016-12-30 08:47:42 +00:00
|
|
|
idirafter_munge_order \
|
|
|
|
idirafter_munge_sysroot \
|
2016-12-31 02:25:02 +00:00
|
|
|
idirafter_ordering \
|
2016-11-05 04:30:21 +00:00
|
|
|
pcpath \
|
2017-01-23 05:21:51 +00:00
|
|
|
sysroot_munge \
|
2017-05-05 06:40:09 +00:00
|
|
|
virtual_variable \
|
2017-05-20 04:43:47 +00:00
|
|
|
fragment_collision \
|
2017-07-16 22:33:42 +00:00
|
|
|
malformed_1 \
|
2017-09-20 02:35:18 +00:00
|
|
|
malformed_quoting \
|
2017-07-16 22:33:42 +00:00
|
|
|
explicit_sysroot
|
2016-11-05 04:07:18 +00:00
|
|
|
|
|
|
|
case_sensitivity_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
|
|
|
-o inline:"3\n" \
|
|
|
|
pkgconf --variable=foo case-sensitivity
|
|
|
|
atf_check \
|
|
|
|
-o inline:"4\n" \
|
|
|
|
pkgconf --variable=Foo case-sensitivity
|
|
|
|
}
|
|
|
|
|
|
|
|
depgraph_break_1_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check -s exit:1 -e ignore \
|
|
|
|
pkgconf --exists --print-errors 'foo > 0.6.0 foo < 0.8.0'
|
|
|
|
}
|
|
|
|
|
|
|
|
depgraph_break_2_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check -s exit:1 -e ignore \
|
|
|
|
pkgconf --exists --print-errors 'nonexisting foo <= 3'
|
|
|
|
}
|
|
|
|
|
|
|
|
depgraph_break_3_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check -s exit:1 -e ignore \
|
|
|
|
pkgconf --exists --print-errors 'depgraph-break'
|
|
|
|
}
|
2016-09-18 20:48:13 +00:00
|
|
|
|
2016-11-05 04:30:21 +00:00
|
|
|
define_variable_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check -o inline:"\\\${libdir}/typelibdir\n" \
|
|
|
|
pkgconf --variable=typelibdir --define-variable='libdir=\${libdir}' typelibdir
|
|
|
|
}
|
|
|
|
|
2016-09-18 20:48:13 +00:00
|
|
|
variable_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
|
|
|
-o inline:"/test/include\n" \
|
|
|
|
pkgconf --variable=includedir foo
|
|
|
|
}
|
|
|
|
|
|
|
|
keep_system_libs_body()
|
|
|
|
{
|
2017-01-19 02:33:18 +00:00
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1" LIBRARY_PATH="/test/local/lib"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"\n" \
|
2017-01-19 02:33:18 +00:00
|
|
|
pkgconf --libs-only-L cflags-libs-only
|
|
|
|
|
2016-09-18 20:48:13 +00:00
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/test/local/lib \n" \
|
2016-09-18 20:48:13 +00:00
|
|
|
pkgconf --libs-only-L --keep-system-libs cflags-libs-only
|
|
|
|
}
|
|
|
|
|
|
|
|
libs_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/test/local/lib -lfoo \n" \
|
2016-09-18 20:48:13 +00:00
|
|
|
pkgconf --libs cflags-libs-only
|
|
|
|
}
|
|
|
|
|
|
|
|
libs_only_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/test/local/lib -lfoo \n" \
|
2016-09-18 20:48:13 +00:00
|
|
|
pkgconf --libs-only-L --libs-only-l cflags-libs-only
|
|
|
|
}
|
|
|
|
|
2016-11-05 04:30:21 +00:00
|
|
|
libs_never_mergeback_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/test/bar/lib -lfoo1 \n" \
|
2016-11-05 04:30:21 +00:00
|
|
|
pkgconf --libs prefix-foo1
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/test/bar/lib -lfoo1 -lfoo2 \n" \
|
2016-11-05 04:30:21 +00:00
|
|
|
pkgconf --libs prefix-foo1 prefix-foo2
|
|
|
|
}
|
|
|
|
|
2016-09-18 20:48:13 +00:00
|
|
|
cflags_only_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-I/test/local/include/foo \n" \
|
2016-09-18 20:48:13 +00:00
|
|
|
pkgconf --cflags-only-I --cflags-only-other cflags-libs-only
|
|
|
|
}
|
|
|
|
|
2016-11-05 04:30:21 +00:00
|
|
|
cflags_never_mergeback_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-I/test/bar/include/foo -DBAR -fPIC -DFOO \n" \
|
2016-11-05 04:30:21 +00:00
|
|
|
pkgconf --cflags prefix-foo1 prefix-foo2
|
|
|
|
}
|
|
|
|
|
2016-09-18 20:48:13 +00:00
|
|
|
incomplete_libs_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"\n" \
|
2016-09-18 20:48:13 +00:00
|
|
|
pkgconf --libs incomplete
|
|
|
|
}
|
|
|
|
|
|
|
|
incomplete_cflags_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"\n" \
|
2016-09-18 20:48:13 +00:00
|
|
|
pkgconf --cflags incomplete
|
|
|
|
}
|
2016-11-05 04:07:18 +00:00
|
|
|
|
|
|
|
isystem_munge_order_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-isystem /opt/bad/include -isystem /opt/bad2/include \n" \
|
2016-11-05 04:07:18 +00:00
|
|
|
pkgconf --cflags isystem
|
|
|
|
}
|
|
|
|
|
|
|
|
isystem_munge_sysroot_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1" PKG_CONFIG_SYSROOT_DIR='/test'
|
|
|
|
atf_check \
|
|
|
|
-o match:"-isystem /test/opt/bad/include" \
|
|
|
|
pkgconf --cflags isystem
|
|
|
|
}
|
|
|
|
|
2016-12-30 08:47:42 +00:00
|
|
|
idirafter_munge_order_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-idirafter /opt/bad/include -idirafter /opt/bad2/include \n" \
|
2016-12-30 08:47:42 +00:00
|
|
|
pkgconf --cflags idirafter
|
|
|
|
}
|
|
|
|
|
|
|
|
idirafter_munge_sysroot_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1" PKG_CONFIG_SYSROOT_DIR='/test'
|
|
|
|
atf_check \
|
|
|
|
-o match:"-idirafter /test/opt/bad/include" \
|
|
|
|
pkgconf --cflags idirafter
|
|
|
|
}
|
|
|
|
|
2016-12-31 02:25:02 +00:00
|
|
|
idirafter_ordering_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-I/opt/bad/include1 -idirafter -I/opt/bad/include2 -I/opt/bad/include3 \n" \
|
2016-12-31 02:25:02 +00:00
|
|
|
pkgconf --cflags idirafter-ordering
|
|
|
|
}
|
|
|
|
|
2016-11-05 04:07:18 +00:00
|
|
|
pcpath_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib2"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-fPIC -I/test/include/foo \n" \
|
2016-11-05 04:07:18 +00:00
|
|
|
pkgconf --cflags ${selfdir}/lib3/bar.pc
|
|
|
|
}
|
2016-11-05 04:30:21 +00:00
|
|
|
|
|
|
|
sysroot_munge_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_PATH="${selfdir}/lib1" PKG_CONFIG_SYSROOT_DIR="/sysroot"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/sysroot/lib -lfoo \n" \
|
2016-11-05 04:30:21 +00:00
|
|
|
pkgconf --libs sysroot-dir
|
|
|
|
|
|
|
|
export PKG_CONFIG_SYSROOT_DIR="/sysroot2"
|
|
|
|
atf_check \
|
2017-02-07 16:11:12 +00:00
|
|
|
-o inline:"-L/sysroot2/sysroot/lib -lfoo \n" \
|
2016-11-05 04:30:21 +00:00
|
|
|
pkgconf --libs sysroot-dir
|
|
|
|
}
|
2017-01-23 05:21:51 +00:00
|
|
|
|
|
|
|
virtual_variable_body()
|
|
|
|
{
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
pkgconf --exists pkg-config
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
pkgconf --exists pkgconf
|
|
|
|
|
|
|
|
atf_check -o inline:"${pcpath}\n" \
|
|
|
|
pkgconf --variable=pc_path pkg-config
|
|
|
|
atf_check -o inline:"${pcpath}\n" \
|
|
|
|
pkgconf --variable=pc_path pkgconf
|
|
|
|
}
|
2017-05-05 06:40:09 +00:00
|
|
|
|
|
|
|
fragment_collision_body()
|
|
|
|
{
|
|
|
|
atf_check -o inline:"-D_BAZ -D_BAR -D_FOO -D_THREAD_SAFE -pthread \n" \
|
|
|
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-collision
|
|
|
|
}
|
2017-05-20 04:43:47 +00:00
|
|
|
|
|
|
|
malformed_1_body()
|
|
|
|
{
|
|
|
|
atf_check -s exit:1 -o ignore \
|
|
|
|
pkgconf --validate --with-path="${selfdir}/lib1" malformed-1
|
|
|
|
}
|
2017-07-16 22:33:42 +00:00
|
|
|
|
2017-09-20 02:35:18 +00:00
|
|
|
malformed_quoting_body()
|
|
|
|
{
|
|
|
|
atf_check -s exit:0 -o ignore \
|
|
|
|
pkgconf --validate --with-path="${selfdir}/lib1" malformed-quoting
|
|
|
|
}
|
|
|
|
|
2017-07-16 22:33:42 +00:00
|
|
|
explicit_sysroot_body()
|
|
|
|
{
|
|
|
|
export PKG_CONFIG_SYSROOT_DIR=/sysroot
|
|
|
|
atf_check -o inline:"/sysroot/usr/share/test\n" \
|
|
|
|
pkgconf --with-path="${selfdir}/lib1" --variable=pkgdatadir explicit-sysroot
|
|
|
|
}
|