Add Kyua tests

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

@ -11,9 +11,7 @@ AM_CFLAGS = -Wall -Wextra -Wformat=2 -std=gnu99 -DPKG_DEFAULT_PATH=\"$(pkgconfig
bin_PROGRAMS = pkgconf
lib_LTLIBRARIES = libpkgconf.la
EXTRA_DIST = Kyuafile \
tests/Kyuafile \
pkg.m4 \
EXTRA_DIST = pkg.m4 \
tests/lib1/argv-parse-2.pc \
tests/lib1/dos-lineendings.pc \
tests/lib1/paren-quoting.pc \
@ -57,7 +55,25 @@ EXTRA_DIST = Kyuafile \
tests/lib1/depgraph-break.pc \
tests/lib1/cflags-whitespace.pc \
tests/lib1/provides.pc \
tests/lib1/provides-request-simple.pc
tests/lib1/provides-request-simple.pc \
tests/test_env.sh \
$(test_scripts)
test_scripts= \
tests/basic.sh \
tests/builtins.sh \
tests/conflicts.sh \
tests/framework.sh \
tests/parser.sh \
tests/provides.sh \
tests/regress.sh \
tests/requires.sh \
tests/sysroot.sh \
tests/version.sh
check_SCRIPTS= $(test_scripts:.sh=)
SUFFIXES= .sh
pkginclude_HEADERS = libpkgconf/bsdstubs.h libpkgconf/iter.h libpkgconf/libpkgconf.h libpkgconf/stdinc.h
libpkgconf_la_SOURCES = \
@ -84,7 +100,12 @@ dist_doc_DATA = README.md AUTHORS
m4datadir = $(datadir)/aclocal
m4data_DATA = pkg.m4
CLEANFILES = $(EXTRA_PROGRAMS)
CLEANFILES = $(EXTRA_PROGRAMS) \
$(check_SCRIPTS)
check: pkgconf $(check_SCRIPTS)
kyua --config=none test --kyuafile='$(top_builddir)/Kyuafile' \
--build-root='$(top_builddir)'
check: pkgconf
$(SHELL) tests/run.sh ./pkgconf
.sh:
install -m 755 $< $@

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

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

@ -0,0 +1,13 @@
syntax(2)
test_suite('pkgconf')
atf_test_program{name='basic'}
atf_test_program{name='requires'}
atf_test_program{name='regress'}
atf_test_program{name='parser'}
atf_test_program{name='sysroot'}
atf_test_program{name='conflicts'}
atf_test_program{name='version'}
atf_test_program{name='framework'}
atf_test_program{name='provides'}

@ -0,0 +1,271 @@
#!/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 \
pkg_config_path \
nolibs \
nocflags \
arbitary_path
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:"-I/test/include/foo -fPIC -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:"-I/test/include/foo -fPIC -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"
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 \
pkgconf --exists 'tilde <= 1.0.0'
}
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 \
pkgconf --exists 'tilde >= 1.0.0'
}
exists3_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
pkgconf --exists '' 'foo'
}
libs_intermediary_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz \n" \
pkgconf --libs intermediary-1 intermediary-2
}
libs_circular1_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lcircular-1 -lcircular-2 -lcircular-3 \n" \
pkgconf --libs circular-1
}
libs_circular2_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lcircular-3 -lcircular-1 -lcircular-2 \n" \
pkgconf --libs circular-3
}
libs_circular_directpc_body()
{
atf_check \
-o inline:"-lcircular-1 -lcircular-2 -lcircular-3 \n" \
pkgconf --libs ${selfdir}/lib1/circular-3.pc
}
libs_static_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"/libfoo.a -pthread \n" \
pkgconf --libs static-archive-libs
}
pkg_config_path_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1${PATH_SEP}${selfdir}/lib2"
atf_check \
-o inline:"-L/test/lib -lfoo \n" \
pkgconf --libs foo
atf_check \
-o inline:"-L/test/lib -lbar -lfoo \n" \
pkgconf --libs bar
}
nolibs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:" \n" \
pkgconf --libs nolib
}
nocflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:" \n" \
pkgconf --cflags nocflag
}
arbitary_path_body()
{
cp ${selfdir}/lib1/foo.pc .
atf_check \
-o inline:"-L/test/lib -lfoo \n" \
pkgconf --libs foo.pc
}

