Skip to content

Commit 272ae22

Browse files
committed
tests: import pkgconf tests
There is still some work to do sorting out with upstream some tests that are defined but not run, there are also a few tests not ported (due to complexity of the port) but in general this is close enough to merge. There's about 100 passes and 60 failures currently, the failures have been marked as expected failures, and the test runner understands these are expected failures (annotated in the toml) and reports them as passes as long as they fail. This is currently not plugged into the cmake.
1 parent 8d67be7 commit 272ae22

111 files changed

Lines changed: 1952 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright © 2024 Dylan Baker
33

44
subdir('cps-files/lib/cps')
5+
subdir('pkgconf')
56

67
build_tests = get_option('tests')
78

tests/pkgconf/.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.pc]
2+
trim_trailing_whitespace = unset
3+
insert_final_newline = unset
4+
end_of_line = unset

tests/pkgconf/AUTHORS

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
A. Wilcox <AWilcox@Wilcox-Tech.com>
2+
Alexander Tsoy <alexander@tsoy.me>
3+
Alexpux <alexey.pawlow@gmail.com>
4+
Alon Bar-Lev <alon.barlev@gmail.com>
5+
Alyx <alyx@malkier.net>
6+
Ariadne Conill <ariadne@dereferenced.org>
7+
Baptiste Daroussin <bapt@FreeBSD.org>
8+
Baptiste Daroussin <bapt@gandi.net>
9+
Bryan Drewery <bryan@shatow.net>
10+
Dag-Erling Smørgrav <des@des.no>
11+
Dan Kegel <dank@kegel.com>
12+
Dan Kegel <dank@oblong.com>
13+
Dan Nicholson <dbn.lists@gmail.com>
14+
David Michael <fedora.dm0@gmail.com>
15+
Emil Renner Berthing <esmil@mailme.dk>
16+
Fabian Groffen <grobian@gentoo.org>
17+
Graham Ollis <plicease@cpan.org>
18+
Gregor Richards <Richards@codu.org>
19+
Ignacio Casal Quinteiro <qignacio@amazon.com>
20+
Igor Gnatenko <ignatenko@redhat.com>
21+
Issam Maghni <concatime@users.noreply.github.com>
22+
JD Horelick <jdhore1@gmail.com>
23+
Jason Dusek <jason.dusek@gmail.com>
24+
Javier Viguera <javier.viguera@digi.com>
25+
Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
26+
John Hein <jhgit@users.github.com>
27+
Jussi Pakkanen <jpakkane@gmail.com>
28+
Leorize <alaviss@users.noreply.github.com>
29+
Luca Barbato <lu_zero@gentoo.org>
30+
Marcin Wojdyr <wojdyr@gmail.com>
31+
Maxin B. John <maxinbjohn@users.noreply.github.com>
32+
Michał Górny <mgorny@gentoo.org>
33+
Mike Frysinger <vapier@gentoo.org>
34+
Seungha Yang <seungha.yang@navercorp.com>
35+
TingPing <tingping@tingping.se>
36+
Tobias Kortkamp <t6@users.noreply.github.com>
37+
Tony Theodore <tonyt@logyst.com>
38+
Volker Braun <vbraun.name@gmail.com>
39+
Yu Kobayashi <yukoba@accelart.jp>
40+
orbea <orbea@fredslev.dk>
41+
✈ Graham ✈ <plicease@cpan.org>

tests/pkgconf/COPYING

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
2+
pkgconf authors (see AUTHORS file in source directory).
3+
4+
Permission to use, copy, modify, and/or distribute this software for any
5+
purpose with or without fee is hereby granted, provided that the above
6+
copyright notice and this permission notice appear in all copies.
7+
8+
This software is provided 'as is' and without any warranty, express or
9+
implied. In no event shall the authors be liable for any damages arising
10+
from the use of this software.

