Browse Source

Add Kyua tests

Baptiste Daroussin 3 years ago
parent
commit
5c2bee67f7
16 changed files with 1049 additions and 14 deletions
  1. 0
    0
      Kyuafile.in
  2. 28
    7
      Makefile.am
  3. 2
    2
      configure.ac
  4. 0
    5
      tests/Kyuafile
  5. 13
    0
      tests/Kyuafile.in
  6. 271
    0
      tests/basic.sh
  7. 68
    0
      tests/builtins.sh
  8. 23
    0
      tests/conflicts.sh
  9. 20
    0
      tests/framework.sh
  10. 91
    0
      tests/parser.sh
  11. 298
    0
      tests/provides.sh
  12. 68
    0
      tests/regress.sh
  13. 79
    0
      tests/requires.sh
  14. 28
    0
      tests/sysroot.sh
  15. 22
    0
      tests/test_env.sh.in
  16. 38
    0
      tests/version.sh

Kyuafile → Kyuafile.in View File


+ 28
- 7
Makefile.am View File

@@ -11,9 +11,7 @@ AM_CFLAGS = -Wall -Wextra -Wformat=2 -std=gnu99 -DPKG_DEFAULT_PATH=\"$(pkgconfig
11 11
 bin_PROGRAMS = pkgconf
12 12
 lib_LTLIBRARIES = libpkgconf.la
13 13
 
14
-EXTRA_DIST =	Kyuafile \
15
-		tests/Kyuafile \
16
-		pkg.m4 \
14
+EXTRA_DIST =	pkg.m4 \
17 15
 		tests/lib1/argv-parse-2.pc \
18 16
 		tests/lib1/dos-lineendings.pc \
19 17
 		tests/lib1/paren-quoting.pc \
@@ -57,7 +55,25 @@ EXTRA_DIST =	Kyuafile \
57 55
 		tests/lib1/depgraph-break.pc \
58 56
 		tests/lib1/cflags-whitespace.pc \
59 57
 		tests/lib1/provides.pc \
60
-		tests/lib1/provides-request-simple.pc
58
+		tests/lib1/provides-request-simple.pc \
59
+		tests/test_env.sh \
60
+		$(test_scripts)
61
+
62
+test_scripts=	\
63
+		tests/basic.sh \
64
+		tests/builtins.sh \
65
+		tests/conflicts.sh \
66
+		tests/framework.sh \
67
+		tests/parser.sh \
68
+		tests/provides.sh \
69
+		tests/regress.sh \
70
+		tests/requires.sh \
71
+		tests/sysroot.sh \
72
+		tests/version.sh
73
+
74
+check_SCRIPTS=	$(test_scripts:.sh=)
75
+
76
+SUFFIXES=	.sh
61 77
 
62 78
 pkginclude_HEADERS = libpkgconf/bsdstubs.h libpkgconf/iter.h libpkgconf/libpkgconf.h libpkgconf/stdinc.h
63 79
 libpkgconf_la_SOURCES  =	\
@@ -84,7 +100,12 @@ dist_doc_DATA = README.md AUTHORS
84 100
 m4datadir              = $(datadir)/aclocal
85 101
 m4data_DATA            = pkg.m4
86 102
 
87
-CLEANFILES = $(EXTRA_PROGRAMS)
103
+CLEANFILES =	$(EXTRA_PROGRAMS) \
104
+		$(check_SCRIPTS)
105
+
106
+check: pkgconf $(check_SCRIPTS)
107
+	kyua --config=none test --kyuafile='$(top_builddir)/Kyuafile' \
108
+		--build-root='$(top_builddir)'
88 109
 
89
-check: pkgconf
90
-	$(SHELL) tests/run.sh ./pkgconf
110
+.sh:
111
+	install -m 755 $< $@

+ 2
- 2
configure.ac View File

@@ -16,7 +16,7 @@ AC_INIT([pkgconf], [1.0.1], [http://github.com/pkgconf/pkgconf/issues])
16 16
 AC_CONFIG_SRCDIR([main.c])
17 17
 AC_CONFIG_HEADERS([libpkgconf/config.h])
18 18
 AC_CHECK_FUNCS([strlcpy strlcat strndup strtok_r])
19
-AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
19
+AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz subdir-objects])
20 20
 AM_SILENT_RULES([yes])
21 21
 LT_INIT
22 22
 
@@ -62,5 +62,5 @@ AC_PROG_CC
62 62
 AC_PROG_INSTALL
63 63
 AC_PROG_LN_S
64 64
 