@ -0,0 +1,68 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
modversion \
variable \
define_variable \
global_variable
modversion_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"1.0.1 \n" \
pkgconf --modversion pkg-config
}
variable_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"/test \n" \
pkgconf --variable=prefix foo
}
define_variable_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"/test2 \n" \
pkgconf --define-variable=prefix=/test2 --variable=prefix foo
}
global_variable_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"${selfdir}/lib1 \n"
pkgconf --exists -foo
}
argv_parse_3_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-llib-1 -pthread /test/lib/lib2.so \n" \
pkgconf --libs argv-parse-3
}
tilde_quoting_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L~ -ltilde \n" \
pkgconf --libs tilde-quoting
atf_check \
-o inline:"-I~ \n" \
pkgconf --cflags tilde-quoting
}
paren_quoting_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L\$(libdir) -ltilde \n" \
pkgconf --libs paren-quoting
}

@ -0,0 +1,23 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
libs \
ignore
libs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lconflicts \n" \
pkgconf --libs conflicts
}
ignore_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lconflicts \n" \
pkgconf --ignore-conflicts --libs conflicts
}

@ -0,0 +1,20 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
libs
libs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-F/test/lib -framework framework-1 \n" \
pkgconf --libs framework-1
atf_check \
-o inline:"-F/test/lib -framework framework-2 -F/test/lib -framework framework-1 \n" \
pkgconf --libs framework-2
atf_check \
-o inline:"-F/test/lib -framework framework-1 -F/test/lib -framework framework-2 \n" \
pkgconf --libs framework-1 framework-2
}

@ -0,0 +1,91 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
dos \
no_trailing_newline \
argv_parse \
bad_option \
argv_parse_3 \
tilde_quoting \
paren_quoting \
multiline_field \
quoted
dos_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib/dos-lineendings -ldos-lineendings \n" \
pkgconf --libs dos-lineendings
}
no_trailing_newline_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-I/test/include/no-trailing-newline \n" \
pkgconf --cflags no-trailing-newline
}
argv_parse_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-llib-3 -llib-1 -llib-2 -lpthread \n" \
pkgconf --libs argv-parse
}
bad_option_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-e ignore \
-s eq:1 \
pkgconf --exists -foo
}
argv_parse_3_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-llib-1 -pthread /test/lib/lib2.so \n" \
pkgconf --libs argv-parse-3
}
tilde_quoting_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L~ -ltilde \n" \
pkgconf --libs tilde-quoting
atf_check \
-o inline:"-I~ \n" \
pkgconf --cflags tilde-quoting
}
paren_quoting_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L\$(libdir) -ltilde \n" \
pkgconf --libs paren-quoting
}
multiline_field_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-e ignore \
-o match:"multiline description" \
pkgconf --list-all
}
quoted_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-DQUOTED=\\\"bla\\\" \n" \
pkgconf --cflags quotes
}

@ -0,0 +1,298 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
simple \
foo \
bar \
baz \
quux \
moo \
meow
simple_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
OUTPUT="provides-test-foo = 1.0.0
provides-test-bar > 1.1.0
provides-test-baz >= 1.1.0
provides-test-quux < 1.2.0
provides-test-moo <= 1.2.0
provides-test-meow != 1.3.0
provides = 1.2.3
"
atf_check \
-o inline:"${OUTPUT}" \
pkgconf --print-provides provides
atf_check \
-o inline:"-lfoo \n" \
pkgconf --libs provides-request-simple
atf_check \
-e ignore \
-s exit:1 \
pkgconf --no-provides --libs provides-request-simple
}
foo_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o ignore \
pkgconf --libs provides-test-foo
atf_check \
-o ignore \
pkgconf --libs 'provides-test-foo = 1.0.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-foo >= 1.0.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-foo <= 1.0.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-foo != 1.0.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-foo > 1.0.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-foo < 1.0.0'
}
bar_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o ignore \
pkgconf --libs provides-test-bar
atf_check \
-o ignore \
pkgconf --libs 'provides-test-bar = 1.1.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-bar >= 1.1.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-bar <= 1.1.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-bar != 1.1.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-bar != 1.1.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-bar > 1.1.1'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-bar <= 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-bar <= 1.2.0'
}
baz_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o ignore \
pkgconf --libs provides-test-baz
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz = 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz >= 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz <= 1.1.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-baz != 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz != 1.0.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz > 1.1.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz > 1.1.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-baz < 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-baz < 1.2.0'
}
quux_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o ignore \
pkgconf --libs provides-test-quux
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux = 1.1.9'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux >= 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux >= 1.1.9'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-quux >= 1.2.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-quux <= 1.2.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux <= 1.1.9'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux != 1.2.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-quux != 1.1.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-quux != 1.0.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux > 1.1.9'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-quux > 1.2.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-quux < 1.1.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-quux > 1.2.0'
}
moo_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o ignore \
pkgconf --libs provides-test-moo
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo = 1.2.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo >= 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo >= 1.2.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-moo >= 1.2.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo <= 1.2.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-moo != 1.1.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-moo != 1.0.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo > 1.1.9'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-moo > 1.2.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo < 1.1.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-moo < 1.2.0'
}
meow_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o ignore \
pkgconf --libs provides-test-meow
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-meow = 1.3.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-meow != 1.3.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-meow > 1.2.9'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-meow < 1.3.1'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-meow < 1.3.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-meow > 1.3.0'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-meow >= 1.3.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-meow >= 1.3.1'
atf_check \
-s exit:1 \
-e ignore \
-o ignore \
pkgconf --libs 'provides-test-meow <= 1.3.0'
atf_check \
-o ignore \
pkgconf --libs 'provides-test-meow < 1.2.9'
}

