Commit graph

46 commits

Author SHA1 Message Date
Dan Nicholson
65e37fe303 check: Test version comparisons within Requires fields
Verification of versions in Requires and friends happens differently
than the version comparison for command-line packages.
2012-10-03 05:33:32 -07:00
Dan Nicholson
9a54c588a5 check: Test all variants of --cflags and --libs
Make sure that the --*-only-* variants of --cflags and --libs do the
right thing. This should probably be extended to cover a chain of
packages to get the ordering right, but this is good for now.
2012-10-03 05:33:31 -07:00
Dan Nicholson
0a5d54d091 check: Ensure unknown options fail 2012-10-03 05:33:31 -07:00
Dan Nicholson
d4c0c14ba8 check: Ensure debugging output works correctly
This might be a little fragile, but it makes sure to exercise the
debug_spew function.
2012-10-03 05:33:31 -07:00
Dan Nicholson
4f7d2a1b28 check: Test -uninstalled functionality
Test the usage of -uninstalled packages with two .pc files: inst.pc and
inst-uninstalled.pc. pkg-config should prefer the -uninstalled version
unless PKG_CONFIG_DISABLE_UNINSTALLED is set. It should also use the
default value of pc_top_builddir unless PKG_CONFIG_TOP_BUILD_DIR is set.
2012-10-03 05:33:31 -07:00
Dan Nicholson
4426d487eb check: Test sysroot support
Checks that pkg-config prepends PKG_CONFIG_SYSROOT_DIR to -I and -L when
they don't point to system directories.
2012-10-03 05:33:31 -07:00
Dan Nicholson
42f30aee2e check: Test pkg-config version
Test that --version prints the current version and
--atleast-pkgconfig-version validates it.
2012-10-02 05:51:22 -07:00
Dan Nicholson
aba2c047cf check: Enhance --print-requires tests
Make the --print-requires and --print-requires-private tests actually
resolve Requires and output a specific version test.
2012-10-02 05:51:22 -07:00
Dan Nicholson
0e6ea44d68 check: Check path handling
Add a test for pkg-config's path handling. The first test covers
PKG_CONFIG_PATH, and the second covers the built-in path. For this one
we need to unset the PKG_CONFIG_LIBDIR that normally is set during the
tests. Since we can't rely on the contents of the default path, we just
check to see that the built-in path matches what was specified in
configure. To do this, we need to add a bunch of variables to config.sh
so the variable resolves. These variables don't need to be exported,
though.
2012-10-02 05:51:22 -07:00
Dan Nicholson
c7e12356bc check: Exercise all printing options
Add tests for checking the output of various options that print
information. For --list-all, a subdirectory with only two packages has
been added so that its output doesn't change when more test packages are
added to the check directory.
2012-09-29 09:57:46 -07:00
Dan Nicholson
31a9f900e1 check: Test --define-variable corner cases 2012-09-29 09:09:30 -07:00
Dan Nicholson
397d414a6a check: Pass args to test function instead of setting in variable
The run_test shell function was running pkg-config with arguments stored
in an environment variable. This has problems when trying to pass shell
special characters with the proper escaping. Instead, pass the arguments
to the test where they can maintain correct formatting through use of
the special variable "$@".
2012-09-29 08:50:57 -07:00
Dan Nicholson
78b419a3df Specify pkg-config to test with from make
By specifying the pkg-config to use for testing from make, we can easily
control its path and add the .exe extension for Windows. It also allows
easy testing of another pkg-config from make:

  make check TESTS_PKG_CONFIG=/usr/bin/pkg-config
2012-08-19 08:49:58 -07:00
Dan Nicholson
305913a6b1 Handle POSIX shell for tests in configure and Makefile
Although the trick of finding a POSIX shell in the system PATH works
fine most of the time, it has some drawbacks.

* The commands must be copied into every test script.
* The scripts are always forced to re-execute themselves.
* There's no guarantee the sh found in `getconf PATH` is a POSIX shell
  and there's no way to override it.

Move the handling of this shell to configure where we can detect it
once. This gives preference to bash and ksh since they're typically
POSIX compatible. It also uses the current PATH with the getconf PATH at
the end which should allow things to work on platforms where getconf
might not be available like mingw/msys.

By specifying the shell in TESTS_ENVIRONMENT, automake will run each
script with this shell and we can drop the re-exec dance.
2012-08-19 08:03:00 -07:00
Dan Nicholson
4bce8b46b2 Exit on errors for check-missing like others
This ensures that the make shows FAIL in case one test fails and a
subsequent one succeeds.
2012-08-19 07:34:35 -07:00
Dan Nicholson
3ead3dfb78 Enable Requires and Requires.private for --exists
Prior to pkg-config 0.24, --exists honored Requires and
Requires.private. This was regressed in commits 02d5ae3f and 669bfe2e,
which split the handling of Requires and Requires.private out more
correctly for other options. This adds exists to the group of options
that enable the Requires functionality.

