Commit Graph

30 Commits

Author SHA1 Message Date
Lasse Collin 56f1d5ed68 Tests: Make the config.h grep patterns Meson compatible
Now the test scripts detect both

    #define HAVE_DECODER_ARM
    #define HAVE_DECODER_ARM 1

as support for the ARM filter without confusing it with these:

    #define HAVE_DECODER_ARM64
    #define HAVE_DECODER_ARM64 1

Previously only the ones ending with " 1" were accepted for
the macros where this kind of confusion was possible.

This should help with Meson support because Meson's built-in
features produce config.h entries that are either

    #define FOO 1
    #define FOO 0

or:

    #define FOO
    #undef FOO

The former method has a benefit that one can use "#if FOO" and -Wundef
will catch if a #define is missing (for example, it helps catching
typos). But XZ Utils has to use the latter since it has been
convenient with Autoconf's default behavior.[*] While it's easy to
emulate the Autoconf style (#define FOO 1 vs. no #define at all)
in Meson, it results in clumsy code. Thus it's better to change
the few places in the tests where this difference matters.

[*] While most checks in Autoconf default to the second style above,
    a few things use the first style (like AC_CHECK_DECLS). The mix
    of both styles is the most confusing as one has to remember which
    macro needs #ifdef and which #if. Currently HAVE_VISIBILITY is
    only such config.h entry that is 1 or 0. It comes unmodified
    from Gnulib's visibility.m4.
2024-05-20 16:55:00 +03:00
Lasse Collin ac3222d2cb Tests: Make test_compress.sh more flexible
Add a new optional second argument: directory of the xz and xzdec
executables. This is need with the CMake build where the binaries
end up in the top-level build directory.

If ../config.h doesn't exist, assume that all encoders and decoders
are available. This will make this script usable from CMake in the
most common build configuration.

NOTE: Since the existence of ../config.h is checked, the working
directory of the test script must be a subdir in the build tree!
Otherwise ../config.h would look outside the build tree.

Use the default check type instead of forcing CRC32 or CRC64.
Now the script doesn't need to check if CRC64 is available.
2024-05-20 16:55:00 +03:00
Lasse Collin 22af94128b Add SPDX license identifier into 0BSD source code files. 2024-02-14 18:31:16 +02:00
Lasse Collin 689e0228ba Change most public domain parts to 0BSD.
Translations and doc/xz-file-format.txt and doc/lzma-file-format.txt
were not touched.

COPYING.0BSD was added.
2024-02-14 18:31:12 +02:00
Jia Tan ac3691ccca Tests: Add RISC-V Filter test in test_compress.sh. 2024-01-23 23:05:47 +08:00
Jia Tan 194d12724b Tests: Add ARM64 filter test to test_compress.sh. 2023-07-20 22:11:13 +08:00
Jia Tan a6583726e5 Tests: Use new --filters option in test_compress.sh 2023-07-17 23:34:55 +08:00
Jia Tan 2c189bb00a Tests: Improve feature testing for skipping.
Fixed a bug where test_compress_* would all fail if arm64 or armthumb
filters were enabled for compression but arm was disabled. Since the
grep tests only checked for "define HAVE_ENCODER_ARM", this would match
on HAVE_ENCODER_ARM64 or HAVE_ENCODER_ARMTHUMB.

Now the config.h feature test requires " 1" at the end to prevent the
prefix problem. have_feature() was also updated for this even though
there were known current bugs affecting it. This is just in case future
features have a similar prefix problem.
2023-07-14 21:30:25 +08:00
Lasse Collin aafd67fba0 Tests: Adjust style in test_compress.sh. 2023-01-04 18:40:28 +02:00
Jia Tan 52380678f4
Tests: Replace non portable shell parameter expansion
The shell parameter expansion using # and ## is not supported in
Solaris 10 Bourne shell (/bin/sh). Even though this is POSIX, it is not fully
portable, so we should avoid it.
2023-01-04 23:58:58 +08:00
Lasse Collin c1dd8524e1 Tests: Keep test_compress_* working when some filters are unavailable. 2022-10-27 01:12:40 +03:00
Lasse Collin 424ac91c7e Tests: Skip tests in test_*.sh if encoders and/or decoders are disabled.
This isn't perfect as the scripts can still fail if only
certain filters are disabled. This is still an improvement
as now "make check" has better behavior when all encoders
or decoders are disabled.

Grepping ../config.h is simple and fairly clean but it only
works if config.h was created. CMake builds don't create
config.h but they don't use these test scripts either.

Thanks to Sebastian Andrzej Siewior for reporting the problem.
Thanks to Jia Tan for the original patch which grepped xz
error messages instead of config.h.
2022-10-19 19:39:35 +03:00
Lasse Collin ca8bf9d7c5 Test: Remove the (exit 1) lines.
I suspect that I used these in the original version because
Autoconf's manual describes that such a trick is needed in
some specific situations for portability reasons. None of those
situations listed on Autoconf 2.71 manual apply to these test
scripts though so this cleans them up.
2022-10-19 19:03:50 +03:00
Lasse Collin 9a6dd6d46f Tests: Split test_compress.sh into separate test unit for each file.
test_compress.sh now takes one command line argument:
a filename to be tested. If it begins with "compress_generated_"
the file will be created with create_compress_files.

This will allow parallel execution of the slow tests.
2022-05-23 21:31:20 +03:00
Lasse Collin 4a8e4a7b0a Tests: Remove unneeded commented lines from test_compress.sh. 2022-05-23 20:17:42 +03:00
Lasse Collin 2ee50d150e Tests: Remove progress indicator from test_compress.sh.
It will be useless with Automake's parallel tests.
2022-05-23 20:16:00 +03:00
Lasse Collin 11f51b6714 Make tests accommodate missing xz or xzdec. 2010-10-08 15:32:29 +03:00
Jonathan Nieder 373ee26f95 Adjust memory limits in test_compress.sh
Testing compression at level -4 now requires 48 MiB of free store at
compression time and 5 MiB at decompression time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2010-09-04 00:56:14 +03:00
Lasse Collin d5653ba8a1 Fix test_compress.sh.
It broke when --memory option was removed from xzdec.

Thanks to Jonathan Nieder.
2010-08-10 11:04:30 +03:00
Lasse Collin 02ddf09bc3 Put the interesting parts of XZ Utils into the public domain.
Some minor documentation cleanups were made at the same time.
2009-04-13 11:27:40 +03:00
Jim Meyering 850f740042 remove trailing blanks from all but .xz files 2009-01-26 20:01:51 +02:00
Lasse Collin 061748f593 Disable Subblock filter from test_compress.sh since it is
disabled by default in configure.ac.
2008-12-31 18:59:02 +02:00
Lasse Collin 5cda29b566 Use 28 MiB as memory usage limit for encoding in test_compress.sh. 2008-12-27 19:40:31 +02:00
Lasse Collin 1880a3927b Renamed lzma to xz and lzmadec to xzdec. We create symlinks
lzma, unlzma, and lzcat in "make install" for backwards
compatibility with LZMA Utils 4.32.x; I'm not sure if this
should be the default though.
2008-11-19 23:52:24 +02:00
Lasse Collin bd137524f2 Initial changes to change the suffix of the new format to .xz.
This also fixes a bug related to --suffix option. Some issues
with suffixes with --format=raw were not fixed.
2008-10-02 22:51:46 +03:00
Lasse Collin 018ae09df8 Fix also test_compress.sh. 2008-09-27 23:13:54 +03:00
Lasse Collin 1dcecfb09b Some API changes, bug fixes, cleanups etc. 2008-09-27 19:09:21 +03:00
Lasse Collin 3b34851de1 Sort of garbage collection commit. :-| Many things are still
broken. API has changed a lot and it will still change a
little more here and there. The command line tool doesn't
have all the required changes to reflect the API changes, so
it's easy to get "internal error" or trigger assertions.
2008-08-28 22:53:15 +03:00
Lasse Collin 7d17818cec Update the code to mostly match the new simpler file format
specification. Simplify things by removing most of the
support for known uncompressed size in most places.
There are some miscellaneous changes here and there too.

The API of liblzma has got many changes and still some
more will be done soon. While most of the code has been
updated, some things are not fixed (the command line tool
will choke with invalid filter chain, if nothing else).

Subblock filter is somewhat broken for now. It will be
updated once the encoded format of the Subblock filter
has been decided.
2008-06-18 18:02:10 +03:00
Lasse Collin c9cba97691 Added test_compress.sh and bunch of files needed by it.
This new set of tests compress and decompress several
test files with many different compression options.
This set of tests will be extended later.
2008-01-18 00:50:29 +02:00