Allows tap.sh to show the line number where the helper function was
called on failures.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
tap.sh is a reusable TAP library that handles test counting and provides
useful diagnostic messages on test failures.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This moves most of the parsing work out of the sorting path. The explode
and splitfile functions now call input_new and append input_t structs
to the list of sort candidates instead of raw strings. This lets us
make smarter and easier decisions in the sorting callbacks, which are
now also split into the version and file comparison methods for clarity.
This fixes two bugs:
1) Incorrect ordering with filenames containing epoch in the pkgver
2) Incorrect ordering with package names which are substrings of
each other (e.g. "systemd" and "systemd-sysvcompat").
Performance of the --files mode degrades slightly as a result of this
change, but not unreasonably. Sorting with small inputs (5-10) doubles
in runtime, but larger inputs (4000+) only increase by 20%.
ref: https://bugs.archlinux.org/task/37631
Signed-off-by: Allan McRae <allan@archlinux.org>
Self-executing tests were not being run through the tap log driver.
This caused `make check` to ignore discrepancies between the expected
number of tests and the actual number of tests.
Also, fix some uncommented output from test scripts that could confuse
TAP parsers.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Our test scripts currently require that the first argument be the
library or binary to be tested. This makes integrating them with
automake which doesn't have a mechanism for passing specific arguments
to individual tests. Instead, provide a default built from paths in the
environment which can be provided to all test scripts by automake.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Teach pacsort to understand package filenames and optionally strip away
some of the context. alpm_pkg_vercmp() intentionally only understands
pure versions, so strings such as '18.0-2-x86_64' and '18.0.1-1-x86_64'
will be compared wrongly.
Partially addresses FS#33455.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Make the output into a single block and add separators at the end
so that they do not merge into each other.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Note that this is meant to exercise pacsort more than the underlying
version comparsion; that is better left to the standalone vercmptest.sh
test script.
Signed-off-by: Dan McGee <dan@archlinux.org>