Freedesktop #43149
2012-07-11 05:24:23 -07:00
Dan Nicholson
a077e02430 Make check-missing test more explicit with --exists
Currently the check-missing passes the packages on the command line with
no options prior to running through --cflags/--libs, etc. Make this more
explicitly pass --exists since this is a much more common operation
performed from PKG_CHECK_MODULES.

The expected result of 0 when Requires or Requires.private is missing is
a regression from pre-0.24 pkg-config.
2012-07-11 05:24:23 -07:00
Dan Nicholson
d11df7ffe0 Ensure test search path is confined to check directory
If only PKG_CONFIG_PATH is set when running the tests, we'll still pick
up packages from the system default path. By overriding that with
PKG_CONFIG_LIBDIR and unsetting PKG_CONFIG_PATH, the path is forced to
the check directory.
2012-05-30 05:49:14 -07:00
Dan Nicholson
5c219ca67d Makefile cleanup
No functional change, but makes things a little cleaner.
2012-05-23 05:47:26 -07:00
LRN
d415d91713 Fix test --define-variable invocation to avoid MSYS path mangling
Otherwise tests won't pass when running in MSYS.
2012-05-18 09:14:08 -07:00
Dan Nicholson
a83a14c291 Unify handling of operator and command line option version checking
The code for --exact/atleast/max-version was taking a different path
than the handling of operators like =/>=/<=. Make the long option
versions override the operators and take place during the standard
package checking stage. This also means that --print-errors is
respected.

Fixes Freedesktop #8653
2012-05-10 05:51:35 -07:00
Tollef Fog Heen
1b1bd80f5f Allow $() through unescaped.
$(foo) is used for make escapes, so allow them through.

Freedesktop #33920
2011-04-13 22:02:51 +02:00
Dan Nicholson
a465eacaf6 Add test to exercise broken command option handling
The ancient bundled popt mishandles some cases of option parsing.

http://lists.freedesktop.org/archives/pkg-config/2010-March/000508.html

Add a test program to exercise it. This should encourage people to use
an external popt until we have a better fix.
2010-06-16 16:49:52 -07:00
Tollef Fog Heen
66aa02a60b Make sure to distribute the blank fields .pc file too 2010-05-28 18:09:10 +02:00
Tollef Fog Heen
4c6ff1c3d5 Add test case for empty fields
Make sure we don't run into the bug fixed by 6a27c57 again.
2010-05-27 22:23:40 +02:00
Tollef Fog Heen
d9077956e2 Fix up test framework to better report errors when pkg-config exits non-zero 2010-05-27 22:17:54 +02:00
Tollef Fog Heen
2ce485c65d Allow : and = unescaped in output too 2010-05-27 21:48:52 +02:00
Tollef Fog Heen
37d59a0c44 Distcheck fixes
Various small fixes to make distcheck pass
2010-05-23 23:31:14 +02:00
Tollef Fog Heen
69a7eaa676 Make it possible to escape paths containing special shell characters
Allow paths and other components to contain shell metacharacters, but
escape them on output.  White space has to be escaped in the input
files using quotes or backslashes

Freedesktop.org #3571
2010-05-23 23:11:40 +02:00
Tollef Fog Heen
c5a3105f41 Handle -idirafter specially
Don't split -idirafter from its argument.

Fixes Freedesktop #23480
2010-05-09 09:43:10 +02:00
Tollef Fog Heen
1bcb18ca35 Fix include path for check/common 2009-06-30 03:47:49 +02:00
Tollef Fog Heen
e4d39435b9 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* check/check-missing, check/check-libs,
	check/check-requires-private: Handle the case of indirect being
	enabled correctly in checks.
2009-03-30 22:03:38 +02:00
Tollef Fog Heen
f37f04a78a 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* check/common, check/config.sh.in, check/Makefile.am,
	configure.in: Make it possible to check for configure variables in
	the check scripts.  So far, only direct/indirect is exposed.
2009-03-30 21:50:01 +02:00
Tollef Fog Heen
669bfe2e0d 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* pkg.[ch], main.c, check/check-missing: Don't recurse Requires at
	all unless we need to.  Add check.  Again, thanks to Loïc Minier
	for most of the idea and the implementation.
2009-03-30 20:49:17 +02:00
Tollef Fog Heen
02d5ae3fb6 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* pkg.[ch], parse.[ch], main.c, check/Makefile.am,
	check/check-missing, check/missing-requires-private.pc:
	Skip Requires.private unless we need to look at them for cflags.
	Add test case.  Thanks to Loïc Minier for most of the idea and the
	implementation.  Debian #475031
2009-03-30 20:40:53 +02:00
Tollef Fog Heen
34657e444f 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* check/common: Run all tests in the C locale
2009-03-30 20:23:04 +02:00
Tollef Fog Heen
4070cc2339 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* check/common: Add support for non-zero return codes to test
	framework.  Thanks to Loïc Minier for the idea.
2009-03-30 20:14:33 +02:00
Tollef Fog Heen
69dafea1c8 2008-03-23 Tollef Fog Heen <tfheen@err.no>
* check/check-conflicts, check/conflicts-test.pc: New test,
       testing that conflicts work as they should.

       * pkg.c (verify_package): Make the conflicts check not only check
       package versions, but also package names.  This makes conflicts
       functional, something they were not before.