@ -0,0 +1,68 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
variable \
keep_system_libs \
libs \
libs_only \
cflags_only \
incomplete_libs \
incomplete_cflags
variable_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"/test/include\n" \
pkgconf --variable=includedir foo
}
keep_system_libs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/local/lib \n" \
pkgconf --libs-only-L --keep-system-libs cflags-libs-only
}
libs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/local/lib -lfoo \n" \
pkgconf --libs cflags-libs-only
}
libs_only_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/local/lib -lfoo \n" \
pkgconf --libs-only-L --libs-only-l cflags-libs-only
}
cflags_only_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-I/test/local/include/foo \n" \
pkgconf --cflags-only-I --cflags-only-other cflags-libs-only
}
incomplete_libs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:" \n" \
pkgconf --libs incomplete
}
incomplete_cflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:" \n" \
pkgconf --cflags incomplete
}

@ -0,0 +1,79 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
libs \
libs_cflags \
libs_static \
argv_parse2 \
static_cflags \
private_duplication \
libs_static2 \
missing
libs_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lbar -lfoo \n" \
pkgconf --libs bar
}
libs_cflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbaz \n" \
pkgconf --libs --cflags baz
}
libs_static_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lbaz -L/test/lib -lzee -L/test/lib -lfoo \n" \
pkgconf --static --libs baz
}
argv_parse2_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-llib-1 -pthread /test/lib/lib2.so \n" \
pkgconf --static --libs argv-parse-2
}
static_cflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-fPIC -I/test/include/foo -DFOO_STATIC \n" \
pkgconf --static --cflags baz
}
private_duplication_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lprivate -lfoo -lbaz -lzee -lbar -lfoo \n" \
pkgconf --static --libs-only-l private-libs-duplication
}
libs_static2_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lbar -lbar-private -L/test/lib -lfoo \n" \
pkgconf --static --libs static-libs
}
missing_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-s exit:1 \
-e ignore \
-o inline:" \n" \
pkgconf --cflags missing-require
}

@ -0,0 +1,28 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
cflags \
variable
cflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
atf_check \
-o inline:"-fPIC -I${SYSROOT_DIR}/test/include/foo \n" \
pkgconf --cflags baz
}
variable_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
atf_check \
-o inline:"${SYSROOT_DIR}/test\n" \
pkgconf --variable=prefix foo
atf_check \
-o inline:"${SYSROOT_DIR}/test/include\n" \
pkgconf --variable=includedir foo
}

@ -0,0 +1,22 @@
export PATH="$(atf_get_srcdir)/../:${PATH}"
selfdir="@abs_top_srcdir@/tests"
PATH_SEP=":"
SYSROOT_DIR="${selfdir}/test"
if [ "$(uname -o)" = "Msys" ]; then
PATH_SEP=";"
fi
tests_init()
{
TESTS="$@"
export TESTS
for t ; do
atf_test_case $t
done
}
atf_init_test_cases() {
for t in ${TESTS}; do
atf_add_test_case $t
done
}

@ -0,0 +1,38 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
atleast \
exact \
max
atleast_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
pkgconf --atleast-version 1.0 foo
atf_check \
-s exit:1 \
pkgconf --atleast-version 2.0 foo
}
exact_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-s exit:1 \
pkgconf --exact-version 1.0 foo
atf_check \
pkgconf --exact-version 1.2.3 foo
}
max_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-s exit:1 \
pkgconf --max-version 1.0 foo
atf_check \
pkgconf --max-version 2.0 foo
}
Loading…
Cancel
Save