tests/pkgconf/basic.toml

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
[setup]
2+
[setup.env]
3+
PKG_CONFIG_PATH="{test_root}/lib1"
4+
5+
[noargs]
6+
exitcode = 1
7+
stderr = '<ignore>'
8+
expected_fail = true
9+
10+
[libs]
11+
stdout = "-L/test/lib -lfoo\n"
12+
args = ["--libs", "foo"]
13+
expected_fail = true
14+
15+
[lib_cflags]
16+
stdout = "-fPIC -I/test/include/foo -L/test/lib -lfoo\n"
17+
args = ["--cflags", "--libs", "foo"]
18+
expected_fail = true
19+
20+
[lib_cflags_version]
21+
stdout = "-fPIC -I/test/include/foo -L/test/lib -lfoo\n"
22+
args = ["--cflags", "--libs", "foo > 1.2"]
23+
expected_fail = true
24+
25+
[lib_cflags_version_multiple]
26+
stdout = "-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n"
27+
args = ["--cflags", "--libs", "foo > 1.2 bar >= 1.3"]
28+
expected_fail = true
29+
30+
[lib_cflags_version_multiple_comma]
31+
stdout = "-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n"
32+
args = ["--cflags", "--libs", "foo > 1.2,bar >= 1.3"]
33+
expected_fail = true
34+
35+
[lib_cflags_version_alt]
36+
stdout = "-fPIC -I/test/include/foo -L/test/lib -lfoo\n"
37+
args = ["--cflags", "--libs", "foo", ">", "1.2"]
38+
expected_fail = true
39+
40+
[lib_cflags_version_different]
41+
stdout = "-fPIC -I/test/include/foo -L/test/lib -lfoo\n"
42+
args = ["--cflags", "--libs", "foo", "!=", "1.3"]
43+
expected_fail = true
44+
45+
[lib_cflags_version_different_bad]
46+
exitcode = 1
47+
stderr = "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"
48+
args = ["--cflags", "--libs", "foo", "!=", "1.2.3"]
49+
expected_fail = true
50+
51+
[exists_nonexistent]
52+
exitcode = 1
53+
args = ["--exists", "nonexistant"]
54+
expected_fail = true
55+
56+
[nonexistent]
57+
exitcode = 1
58+
args = ["nonexistant"]
59+
60+
[exists_version]
61+
args = ["--exists", "foo > 1.2"]
62+
expected_fail = true
63+
64+
[exists_version_alt]
65+
args = ["--exists", "foo", ">", "1.2"]
66+
expected_fail = true
67+
68+
[exists_version_bad]
69+
exitcode = 1
70+
args = ["--exists", "foo > 1.2.3"]
71+
expected_fail = true
72+
73+
[uninstalled_bad]
74+
exitcode = 1
75+
args = ["--uninstalled", "foo"]
76+
expected_fail = true
77+
78+
[uninstalled]
79+
args = ["--uninstalled", "omg"]
80+
expected_fail = true
81+
82+
[exists_version_bad2]
83+
exitcode = 1
84+
args = ["--exists", "foo >= "]
85+
expected_fail = true
86+
87+
[exists_version_bad3]
88+
exitcode = 1
89+
args = ["--exists", "tilde >= 1.0.0"]
90+
expected_fail = true
91+
92+
[exists]
93+
args = ["--exists", "tilde >= 1.0.0"]
94+
expected_fail = true
95+
96+
[exists2]
97+
args = ["--exists", "tilde >= 1.0.0~rc1"]
98+
expected_fail = true
99+
100+
[exists3]
101+
args = ["--exists", "", "foo"]
102+
expected_fail = true
103+
104+
[intermediary]
105+
args = ["--libs", "intermediary-1", "intermediary-2"]
106+
stdout = "-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz\n"
107+
expected_fail = true
108+
109+
[circular2]
110+
args = ["circular-2", "--validate"]
111+
stdout = "circular-1: breaking circular reference (circular-1 -> circular-2 -> circular-1)\n"
112+
expected_fail = true
113+
114+
[circular1]
115+
args = ["circular-1", "--validate"]
116+
stdout = "circular-3: breaking circular reference (circular-3 -> circular-1 -> circular-3)\n"
117+
expected_fail = true
118+
119+
[circular_direct_pc]
120+
args = ["--libs", "{test_root}/lib1/circular-3.pc"]
121+
stdout = "-lcircular-3 -lcircular-1 -lcircular-2\n"
122+
expected_fail = true
123+
124+
[libs_static]
125+
args = ["--libs", "static-archive-libs"]
126+
stdout = "/libfoo.a -pthread\n"
127+
expected_fail = true
128+
129+
[pkg_config_path]
130+
args = ["--libs", "foo"]
131+
stdout = "-L/test/lib -lfoo\n"
132+
expected_fail = true
133+
134+
[pkg_config_path.env]
135+
PKG_CONFIG_PATH = "{test_root}/lib1:{test_root}/lib2"
136+
137+
[pkg_config_path2]
138+
args = ["--libs", "bar"]
139+
stdout = "-L/test/lib -lbar -lfoo\n"
140+
expected_fail = true
141+
142+
[pkg_config_path2.env]
143+
PKG_CONFIG_PATH = "{test_root}/lib1:{test_root}/lib2"
144+
145+
[with_path]
146+
args = ["--with-path={test_root}/lib", "--with-path={test_root}/lib2", "--libs", "foo"]
147+
stdout = "-L/test/lib -lfoo\n"
148+
expected_fail = true
149+
150+
[with_path2]
151+
args = ["--with-path={test_root}/lib", "--with-path={test_root}/lib2", "--libs", "bar"]
152+
stdout = "-L/test/lib -lbar -lfoo\n"
153+
expected_fail = true
154+
155+
[nolibs]
156+
args = ["--libs", "nolib"]
157+
stdout = "\n"
158+
expected_fail = true
159+
160+
[nocflags]
161+
args = ["--cflags", "nocflag"]
162+
stdout = "\n"
163+
164+
# TODO: [arbitrary_path]
165+
166+
# TODO: This doesn't work, needs some more magic?
167+
#[relocatable_body]
168+
# args = ["--define-prefix", "--variable=prefix", "tests/lib-relocatable/lib/pkgconfig/foo.pc"]
169+
# stdout = "tests/lib-relocatable\n"
170+
171+
[single_depth_selectors]
172+
args = ["--with-path={test_root}/lib3", "--print-requires", "bar"]
173+
stdout = "foo\n"
174+
expected_fail = true
175+
176+
[single_depth_selectors.env]
177+
PKG_CONFIG_MAXIMUM_TRAVERSAL_DEPTH = "1"
178+
179+
[license_isc]
180+
args = ["--license", "foo"]
181+
stdout = "foo: ISC\n"
182+
expected_fail = true
183+
184+
[license_noassertion]
185+
args = ["--license", "bar"]
186+
stdout = "bar: NOASSERTION\nfoo: ISC\n"
187+
expected_fail = true
188+
189+
[modversion_noflatten]
190+
args = ["--modversion", "bar"]
191+
stdout = "1.3\n"
192+
expected_fail = true
193+
194+
[exists_cflags]
195+
args = ["--with-path={test_root}/lib", "--cflags", "--exists-cflags", "--fragment-filter=D", "foo"]
196+
stdout = "-DHAVE_FOO\n"
197+
expected_fail = true
198+
199+
[exists_cflags_env]
200+
args = ["--with-path={test_root}/lib", "--cflags", "--exists-cflags", "--fragment-filter=D", "--env=FOO", "foo"]
201+
stdout = "FOO_CFLAGS='-DHAVE_FOO'\n"
202+
expected_fail = true
203+
204+
[libs_env]
205+
args = ["--with-path={test_root}/lib", "--libs", "--env=FOO", "foo"]
206+
stdout = "FOO_LIBS='-L/test/lib -lfoo'\n"
207+
expected_fail = true
208+
209+
[print_variables_env]
210+
args = ["--with-path={test_root}/lib", "--env=FOO", "--print-variables", "--cflags", "--libs", "foo"]
211+
stdout = "FOO_CFLAGS='-fPIC -I/test/include/foo'\nFOO_LIBS='-L/test/lib -lfoo'\nFOO_INCLUDEDIR='/test/include'\nFOO_LIBDIR='/test/lib'\nFOO_EXEC_PREFIX='/test'\nFOO_PREFIX='/test'\nFOO_PCFILEDIR='{test_root}/lib1'\n"
212+
expected_fail = true
213+
214+
[variable_env]
215+
args = ["--with-path={test_root}/lib", "--env=FOO", "--variable=includedir", "foo"]
216+
stdout = "FOO_INCLUDEDIR='/test/include'\n"
217+
expected_fail = true
218+
219+
# TODO: variable_env