2008-03-23 21:39:07 +01:00
Tollef Fog Heen
15e72cef72 2008-03-23 Tollef Fog Heen <tfheen@err.no>
* check/check-requires-private: Remove unnecessary set -x
2008-03-23 21:11:25 +01:00
Tollef Fog Heen
3954a7ee3e 2008-03-23 Tollef Fog Heen <tfheen@err.no>
* check/check-cflags, check/check-define-variable,
	check/check-includedir, check/check-libs,
	check/check-libs-private, check/check-requires-private: Replace
	the crazy -d ~root check with a more proper way to just make sure
	we are running under a POSIX shell.  Thanks to Kjetil Torgrim
	Homme for the tip about using getconf PATH.
2008-03-23 21:07:39 +01:00
Tollef Fog Heen
9e5bcc26f2 2008-01-16 Tollef Fog Heen <tfheen@err.no>
* check/check-requires-private: Fix up test case.  We want to get
	the private -I option in all cases.
2008-01-16 23:46:58 +01:00
Tollef Fog Heen
3d673211a7 Add includedir test 2005-08-27 09:05:14 +00:00
Tollef Fog Heen
145dba778d Add solaris workaround for tests
/bin/sh on solaris isn't POSIX compliant, so we just exec a POSIX
shell on Solaris.
2005-08-22 10:41:08 +00:00
Arch Librarian
29afc67918 2005-06-27 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-06-27 19:53:05 GMT
2005-06-27  Tollef Fog Heen  <tfheen@err.no>

    All those Requires.private changes are thanks to James
    Henstridge.  Thanks!

    * check/private-dep.pc, check/public-dep.pc,
      check/requires-test.pc: New files, data for the
    check-requires-private test.

    * check/check-requires-private: New test to check for
    Requires.private support.

    * check/Makefile.am (EXTRA_DIST, TESTS): Add Requires.private
    test.

    * pkg.h (struct _Package): Add requires_private

    * pkg.c (get_requires_private, fill_list_single_package)
    (fill_list, verify_package, verify_package, get_merged)
    (get_merged_from_back, get_multi_merged)
    (get_multi_merged_from_back, package_get_l_libs)
    (packages_get_l_libs, package_get_L_libs, packages_get_L_libs)
    (package_get_other_libs, packages_get_other_libs)
    (package_get_I_cflags, packages_get_I_cflags)
    (package_get_other_cflags, packages_get_other_cflags): Handle
    private requires and cascading changes.

    * parse.c (parse_requires_private, parse_conflicts)
    (parse_package_file): Handle Requires.private
2005-07-14 13:07:31 +00:00
Arch Librarian
20d118d57a 2005-05-21 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-05-21 09:14:47 GMT
2005-05-21  Tollef Fog Heen  <tfheen@err.no>

    * check/check-libs-private: New test to check for support for
    private libraries.

    * check/simple.pc (prefix): Add Libs.private header.

    * check/Makefile.am (TESTS): Add check-libs-private test

    * pkg.h: Adjust function prototypes.

    * pkg.c: Add global ignore_private_libs variable.
    (scan_dir): Use the correct free function.  Stop leaking file
    descriptors.
    (package_get_l_libs, packages_get_l_libs, package_get_L_libs,
    packages_get_L_libs): Stop the recursive silliness and go back to
    old behaviour.
    (packages_get_all_libs): Adjust parameters to packages_get_*_libs
    (enable_private_libs, disable_private_libs): Trivial helper
    functions.

    * pkg-config.1: Update documentation wrt search path (Debian
    #308942), update docs for Libs.private and add the problematic
    handling of mixing = and non-= arguments to the bugs section.

    * parse.h: Adjust parameters for parse_package_file to get private
    libs or not.

    * parse.c (trim_and_sub): Fix memory leak.
    (_do_parse_libs): New function including what's common between
    parse_libs and parse_private_libs.
    (parse_libs_private): New function.  Handle private libraries.
    (parse_line): Add . to the list of valid characters in headers (so
    Libs.private works correctly.
    (parse_line): Fix memory leaks.
    (parse_line): Handle Libs.private.
    (parse_package_file): Fix memory leak.

    * main.c (main): Fix memory leak.

    * NEWS: Document changes to inter-library handling.

    * main.c (main): Handle inter-library dependencies old-style, but
    do private libraries too.  Adjust parameters to
    packages_get_*_libs.

    * configure.in: Change comment wrt inter-library handling to talk
    about private libraries instead.
2005-07-14 13:07:18 +00:00
Arch Librarian
96d4dc19c7 2005-03-29 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-03-29 07:09:37 GMT
2005-03-29  Tollef Fog Heen  <tfheen@err.no>

        * check/check-cflags, check/check-define-variable,
        check/check-libs, check/common, check/Makefile.am,
        check/simple.pc:  Add simple test framework and begin writing
        tests.

        * Makefile.am, configure.in: Make in check/ as well.
2005-07-14 13:06:38 +00:00