65
-AC_CONFIG_FILES([Makefile tests/run.sh])
65
+AC_CONFIG_FILES([Makefile Kyuafile tests/Kyuafile tests/test_env.sh])
66 66
 AC_OUTPUT

+ 0
- 5
tests/Kyuafile View File

@@ -1,5 +0,0 @@
1
-syntax(2)
2
-
3
-test_suite('pkgconf')
4
-
5
-plain_test_program{name='run.sh'}

+ 13
- 0
tests/Kyuafile.in View File

@@ -0,0 +1,13 @@
1
+syntax(2)
2
+
3
+test_suite('pkgconf')
4
+
5
+atf_test_program{name='basic'}
6
+atf_test_program{name='requires'}
7
+atf_test_program{name='regress'}
8
+atf_test_program{name='parser'}
9
+atf_test_program{name='sysroot'}
10
+atf_test_program{name='conflicts'}
11
+atf_test_program{name='version'}
12
+atf_test_program{name='framework'}
13
+atf_test_program{name='provides'}

+ 271
- 0
tests/basic.sh View File

@@ -0,0 +1,271 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	noargs \
7
+	libs \
8
+	libs_cflags \
9
+	libs_cflags_version \
10
+	libs_cflags_version_multiple \
11
+	libs_cflags_version_alt \
12
+	libs_cflags_version_different \
13
+	libs_cflags_version_different_bad \
14
+	exists_nonexitent \
15
+	nonexitent \
16
+	exists_version \
17
+	exists_version_bad \
18
+	exists_version_bad2 \
19
+	exists_version_bad3 \
20
+	exists \
21
+	exists2 \
22
+	exists3 \
23
+	exists_version_alt \
24
+	uninstalled_bad \
25
+	uninstalled \
26
+	libs_intermediary \
27
+	libs_circular1 \
28
+	libs_circular2 \
29
+	libs_circular_directpc \
30
+	libs_static \
31
+	pkg_config_path \
32
+	nolibs \
33
+	nocflags \
34
+	arbitary_path
35
+
36
+noargs_body()
37
+{
38
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
39
+	atf_check -s exit:1 -e ignore pkgconf
40
+}
41
+
42
+libs_body()
43
+{
44
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
45
+	atf_check \
46
+		-o inline:"-L/test/lib -lfoo  \n" \
47
+		pkgconf --libs foo
48
+}
49
+
50
+libs_cflags_body()
51
+{
52
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
53
+	atf_check \
54
+		-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo  \n" \
55
+		pkgconf --cflags --libs foo
56
+}
57
+
58
+atf_test_case basic_libs_cflags_version
59
+libs_cflags_version_body()
60
+{
61
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
62
+	atf_check \
63
+		-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo  \n" \
64
+		pkgconf --cflags --libs 'foo > 1.2'
65
+}
66
+
67
+libs_cflags_version_multiple_body()
68
+{
69
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
70
+	atf_check \
71
+		-o inline:"-I/test/include/foo -fPIC -L/test/lib -lbar -lfoo  \n" \
72
+		pkgconf --cflags --libs 'foo > 1.2 bar >= 1.3'
73
+}
74
+
75
+libs_cflags_version_multiple_coma_body()
76
+{
77
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
78
+	atf_check \
79
+		-o inline:"-I/test/include/foo -fPIC -L/test/lib -lbar -lfoo  \n" \
80
+		pkgconf --cflags --libs 'foo > 1.2,bar >= 1.3'
81
+}
82
+
83
+libs_cflags_version_alt_body()
84
+{
85
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
86
+	atf_check \
87
+		-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo  \n" \
88
+		pkgconf --cflags --libs 'foo' '>' '1.2'
89
+}
90
+
91
+libs_cflags_version_different_body()
92
+{
93
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
94
+	atf_check \
95
+		-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo  \n" \
96
+		pkgconf --cflags --libs 'foo' '!=' '1.3.0'
97
+}
98
+
99
+atf_test_case basic_libs_cflags_version_different_bad
100
+libs_cflags_version_different_bad_body()
101
+{
102
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
103
+	atf_check \
104
+		-s exit:1 \
105
+		-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" \
106
+		pkgconf --cflags --libs 'foo' '!=' '1.2.3'
107
+}
108
+
109
+exists_nonexitent_body()
110
+{
111
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
112
+	atf_check \
113
+		-s exit:1 \
114
+		pkgconf --exists nonexistant
115
+}
116
+
117
+nonexitent_body()
118
+{
119
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
120
+	atf_check \
121
+		-s exit:1 \
122
+		pkgconf nonexistant
123
+}
124
+
125
+exists_version_body()
126
+{
127
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
128
+	atf_check \
129
+		pkgconf --exists 'foo > 1.2'
130
+}
131
+
132
+exists_version_bad_body()
133
+{
134
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
135
+	atf_check \
136
+		-s exit:1 \
137
+		pkgconf --exists 'foo > 1.2.3'
138
+}
139
+
140
+exists_version_alt_body()
141
+{
142
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
143
+	atf_check \
144
+		pkgconf --exists 'foo' '>' '1.2'
145
+}
146
+
147
+uninstalled_bad_body()
148
+{
149
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
150
+	atf_check \
151
+		-s exit:1 \
152
+		pkgconf --uninstalled 'foo'
153
+}
154
+
155
+uninstalled_body()
156
+{
157
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
158
+	atf_check \
159
+		pkgconf --uninstalled 'omg'
160
+}
161
+
162
+exists_version_bad2_body()
163
+{
164
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
165
+	atf_check \
166
+		-s exit:1 \
167
+		pkgconf --exists 'foo >= '
168
+}
169
+
170
+exists_version_bad3_body()
171
+{
172
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
173
+	atf_check \
174
+		-s exit:1 \
175
+		pkgconf --exists 'tilde <= 1.0.0'
176
+}
177
+
178
+exists_body()
179
+{
180
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
181
+	atf_check \
182
+		pkgconf --exists 'tilde = 1.0.0~rc1'
183
+}
184
+
185
+exists2_body()
186
+{
187
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
188
+	atf_check \
189
+		pkgconf --exists 'tilde >= 1.0.0'
190
+}
191
+
192
+exists3_body()
193
+{
194
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
195
+	atf_check \
196
+		pkgconf --exists '' 'foo'
197
+}
198
+
199
+libs_intermediary_body()
200
+{
201
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
202
+	atf_check \
203
+		-o inline:"-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz  \n" \
204
+		pkgconf --libs intermediary-1 intermediary-2
205
+}
206
+
207
+libs_circular1_body()
208
+{
209
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
210
+	atf_check \
211
+		-o inline:"-lcircular-1 -lcircular-2 -lcircular-3  \n" \
212
+		pkgconf --libs circular-1
213
+}
214
+
215
+libs_circular2_body()
216
+{
217
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
218
+	atf_check \
219
+		-o inline:"-lcircular-3 -lcircular-1 -lcircular-2  \n" \
220
+		pkgconf --libs circular-3
221
+}
222
+
223
+libs_circular_directpc_body()
224
+{
225
+	atf_check \
226
+		-o inline:"-lcircular-1 -lcircular-2 -lcircular-3  \n" \
227
+		pkgconf --libs ${selfdir}/lib1/circular-3.pc
228
+}
229
+
230
+libs_static_body()
231
+{
232
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
233
+	atf_check \
234
+		-o inline:"/libfoo.a -pthread  \n" \
235
+		pkgconf --libs static-archive-libs
236
+}
237
+
238
+pkg_config_path_body()
239
+{
240
+	export PKG_CONFIG_PATH="${selfdir}/lib1${PATH_SEP}${selfdir}/lib2"
241
+	atf_check \
242
+		-o inline:"-L/test/lib -lfoo  \n" \
243
+		pkgconf --libs foo
244
+	atf_check \
245
+		-o inline:"-L/test/lib -lbar -lfoo  \n" \
246
+		pkgconf --libs bar
247
+}
248
+
249
+nolibs_body()
250
+{
251
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
252
+	atf_check \
253
+		-o inline:" \n" \
254
+		pkgconf --libs nolib
255
+}
256
+
257
+nocflags_body()
258
+{
259
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
260
+	atf_check \
261
+		-o inline:" \n" \
262
+		pkgconf --cflags nocflag
263
+}
264
+
265
+arbitary_path_body()
266
+{
267
+	cp ${selfdir}/lib1/foo.pc .
268
+	atf_check \
269
+		-o inline:"-L/test/lib -lfoo  \n" \
270
+		pkgconf --libs foo.pc
271
+}