tests/pkgconf/builtins.toml.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[setup]
2+
[setup.env]
3+
PKG_CONFIG_PATH="{test_root}/lib1"
4+
5+
[modversion]
6+
args = ["--modversion", "pkg-config"]
7+
stdout = "@PKGCONF_VERSION@\n"
8+
expected_fail = true
9+
10+
[variable]
11+
args = ["--variable=prefix", "foo"]
12+
stdout = "/test\n"
13+
expected_fail = true
14+
15+
[define_variable]
16+
args = ["--define-variable=prefix=/test2", "--variable=prefix", "foo"]
17+
stdout = "/test2\n"
18+
expected_fail = true
19+
20+
# TODO: global_variable
21+
# TODO: argv_parser_3
22+
# TODO: tilde_quoting
23+
# TODO: paren_quoting

tests/pkgconf/conflicts.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[setup]
2+
[setup.env]
3+
PKG_CONFIG_PATH="{test_root}/lib1"
4+
5+
[libs]
6+
args = ["--libs", "conflicts"]
7+
stdout = "-L/test/lib -lconflicts\n"
8+
expected_fail = true
9+
10+
[ignore]
11+
args = ["--ignore-conflicts", "--libs", "conflicts"]
12+
stdout = "-L/test/lib -lconflicts\n"
13+
expected_fail = true

