summaryrefslogtreecommitdiff
path: root/check
Commit message (Collapse)AuthorAgeFilesLines
* Only strip duplicate arguments when they appear consecutivelyflag-order-fixesDan Nicholson2012-12-042-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pkg-config strips all duplicate arguments from the flag output string. This is done for 2 reasons: 1. When a package shows up twice in the final package list after resolving all Requires, stripping was used to ensure it's flags only showed up once at the correct location. 2. An optimization so that the output string is not excessively long. Since commit c6ec7869, 1. is no longer necessary as the final package list only contains each package once. 2. causes problems when applied too aggressively since some arguments have different semantics depending on the prior or subsequent arguments. To keep a bit of optimization, the stripping is reduced to only removing consecutive duplicate arguments. This should ensure that the semantics are kept intact while removing obviously unnecessary arguments. The drawback is that some arguments will now appear multiple times in the output when they previously would have only appeared once. Here we have to rely on the tools using these arguments to handle the duplicates appropriately since there is no way for pkg-config to encode all the semantics of those arguments. Another thing that can help this situation is if pkg-config is used for all packages in the Requires chain so that the Libs/Cflags of each package only pertain to itself and don't encode the compiling/linking rules of a 3rd party package. Freedesktop #16101 (https://bugs.freedesktop.org/show_bug.cgi?id=16101)
* Output -l and other Libs flags in the order they appearDan Nicholson2012-12-044-24/+23
| | | | | | | | | | | | | | | Often other Libs flags have semantics that are based on their context with -l arguments. For example, the GNU linker options -Bdynamic/-Bstatic pertain only to the objects or link options that follow them. So, a valid link command containing these options would get mangled by pkg-config since it separates -l flags from others.. -Bdynamic -la -Bstatic -lb -> -Bdynamic -Bstatic -la -lb Instead, output -l and other Libs flags in a single pass so they mantain their ordering. Freedesktop #19950 (https://bugs.freedesktop.org/show_bug.cgi?id=19950)
* Output -L Libs flags before other Libs flagsDan Nicholson2012-12-046-19/+19
| | | | | | | Outputting other Libs flags such as -Wl,foo just prior to the -l Libs flags gives a better chance the --libs output will be correct. This should be no change in the usage of the output since pkg-config currently groups all flag types together.
* Sort -other Libs and Cflags by package order instead of path orderDan Nicholson2012-12-042-10/+10
| | | | | | | | For some flags, pkg-config will sort them by the depth of their .pc path before outputting. The idea is that flags from a deeper path should come earlier in the command line. This makes sense for -L and -I flags, but not for generic linker and compiler flags. For these flags and -l flags, it makes sense to sort them only by package order.
* Start from end of package lists when processing RequiresDan Nicholson2012-12-033-19/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Prior to commit 6ecf318, the resolved list of required packages was built in an appending way where each package on the command line or in Requires would appear in the list in the order they appeared. With 6ecf318, that list building was changed to prepending, which had a subtle change on the resolved order. For example, suppose package a has "Requires: b c d". Previously, the list would be built as a->b->c->d by appending each as they were encountered. Now, the list is built by walking all the way down the dependency chain for each package in a depth first manner and prepending packages while unwinding. This would result in the package ilst being a->d->c->b. This same effect happens with the command line packages where previously requesting packages x and y would create a package list of x->y and now produces a list of y->x. While technically these should be the same since there are no interdependencies, it's causes flags to be output in different order than previously in pkg-config. This can be seen most readily in the check-gtk test. Instead, operate on the package lists backwards when building the resolved package list.
* Remove duplicate packages after resolving requiresDan Nicholson2012-12-032-5/+3
| | | | | | | | | Makes the resolved package list be correctly serialized with each package only appearing once. This provides more consistency between the various flag outputs by ensuring that the flags from each package are only grabbed once. This makes a difference since the duplicate flag stripping happens from the end of the output (-l) or the beginning of the output (-L/-I/other).
* Always use --static test results for indirect depencency resultsDan Nicholson2012-11-294-25/+31
| | | | | | | Often the expected results for the indirect dependency tests fell behind because it's not a typical test scenario. However, since the results are always the same as --static, they can just use the same results and the test can be run conditionally without --static based on configuration.
* Add a gtk testcase to provide something with complex interactionsDan Nicholson2012-11-2828-2/+406
| | | | | | | | The pkg-config testsuite has pretty good coverage of the implementation, but it lacks a complex case that tests the interactions of non-trivial .pc files. gtk is a very common package that meets this goal. This is a snapshot from my F16 system, and it should provide a good way to see how changes in the implementation regress a real world case.
* Test stripping of duplicate flagsDan Nicholson2012-11-284-1/+40
| | | | | | | pkg-config aggressively strips all duplicate arguments from the final output it builds. This is not only and optimization, but it also allows the flag ordering to work correctly when a package on the command line is required by another on the command line.
* Test ordering of flags based on package depth and pathDan Nicholson2012-11-2811-1/+301
| | | | | | | | The current tests are good at checking whether gathering the Cflags or Libs from one or two packages works correctly, but they don't check the sorting algorithm much at all. In particular, the interactions between the package order in the Requires chain and in the path can make the sorting of the flags subtly different.
* Allow all combinations of --cflags and --libs variantsDan Nicholson2012-11-034-0/+108
| | | | | | | | | Use a bitmask to keep track of what Libs/Cflags to output. This makes it simple to handle any combination of --cflags and --libs option variants. A lot of excess code is removed in the process as all the flags options can now be carried around in a single variable. Freedesktop #54388 (https://bugs.freedesktop.org/show_bug.cgi?id=54388)
* Don't crash on --print-variables when there are no variablesDan Nicholson2012-10-133-2/+9
| | | | | | | | Apparently g_hash_table_foreach doesn't check for NULL input, so make sure we don't call it to print the variables if the variable list is empty. Freedesktop #54721
* Support circular Requires loopsDan Nicholson2012-10-135-1/+46
| | | | | | | | | | | After the packages are parsed, pkg-config recurses through all the required packages to generate one list. Before descending another level, check to see if the package has already been handled and skip it. This allows packages to require each other circularly by breaking the loop. A test has been added resolving a two level deep circular dependency. Freedesktop #7331
* Consistently resolve requires depth-first to fix non-l flag orderingDan Nicholson2012-10-136-5/+37
| | | | | | | | | | | | | | | | | | | | | | | recursive_fill_list() is used to order Requires and Requires.private, but it relied on fill_one_level() to make the list adjustments as it descended the package tree. There were two issues with this approach: 1. It added all the dependencies from a package immediately rather than descending through each dependency first. This made it sort of mix between depth- and breadth-first resolving. 2. It did not add the requested package to the list, forcing the caller to add it. This simplifies the code so that it descends all the way to the least dependent package and prepends them as it unwinds. This ensures the ordering will be sorted from most dependent to least dependent package. Ordering of -l flags is corrected by a later sorting, but this fixes ordering on non-l flags. Add a new test specifically for non-l Libs flags. Freedesktop #34504
* check: Test version comparisons within Requires fieldsDan Nicholson2012-10-035-1/+36
| | | | | Verification of versions in Requires and friends happens differently than the version comparison for command-line packages.
* check: Test all variants of --cflags and --libsDan Nicholson2012-10-034-1/+33
| | | | | | 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.
* check: Ensure unknown options failDan Nicholson2012-10-031-0/+5
|
* check: Ensure debugging output works correctlyDan Nicholson2012-10-032-1/+24
| | | | | This might be a little fragile, but it makes sure to exercise the debug_spew function.
* check: Test -uninstalled functionalityDan Nicholson2012-10-034-2/+73
| | | | | | | 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.
* check: Test sysroot supportDan Nicholson2012-10-032-1/+25
| | | | | Checks that pkg-config prepends PKG_CONFIG_SYSROOT_DIR to -I and -L when they don't point to system directories.
* check: Test pkg-config versionDan Nicholson2012-10-023-0/+13
| | | | | Test that --version prints the current version and --atleast-pkgconfig-version validates it.
* check: Enhance --print-requires testsDan Nicholson2012-10-022-6/+6
| | | | | Make the --print-requires and --print-requires-private tests actually resolve Requires and output a specific version test.
* check: Check path handlingDan Nicholson2012-10-023-2/+34
| | | | | | | | | | | 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.
* check: Exercise all printing optionsDan Nicholson2012-09-294-2/+47
| | | | | | | 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.
* check: Test --define-variable corner casesDan Nicholson2012-09-291-0/+9
|
* check: Pass args to test function instead of setting in variableDan Nicholson2012-09-2913-113/+56
| | | | | | | | 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 "$@".
* Specify pkg-config to test with from makeDan Nicholson2012-08-192-2/+3
| | | | | | | | 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
* Handle POSIX shell for tests in configure and MakefileDan Nicholson2012-08-1913-59/+2
| | | | | | | | | | | | | | | | | | | 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.
* Exit on errors for check-missing like othersDan Nicholson2012-08-191-0/+2
| | | | | This ensures that the make shows FAIL in case one test fails and a subsequent one succeeds.
* Enable Requires and Requires.private for --existsDan Nicholson2012-07-111-3/+3
| | | | | | | | | | 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
* Make check-missing test more explicit with --existsDan Nicholson2012-07-111-2/+8
| | | | | | | | | | 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.
* Ensure test search path is confined to check directoryDan Nicholson2012-05-301-2/+3
| | | | | | | 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.
* Makefile cleanupDan Nicholson2012-05-231-10/+26
| | | | No functional change, but makes things a little cleaner.
* Fix test --define-variable invocation to avoid MSYS path manglingLRN2012-05-181-1/+9
| | | | Otherwise tests won't pass when running in MSYS.
* Unify handling of operator and command line option version checkingDan Nicholson2012-05-102-1/+108
| | | | | | | | | | 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
* Allow $() through unescaped.Tollef Fog Heen2011-04-132-2/+2
| | | | | | $(foo) is used for make escapes, so allow them through. Freedesktop #33920
* Add test to exercise broken command option handlingDan Nicholson2010-06-162-1/+35
| | | | | | | | | 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.
* Make sure to distribute the blank fields .pc file tooTollef Fog Heen2010-05-281-1/+2
|
* Add test case for empty fieldsTollef Fog Heen2010-05-273-0/+18
| | | | Make sure we don't run into the bug fixed by 6a27c57 again.
* Fix up test framework to better report errors when pkg-config exits non-zeroTollef Fog Heen2010-05-271-1/+3
|
* Allow : and = unescaped in output tooTollef Fog Heen2010-05-272-4/+4
|
* Distcheck fixespkg-config-0.24Tollef Fog Heen2010-05-231-1/+1
| | | | Various small fixes to make distcheck pass
* Make it possible to escape paths containing special shell charactersTollef Fog Heen2010-05-233-2/+33
| | | | | | | | 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
* Handle -idirafter speciallyTollef Fog Heen2010-05-093-2/+29
| | | | | | Don't split -idirafter from its argument. Fixes Freedesktop #23480
* Fix include path for check/commonTollef Fog Heen2009-06-301-1/+1
|
* 2009-03-30 Tollef Fog Heen <tfheen@err.no>Tollef Fog Heen2009-03-303-4/+20
| | | | | | * check/check-missing, check/check-libs, check/check-requires-private: Handle the case of indirect being enabled correctly in checks.
* 2009-03-30 Tollef Fog Heen <tfheen@err.no>Tollef Fog Heen2009-03-303-0/+8
| | | | | | * 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 Tollef Fog Heen <tfheen@err.no>Tollef Fog Heen2009-03-303-1/+40
| | | | | | * 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 Tollef Fog Heen <tfheen@err.no>Tollef Fog Heen2009-03-303-2/+66
| | | | | | | | * 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 Tollef Fog Heen <tfheen@err.no>Tollef Fog Heen2009-03-301-0/+1
| | | | * check/common: Run all tests in the C locale