+ 68
- 0
tests/builtins.sh View File

@@ -0,0 +1,68 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	modversion \
7
+	variable \
8
+	define_variable \
9
+	global_variable
10
+
11
+modversion_body()
12
+{
13
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
14
+	atf_check \
15
+		-o inline:"1.0.1  \n" \
16
+		pkgconf --modversion pkg-config
17
+}
18
+
19
+variable_body()
20
+{
21
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
22
+	atf_check \
23
+		-o inline:"/test  \n" \
24
+		pkgconf --variable=prefix foo
25
+}
26
+
27
+define_variable_body()
28
+{
29
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
30
+	atf_check \
31
+		-o inline:"/test2  \n" \
32
+		pkgconf --define-variable=prefix=/test2 --variable=prefix foo
33
+}
34
+
35
+global_variable_body()
36
+{
37
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
38
+	atf_check \
39
+		-o inline:"${selfdir}/lib1  \n"
40
+		pkgconf --exists -foo
41
+}
42
+
43
+argv_parse_3_body()
44
+{
45
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
46
+	atf_check \
47
+		-o inline:"-llib-1 -pthread /test/lib/lib2.so  \n" \
48
+		pkgconf --libs argv-parse-3
49
+}
50
+
51
+tilde_quoting_body()
52
+{
53
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
54
+	atf_check \
55
+		-o inline:"-L~ -ltilde  \n" \
56
+		pkgconf --libs tilde-quoting
57
+	atf_check \
58
+		-o inline:"-I~  \n" \
59
+		pkgconf --cflags tilde-quoting
60
+}
61
+
62
+paren_quoting_body()
63
+{
64
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
65
+	atf_check \
66
+		-o inline:"-L\$(libdir) -ltilde  \n" \
67
+		pkgconf --libs paren-quoting
68
+}

