tests: basic: port over another set of tests

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
This commit is contained in:
Ariadne Conill 2025-12-29 15:12:44 -08:00
parent ecbedee413
commit 7bbdf301e7
6 changed files with 25 additions and 81 deletions

View File

@ -27,6 +27,10 @@ EXTRA_DIST = pkg.m4 \
t/basic/libs.test \
t/basic/libs-cflags.test \
t/basic/libs-cflags-version.test \
t/basic/libs-cflags-version-multiple.test \
t/basic/libs-cflags-version-multiple-comma.test \
t/basic/libs-cflags-version-not.test \
t/basic/libs-cflags-version-not-provided.test \
tests/lib-relocatable/lib/pkgconfig/foo.pc \
tests/lib1/argv-parse-2.pc \
tests/lib1/billion-laughs.pc \

View File

@ -0,0 +1,5 @@
PackageSearchPath: lib1
Query: foo > 1.2,bar >= 1.3
WantedFlags: libs cflags
ExpectedExitCode: 0
ExpectedStdout: -fPIC -I/test/include/foo -L/test/lib -lbar -lfoo

View File

@ -0,0 +1,5 @@
PackageSearchPath: lib1
Query: foo > 1.2 bar >= 1.3
WantedFlags: libs cflags
ExpectedExitCode: 0
ExpectedStdout: -fPIC -I/test/include/foo -L/test/lib -lbar -lfoo

View File

@ -0,0 +1,6 @@
PackageSearchPath: lib1
Query: foo != 1.2.3
WantedFlags: libs cflags
ExpectedExitCode: 1
MatchStderr: partial
ExpectedStderr: Package 'foo' has version '1.2.3', required version is '!= 1.2.3'

View File

@ -0,0 +1,5 @@
PackageSearchPath: lib1
Query: foo != 1.3.0
WantedFlags: libs cflags
ExpectedExitCode: 0
ExpectedStdout: -fPIC -I/test/include/foo -L/test/lib -lfoo

View File

@ -3,14 +3,6 @@
. $(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 \
libs_env \
exists_nonexitent \
nonexitent \
@ -52,79 +44,6 @@ tests_init \
variable_no_recurse \
tuple_env
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 \
-o inline:"-L/test/lib -lfoo\n" \
pkgconf --libs foo
}
libs_cflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
pkgconf --cflags --libs foo
}
atf_test_case basic_libs_cflags_version
libs_cflags_version_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
pkgconf --cflags --libs 'foo > 1.2'
}
libs_cflags_version_multiple_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n" \
pkgconf --cflags --libs 'foo > 1.2 bar >= 1.3'
}
libs_cflags_version_multiple_coma_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n" \
pkgconf --cflags --libs 'foo > 1.2,bar >= 1.3'
}
libs_cflags_version_alt_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
pkgconf --cflags --libs 'foo' '>' '1.2'
}
libs_cflags_version_different_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
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"