From 9cddd22bbcdb19d43efc390ab71e7d68bcafcaf7 Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Sat, 19 Aug 2023 11:16:30 +1000 Subject: [PATCH] tests: add regression tests for --modversion Signed-off-by: Colin Gillespie --- tests/lib1/foobar.pc | 12 ++++++++++++ tests/lib1/unavailable-provider.pc | 11 +++++++++++ tests/regress.sh | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/lib1/foobar.pc create mode 100644 tests/lib1/unavailable-provider.pc diff --git a/tests/lib1/foobar.pc b/tests/lib1/foobar.pc new file mode 100644 index 0000000..e9aa843 --- /dev/null +++ b/tests/lib1/foobar.pc @@ -0,0 +1,12 @@ +prefix=/test +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: foobar +Description: A testing pkg-config file +Version: 3.2.1 +Libs: -L${libdir} -lfoobar +Cflags: -fPIC -I${includedir}/foobar +Cflags.private: -DFOOBAR_STATIC +License: ISC diff --git a/tests/lib1/unavailable-provider.pc b/tests/lib1/unavailable-provider.pc new file mode 100644 index 0000000..a8eed66 --- /dev/null +++ b/tests/lib1/unavailable-provider.pc @@ -0,0 +1,11 @@ +prefix=/test +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: unavailable_provider +Description: Provides an otherwise unavailable package +Version: 1.2.3 +Provides: unavailable = 1.2.3 +Libs: -lunavailable +Cflags: diff --git a/tests/regress.sh b/tests/regress.sh index d1b740b..0c81415 100755 --- a/tests/regress.sh +++ b/tests/regress.sh @@ -23,6 +23,9 @@ tests_init \ idirafter_munge_order \ idirafter_munge_sysroot \ idirafter_ordering \ + modversion_common_prefix \ + modversion_fullpath \ + modversion_provides \ modversion_uninstalled \ pcpath \ virtual_variable \ @@ -275,6 +278,24 @@ billion_laughs_body() pkgconf --with-path="${selfdir}/lib1" --validate billion-laughs } +modversion_common_prefix_body() +{ + atf_check -o inline:"foo: 1.2.3\nfoobar: 3.2.1\n" \ + pkgconf --with-path="${selfdir}/lib1" --modversion --verbose foo foobar +} + +modversion_fullpath_body() +{ + atf_check -o inline:"1.2.3\n" \ + pkgconf --modversion "${selfdir}/lib1/foo.pc" +} + +modversion_provides_body() +{ + atf_check -o inline:"1.2.3\n" \ + pkgconf --with-path="${selfdir}/lib1" --modversion unavailable +} + modversion_uninstalled_body() { atf_check -o inline:"1.2.3\n" \