+ 23
- 0
tests/conflicts.sh View File

@@ -0,0 +1,23 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	libs \
7
+	ignore
8
+
9
+libs_body()
10
+{
11
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
12
+	atf_check \
13
+		-o inline:"-L/test/lib -lconflicts  \n" \
14
+		pkgconf --libs conflicts
15
+}
16
+
17
+ignore_body()
18
+{
19
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
20
+	atf_check \
21
+		-o inline:"-L/test/lib -lconflicts  \n" \
22
+		pkgconf --ignore-conflicts --libs conflicts
23
+}

+ 20
- 0
tests/framework.sh View File

@@ -0,0 +1,20 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	libs
7
+
8
+libs_body()
9
+{
10
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
11
+	atf_check \
12
+		-o inline:"-F/test/lib -framework framework-1  \n" \
13
+		pkgconf --libs framework-1
14
+	atf_check \
15
+		-o inline:"-F/test/lib -framework framework-2 -F/test/lib -framework framework-1  \n" \
16
+		pkgconf --libs framework-2
17
+	atf_check \
18
+		-o inline:"-F/test/lib -framework framework-1 -F/test/lib -framework framework-2  \n" \
19
+		pkgconf --libs framework-1 framework-2
20
+}

+ 91
- 0
tests/parser.sh View File

@@ -0,0 +1,91 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	dos \
7
+	no_trailing_newline \
8
+	argv_parse \
9
+	bad_option \
10
+	argv_parse_3 \
11
+	tilde_quoting \
12
+	paren_quoting \
13
+	multiline_field \
14
+	quoted
15
+
16
+dos_body()
17
+{
18
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
19
+	atf_check \
20
+		-o inline:"-L/test/lib/dos-lineendings -ldos-lineendings  \n" \
21
+		pkgconf --libs dos-lineendings
22
+}
23
+
24
+no_trailing_newline_body()
25
+{
26
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
27
+	atf_check \
28
+		-o inline:"-I/test/include/no-trailing-newline  \n" \
29
+		pkgconf --cflags no-trailing-newline
30
+}
31
+
32
+argv_parse_body()
33
+{
34
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
35
+	atf_check \
36
+		-o inline:"-llib-3 -llib-1 -llib-2 -lpthread  \n" \
37
+		pkgconf --libs argv-parse
38
+}
39
+
40
+bad_option_body()
41
+{
42
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
43
+	atf_check \
44
+		-e ignore \
45
+		-s eq:1 \
46
+		pkgconf --exists -foo
47
+}
48
+
49
+argv_parse_3_body()
50
+{
51
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
52
+	atf_check \
53
+		-o inline:"-llib-1 -pthread /test/lib/lib2.so  \n" \
54
+		pkgconf --libs argv-parse-3
55
+}
56
+
57
+tilde_quoting_body()
58
+{
59
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
60
+	atf_check \
61
+		-o inline:"-L~ -ltilde  \n" \
62
+		pkgconf --libs tilde-quoting
63
+	atf_check \
64
+		-o inline:"-I~  \n" \
65
+		pkgconf --cflags tilde-quoting
66
+}
67
+
68
+paren_quoting_body()
69
+{
70
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
71
+	atf_check \
72
+		-o inline:"-L\$(libdir) -ltilde  \n" \
73
+		pkgconf --libs paren-quoting
74
+}
75
+
76
+multiline_field_body()
77
+{
78
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
79
+	atf_check \
80
+		-e ignore \
81
+		-o match:"multiline description" \
82
+		pkgconf --list-all
83
+}
84
+
85
+quoted_body()
86
+{
87
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
88
+	atf_check \
89
+		-o inline:"-DQUOTED=\\\"bla\\\"  \n" \
90
+		pkgconf --cflags quotes
91
+}