tests/pkgconf/framework.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[setup]
2+
[setup.env]
3+
PKG_CONFIG_PATH="{test_root}/lib1"
4+
5+
[libs1]
6+
args = ["--libs", "framework-1"]
7+
stdout = "-F/test/lib -framework framework-1\n"
8+
expected_fail = true
9+
10+
[libs2]
11+
args = ["--libs", "framework-2"]
12+
stdout = "-F/test/lib -framework framework-2 -framework framework-1\n"
13+
expected_fail = true
14+
15+
[libs3]
16+
args = ["--libs", "framework-1", "framework-2"]
17+
stdout = "-F/test/lib -framework framework-2 -framework framework-1\n"
18+
expected_fail = true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=/test
2+
exec_prefix=${prefix}
3+
libdir=${prefix}/lib
4+
includedir=${prefix}/include
5+
6+
Name: foo
7+
Description: A testing pkg-config file
8+
Version: 1.2.3
9+
Libs: -L${libdir} -lfoo
10+
Cflags: -fPIC -I${includedir}/foo
11+
Cflags.private: -DFOO_STATIC

tests/pkgconf/lib1/argv-parse-2.pc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=/test
2+
exec_prefix=${prefix}
3+
libdir=${prefix}/lib
4+
includedir=${prefix}/include
5+
6+
Name: argv-parse-2
7+
Description: A testing pkg-config file
8+
Version: 1.2.3
9+
Libs: -llib-1 -pthread ${libdir}/lib2.so
10+
Cflags:

0 commit comments

Comments
 (0)