2016-09-18 20:48:13 +00:00
#!/usr/bin/env atf-sh
. $( atf_get_srcdir) /test_env.sh
tests_init \
noargs \
libs \
libs_cflags \
libs_cflags_version \
libs_cflags_version_multiple \
libs_cflags_version_alt \
libs_cflags_version_different \
libs_cflags_version_different_bad \
exists_nonexitent \
nonexitent \
exists_version \
exists_version_bad \
exists_version_bad2 \
exists_version_bad3 \
exists \
exists2 \
exists3 \
exists_version_alt \
uninstalled_bad \
uninstalled \
libs_intermediary \
libs_circular1 \
libs_circular2 \
libs_circular_directpc \
libs_static \
2016-12-31 01:44:50 +00:00
libs_static_ordering \
2023-10-09 06:41:47 +00:00
libs_metapackage \
2022-08-07 04:40:31 +00:00
license_isc \
license_noassertion \
2022-08-08 00:37:07 +00:00
modversion_noflatten \
2016-09-18 20:48:13 +00:00
pkg_config_path \
nolibs \
nocflags \
2017-01-18 17:36:52 +00:00
arbitary_path \
2017-01-20 06:58:48 +00:00
with_path \
2017-03-24 05:01:59 +00:00
relocatable \
single_depth_selectors
2016-09-18 20:48:13 +00:00
noargs_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check -s exit:1 -e ignore pkgconf
}
libs_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs foo
}
libs_cflags_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --cflags --libs foo
}
atf_test_case basic_libs_cflags_version
libs_cflags_version_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --cflags --libs 'foo > 1.2'
}
libs_cflags_version_multiple_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --cflags --libs 'foo > 1.2 bar >= 1.3'
}
libs_cflags_version_multiple_coma_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --cflags --libs 'foo > 1.2,bar >= 1.3'
}
libs_cflags_version_alt_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --cflags --libs 'foo' '>' '1.2'
}
libs_cflags_version_different_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --cflags --libs 'foo' '!=' '1.3.0'
}
atf_test_case basic_libs_cflags_version_different_bad
libs_cflags_version_different_bad_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
-e inline:"Package dependency requirement 'foo != 1.2.3' could not be satisfied.\nPackage 'foo' has version '1.2.3', required version is '!= 1.2.3'\n" \
pkgconf --cflags --libs 'foo' '!=' '1.2.3'
}
exists_nonexitent_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
pkgconf --exists nonexistant
}
nonexitent_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
pkgconf nonexistant
}
exists_version_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
pkgconf --exists 'foo > 1.2'
}
exists_version_bad_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
pkgconf --exists 'foo > 1.2.3'
}
exists_version_alt_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
pkgconf --exists 'foo' '>' '1.2'
}
uninstalled_bad_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
pkgconf --uninstalled 'foo'
}
uninstalled_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
pkgconf --uninstalled 'omg'
}
exists_version_bad2_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
pkgconf --exists 'foo >= '
}
exists_version_bad3_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-s exit:1 \
2023-01-21 19:25:46 +00:00
pkgconf --exists 'tilde >= 1.0.0'
2016-09-18 20:48:13 +00:00
}
exists_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
pkgconf --exists 'tilde = 1.0.0~rc1'
}
exists2_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 19:25:46 +00:00
pkgconf --exists 'tilde <= 1.0.0'
2016-09-18 20:48:13 +00:00
}
exists3_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
pkgconf --exists '' 'foo'
}
libs_intermediary_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs intermediary-1 intermediary-2
}
2021-10-07 07:29:29 +00:00
libs_circular2_body( )
2016-09-18 20:48:13 +00:00
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2022-08-07 01:35:12 +00:00
-o inline:"circular-1: breaking circular reference (circular-1 -> circular-2 -> circular-1)\n" \
pkgconf circular-2 --validate
2016-09-18 20:48:13 +00:00
}
2021-10-07 07:29:29 +00:00
libs_circular1_body( )
2016-09-18 20:48:13 +00:00
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2022-08-07 01:35:12 +00:00
-o inline:"circular-3: breaking circular reference (circular-3 -> circular-1 -> circular-3)\n" \
pkgconf circular-1 --validate
2016-09-18 20:48:13 +00:00
}
libs_circular_directpc_body( )
{
atf_check \
2024-02-23 14:18:08 +00:00
-o inline:"-lcircular-3 -lcircular-1 -lcircular-2\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs ${ selfdir } /lib1/circular-3.pc
}
libs_static_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"/libfoo.a -pthread\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs static-archive-libs
}
2016-12-31 01:44:50 +00:00
libs_static_ordering_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lbar -lfoo\n" \
2016-12-31 01:44:50 +00:00
pkgconf --libs foo bar
}
2023-10-09 06:41:47 +00:00
libs_metapackage_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 "
atf_check \
-o inline:"-L/test/lib -lbar -lfoo\n" \
pkgconf --static --libs metapackage-3
}
2016-09-18 20:48:13 +00:00
pkg_config_path_body( )
{
export PKG_CONFIG_PATH = " ${ selfdir } /lib1 ${ PATH_SEP } ${ selfdir } /lib2 "
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs foo
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lbar -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs bar
}
2017-01-18 17:36:52 +00:00
with_path_body( )
{
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lfoo\n" \
2017-01-18 17:36:52 +00:00
pkgconf --with-path= ${ selfdir } /lib1 --with-path= ${ selfdir } /lib2 --libs foo
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lbar -lfoo\n" \
2017-01-18 17:36:52 +00:00
pkgconf --with-path= ${ selfdir } /lib1 --with-path= ${ selfdir } /lib2 --libs bar
}
2016-09-18 20:48:13 +00:00
nolibs_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 nolib
}
nocflags_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 nocflag
}
arbitary_path_body( )
{
cp ${ selfdir } /lib1/foo.pc .
atf_check \
2023-01-21 20:22:03 +00:00
-o inline:"-L/test/lib -lfoo\n" \
2016-09-18 20:48:13 +00:00
pkgconf --libs foo.pc
}
2017-01-20 06:58:48 +00:00
relocatable_body( )
{
basedir = $( pkgconf --relocate ${ selfdir } )
atf_check \
-o inline:" ${ basedir } /lib-relocatable\n " \
pkgconf --define-prefix --variable= prefix ${ basedir } /lib-relocatable/lib/pkgconfig/foo.pc
}
2017-03-24 05:01:59 +00:00
single_depth_selectors_body( )
{
2017-03-27 06:03:24 +00:00
export PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH = 1
2017-03-24 05:01:59 +00:00
atf_check \
-o inline:"foo\n" \
pkgconf --with-path= ${ selfdir } /lib3 --print-requires bar
}
2022-08-07 04:40:31 +00:00
license_isc_body( )
{
atf_check \
-o inline:"foo: ISC\n" \
pkgconf --with-path= ${ selfdir } /lib1 --license foo
}
license_noassertion_body( )
{
atf_check \
-o inline:"bar: NOASSERTION\nfoo: ISC\n" \
pkgconf --with-path= ${ selfdir } /lib1 --license bar
}
2022-08-08 00:37:07 +00:00
modversion_noflatten_body( )
{
atf_check \
-o inline:"1.3\n" \
pkgconf --with-path= ${ selfdir } /lib1 --modversion bar
}