+ 298
- 0
tests/provides.sh View File

@@ -0,0 +1,298 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	simple \
7
+	foo \
8
+	bar \
9
+	baz \
10
+	quux \
11
+	moo \
12
+	meow
13
+
14
+simple_body()
15
+{
16
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
17
+OUTPUT="provides-test-foo = 1.0.0
18
+provides-test-bar > 1.1.0
19
+provides-test-baz >= 1.1.0
20
+provides-test-quux < 1.2.0
21
+provides-test-moo <= 1.2.0
22
+provides-test-meow != 1.3.0
23
+provides = 1.2.3
24
+"
25
+	atf_check \
26
+		-o inline:"${OUTPUT}" \
27
+		pkgconf --print-provides provides
28
+	atf_check \
29
+		-o inline:"-lfoo  \n" \
30
+		pkgconf --libs provides-request-simple
31
+	atf_check \
32
+		-e ignore \
33
+		-s exit:1 \
34
+		pkgconf --no-provides --libs provides-request-simple
35
+}
36
+
37
+foo_body()
38
+{
39
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
40
+	atf_check \
41
+		-o ignore \
42
+		pkgconf --libs provides-test-foo
43
+	atf_check \
44
+		-o ignore \
45
+		pkgconf --libs 'provides-test-foo = 1.0.0'
46
+	atf_check \
47
+		-o ignore \
48
+		pkgconf --libs 'provides-test-foo >= 1.0.0'
49
+	atf_check \
50
+		-o ignore \
51
+		pkgconf --libs 'provides-test-foo <= 1.0.0'
52
+	atf_check \
53
+		-s exit:1 \
54
+		-e ignore \
55
+		-o ignore \
56
+		pkgconf --libs 'provides-test-foo != 1.0.0'
57
+	atf_check \
58
+		-s exit:1 \
59
+		-e ignore \
60
+		-o ignore \
61
+		pkgconf --libs 'provides-test-foo > 1.0.0'
62
+	atf_check \
63
+		-s exit:1 \
64
+		-e ignore \
65
+		-o ignore \
66
+		pkgconf --libs 'provides-test-foo < 1.0.0'
67
+}
68
+
69
+bar_body()
70
+{
71
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
72
+	atf_check \
73
+		-o ignore \
74
+		pkgconf --libs provides-test-bar
75
+	atf_check \
76
+		-o ignore \
77
+		pkgconf --libs 'provides-test-bar = 1.1.1'
78
+	atf_check \
79
+		-o ignore \
80
+		pkgconf --libs 'provides-test-bar >= 1.1.1'
81
+	atf_check \
82
+		-o ignore \
83
+		pkgconf --libs 'provides-test-bar <= 1.1.1'
84
+	atf_check \
85
+		-o ignore \
86
+		pkgconf --libs 'provides-test-bar != 1.1.0'
87
+	atf_check \
88
+		-s exit:1 \
89
+		-e ignore \
90
+		-o ignore \
91
+		pkgconf --libs 'provides-test-bar != 1.1.1'
92
+	atf_check \
93
+		-o ignore \
94
+		pkgconf --libs 'provides-test-bar > 1.1.1'
95
+	atf_check \
96
+		-s exit:1 \
97
+		-e ignore \
98
+		-o ignore \
99
+		pkgconf --libs 'provides-test-bar <= 1.1.0'
100
+	atf_check \
101
+		-o ignore \
102
+		pkgconf --libs 'provides-test-bar <= 1.2.0'
103
+}
104
+
105
+baz_body()
106
+{
107
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
108
+	atf_check \
109
+		-o ignore \
110
+		pkgconf --libs provides-test-baz
111
+	atf_check \
112
+		-o ignore \
113
+		pkgconf --libs 'provides-test-baz = 1.1.0'
114
+	atf_check \
115
+		-o ignore \
116
+		pkgconf --libs 'provides-test-baz >= 1.1.0'
117
+	atf_check \
118
+		-o ignore \
119
+		pkgconf --libs 'provides-test-baz <= 1.1.0'
120
+	atf_check \
121
+		-s exit:1 \
122
+		-e ignore \
123
+		-o ignore \
124
+		pkgconf --libs 'provides-test-baz != 1.1.0'
125
+	atf_check \
126
+		-o ignore \
127
+		pkgconf --libs 'provides-test-baz != 1.0.0'
128
+	atf_check \
129
+		-o ignore \
130
+		pkgconf --libs 'provides-test-baz > 1.1.1'
131
+	atf_check \
132
+		-o ignore \
133
+		pkgconf --libs 'provides-test-baz > 1.1.0'
134
+	atf_check \
135
+		-s exit:1 \
136
+		-e ignore \
137
+		-o ignore \
138
+		pkgconf --libs 'provides-test-baz < 1.1.0'
139
+	atf_check \
140
+		-o ignore \
141
+		pkgconf --libs 'provides-test-baz < 1.2.0'
142
+}
143
+
144
+quux_body()
145
+{
146
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
147
+	atf_check \
148
+		-o ignore \
149
+		pkgconf --libs provides-test-quux
150
+	atf_check \
151
+		-o ignore \
152
+		pkgconf --libs 'provides-test-quux = 1.1.9'
153
+	atf_check \
154
+		-o ignore \
155
+		pkgconf --libs 'provides-test-quux >= 1.1.0'
156
+	atf_check \
157
+		-o ignore \
158
+		pkgconf --libs 'provides-test-quux >= 1.1.9'
159
+	atf_check \
160
+		-s exit:1 \
161
+		-e ignore \
162
+		-o ignore \
163
+		pkgconf --libs 'provides-test-quux >= 1.2.0'
164
+	atf_check \
165
+		-s exit:1 \
166
+		-e ignore \
167
+		-o ignore \
168
+		pkgconf --libs 'provides-test-quux <= 1.2.0'
169
+	atf_check \
170
+		-o ignore \
171
+		pkgconf --libs 'provides-test-quux <= 1.1.9'
172
+	atf_check \
173
+		-o ignore \
174
+		pkgconf --libs 'provides-test-quux != 1.2.0'
175
+	atf_check \
176
+		-s exit:1 \
177
+		-e ignore \
178
+		-o ignore \
179
+		pkgconf --libs 'provides-test-quux != 1.1.0'
180
+	atf_check \
181
+		-s exit:1 \
182
+		-e ignore \
183
+		-o ignore \
184
+		pkgconf --libs 'provides-test-quux != 1.0.0'
185
+	atf_check \
186
+		-o ignore \
187
+		pkgconf --libs 'provides-test-quux > 1.1.9'
188
+	atf_check \
189
+		-s exit:1 \
190
+		-e ignore \
191
+		-o ignore \
192
+		pkgconf --libs 'provides-test-quux > 1.2.0'
193
+	atf_check \
194
+		-o ignore \
195
+		pkgconf --libs 'provides-test-quux < 1.1.0'
196
+	atf_check \
197
+		-s exit:1 \
198
+		-e ignore \
199
+		-o ignore \
200
+		pkgconf --libs 'provides-test-quux > 1.2.0'
201
+}
202
+
203
+moo_body()
204
+{
205
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
206
+	atf_check \
207
+		-o ignore \
208
+		pkgconf --libs provides-test-moo
209
+	atf_check \
210
+		-o ignore \
211
+		pkgconf --libs 'provides-test-moo = 1.2.0'
212
+	atf_check \
213
+		-o ignore \
214
+		pkgconf --libs 'provides-test-moo >= 1.1.0'
215
+	atf_check \
216
+		-o ignore \
217
+		pkgconf --libs 'provides-test-moo >= 1.2.0'
218
+	atf_check \
219
+		-s exit:1 \
220
+		-e ignore \
221
+		-o ignore \
222
+		pkgconf --libs 'provides-test-moo >= 1.2.1'
223
+	atf_check \
224
+		-o ignore \
225
+		pkgconf --libs 'provides-test-moo <= 1.2.0'
226
+	atf_check \
227
+		-s exit:1 \
228
+		-e ignore \
229
+		-o ignore \
230
+		pkgconf --libs 'provides-test-moo != 1.1.0'
231
+	atf_check \
232
+		-s exit:1 \
233
+		-e ignore \
234
+		-o ignore \
235
+		pkgconf --libs 'provides-test-moo != 1.0.0'
236
+	atf_check \
237
+		-o ignore \
238
+		pkgconf --libs 'provides-test-moo > 1.1.9'
239
+	atf_check \
240
+		-s exit:1 \
241
+		-e ignore \
242
+		-o ignore \
243
+		pkgconf --libs 'provides-test-moo > 1.2.0'
244
+	atf_check \
245
+		-o ignore \
246
+		pkgconf --libs 'provides-test-moo < 1.1.0'
247
+	atf_check \
248
+		-o ignore \
249
+		pkgconf --libs 'provides-test-moo < 1.2.0'
250
+}
251
+
252
+meow_body()
253
+{
254
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
255
+	atf_check \
256
+		-o ignore \
257
+		pkgconf --libs provides-test-meow
258
+	atf_check \
259
+		-s exit:1 \
260
+		-e ignore \
261
+		-o ignore \
262
+		pkgconf --libs 'provides-test-meow = 1.3.0'
263
+	atf_check \
264
+		-o ignore \
265
+		pkgconf --libs 'provides-test-meow != 1.3.0'
266
+	atf_check \
267
+		-s exit:1 \
268
+		-e ignore \
269
+		-o ignore \
270
+		pkgconf --libs 'provides-test-meow > 1.2.9'
271
+	atf_check \
272
+		-s exit:1 \
273
+		-e ignore \
274
+		-o ignore \
275
+		pkgconf --libs 'provides-test-meow < 1.3.1'
276
+	atf_check \
277
+		-o ignore \
278
+		pkgconf --libs 'provides-test-meow < 1.3.0'
279
+	atf_check \
280
+		-o ignore \
281
+		pkgconf --libs 'provides-test-meow > 1.3.0'
282
+	atf_check \
283
+		-s exit:1 \
284
+		-e ignore \
285
+		-o ignore \
286
+		pkgconf --libs 'provides-test-meow >= 1.3.0'
287
+	atf_check \
288
+		-o ignore \
289
+		pkgconf --libs 'provides-test-meow >= 1.3.1'
290
+	atf_check \
291
+		-s exit:1 \
292
+		-e ignore \
293
+		-o ignore \
294
+		pkgconf --libs 'provides-test-meow <= 1.3.0'
295
+	atf_check \
296
+		-o ignore \
297
+		pkgconf --libs 'provides-test-meow < 1.2.9'
298
+}

+ 68
- 0
tests/regress.sh View File

@@ -0,0 +1,68 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	variable \
7
+	keep_system_libs \
8
+	libs \
9
+	libs_only \
10
+	cflags_only \
11
+	incomplete_libs \
12
+	incomplete_cflags
13
+
14
+variable_body()
15
+{
16
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
17
+	atf_check \
18
+		-o inline:"/test/include\n" \
19
+		pkgconf --variable=includedir foo
20
+}
21
+
22
+keep_system_libs_body()
23
+{
24
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
25
+	atf_check \
26
+		-o inline:"-L/test/local/lib  \n" \
27
+		pkgconf --libs-only-L --keep-system-libs cflags-libs-only
28
+}
29
+
30
+libs_body()
31
+{
32
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
33
+	atf_check \
34
+		-o inline:"-L/test/local/lib -lfoo  \n" \
35
+		pkgconf --libs cflags-libs-only
36
+}
37
+
38
+libs_only_body()
39
+{
40
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
41
+	atf_check \
42
+		-o inline:"-L/test/local/lib -lfoo  \n" \
43
+		pkgconf --libs-only-L --libs-only-l cflags-libs-only
44
+}
45
+
46
+cflags_only_body()
47
+{
48
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
49
+	atf_check \
50
+		-o inline:"-I/test/local/include/foo  \n" \
51
+		pkgconf --cflags-only-I --cflags-only-other cflags-libs-only
52
+}
53
+
54
+incomplete_libs_body()
55
+{
56
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
57
+	atf_check \
58
+		-o inline:" \n" \
59
+		pkgconf --libs incomplete
60
+}
61
+
62
+incomplete_cflags_body()
63
+{
64
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
65
+	atf_check \
66
+		-o inline:" \n" \
67
+		pkgconf --cflags incomplete
68
+}

+ 79
- 0
tests/requires.sh View File

@@ -0,0 +1,79 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	libs \
7
+	libs_cflags \
8
+	libs_static \
9
+	argv_parse2 \
10
+	static_cflags \
11
+	private_duplication \
12
+	libs_static2 \
13
+	missing
14
+
15
+libs_body()
16
+{
17
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
18
+	atf_check \
19
+		-o inline:"-L/test/lib -lbar -lfoo  \n" \
20
+		pkgconf --libs bar
21
+}
22
+
23
+libs_cflags_body()
24
+{
25
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
26
+	atf_check \
27
+		-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbaz  \n" \
28
+		pkgconf --libs --cflags baz
29
+}
30
+
31
+libs_static_body()
32
+{
33
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
34
+	atf_check \
35
+		-o inline:"-L/test/lib -lbaz -L/test/lib -lzee -L/test/lib -lfoo  \n" \
36
+		pkgconf --static --libs baz
37
+}
38
+
39
+argv_parse2_body()
40
+{
41
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
42
+	atf_check \
43
+		-o inline:"-llib-1 -pthread /test/lib/lib2.so  \n" \
44
+		pkgconf --static --libs argv-parse-2
45
+}
46
+
47
+static_cflags_body()
48
+{
49
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
50
+	atf_check \
51
+		-o inline:"-fPIC -I/test/include/foo -DFOO_STATIC  \n" \
52
+		pkgconf --static --cflags baz
53
+}
54
+
55
+private_duplication_body()
56
+{
57
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
58
+	atf_check \
59
+		-o inline:"-lprivate -lfoo -lbaz -lzee -lbar -lfoo  \n" \
60
+		pkgconf --static --libs-only-l private-libs-duplication
61
+}
62
+
63
+libs_static2_body()
64
+{
65
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
66
+	atf_check \
67
+		-o inline:"-lbar -lbar-private -L/test/lib -lfoo  \n" \
68
+		pkgconf --static --libs static-libs
69
+}
70
+
71
+missing_body()
72
+{
73
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
74
+	atf_check \
75
+		-s exit:1 \
76
+		-e ignore \
77
+		-o inline:" \n" \
78
+		pkgconf --cflags missing-require
79
+}

+ 28
- 0
tests/sysroot.sh View File

@@ -0,0 +1,28 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	cflags \
7
+	variable
8
+
9
+cflags_body()
10
+{
11
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
12
+	export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
13
+	atf_check \
14
+		-o inline:"-fPIC -I${SYSROOT_DIR}/test/include/foo  \n" \
15
+		pkgconf --cflags baz
16
+}
17
+
18
+variable_body()
19
+{
20
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
21
+	export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
22
+	atf_check \
23
+		-o inline:"${SYSROOT_DIR}/test\n" \
24
+		pkgconf --variable=prefix foo
25
+	atf_check \
26
+		-o inline:"${SYSROOT_DIR}/test/include\n" \
27
+		pkgconf --variable=includedir foo
28
+}

+ 22
- 0
tests/test_env.sh.in View File

@@ -0,0 +1,22 @@
1
+export PATH="$(atf_get_srcdir)/../:${PATH}"
2
+selfdir="@abs_top_srcdir@/tests"
3
+PATH_SEP=":"
4
+SYSROOT_DIR="${selfdir}/test"
5
+if [ "$(uname -o)" = "Msys" ]; then
6
+	PATH_SEP=";"
7
+fi
8
+
9
+tests_init()
10
+{
11
+	TESTS="$@"
12
+	export TESTS
13
+	for t ; do
14
+		atf_test_case $t
15
+	done
16
+}
17
+
18
+atf_init_test_cases() {
19
+	for t in ${TESTS}; do
20
+		atf_add_test_case $t
21
+	done
22
+}

+ 38
- 0
tests/version.sh View File

@@ -0,0 +1,38 @@
1
+#!/usr/bin/env atf-sh
2
+
3
+. $(atf_get_srcdir)/test_env.sh
4
+
5
+tests_init \
6
+	atleast \
7
+	exact \
8
+	max
9
+
10
+atleast_body()
11
+{
12
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
13
+	atf_check \
14
+		pkgconf --atleast-version 1.0 foo
15
+	atf_check \
16
+		-s exit:1 \
17
+		pkgconf --atleast-version 2.0 foo
18
+}
19
+
20
+exact_body()
21
+{
22
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
23
+	atf_check \
24
+		-s exit:1 \
25
+		pkgconf --exact-version 1.0 foo
26
+	atf_check \
27
+		pkgconf --exact-version 1.2.3 foo
28
+}
29
+
30
+max_body()
31
+{
32
+	export PKG_CONFIG_PATH="${selfdir}/lib1"
33
+	atf_check \
34
+		-s exit:1 \
35
+		pkgconf --max-version 1.0 foo
36
+	atf_check \
37
+		pkgconf --max-version 2.0 foo
38
+}