1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00
Commit graph

185 commits

Author SHA1 Message Date
Jia Tan
3f51a4415a Tests: Silence -Wsign-conversion warning on GCC version < 10.
Since GCC version 10, GCC no longer complains about simple implicit
integer conversions with Arithmetic operators.

For instance:

    uint8_t a = 5;
    uint32_t b = a + 5;

Give a warning on GCC 9 and earlier but this:

    uint8_t a = 5;
    uint32_t b = (a + 5) * 2;

Gives a warning with GCC 10+.
2023-12-22 20:02:06 +08:00
Kian-Meng Ang
b26d5d547f Tests: Fix typos 2023-12-22 20:02:06 +08:00
Jia Tan
9b469da8f3 Tests: Fix typo in a comment. 2023-12-22 20:02:06 +08:00
Jia Tan
afcb30fcad Tests: Create test_suffix.sh.
This tests some complicated interactions with the --suffix= option.
The suffix option must be used with --format=raw, but can optionally
be used to override the default .xz suffix.

This test also verifies some recent bugs have been correctly solved
and to hopefully avoid further regressions in the future.
2023-12-22 20:02:06 +08:00
Jia Tan
edec253e41 Build: Remove Gnulib dependency from tests.
The tests do not use any Gnulib replacements so they do not need to link
libgnu.a or have /lib in the include path.
2023-10-31 18:44:59 +08:00
Jia Tan
cf8ba7c3a8 Tests: Improve invalid unpadded size check in test_lzma_index_append().
This check was extended to test the code added to fix a failing assert
in 68bda971bb.
2023-10-31 01:02:59 +08:00
Jia Tan
4a4180ce74 Tests: Improve comments in test_index.c. 2023-10-26 06:22:24 +08:00
Jia Tan
d93fbefcc4 Tests: Style fixes to test_lzip_decoder.c. 2023-10-26 06:22:24 +08:00
Dimitri Papadopoulos Orfanos
0db6fbe0be Docs: Fix typos found by codespell 2023-08-01 18:44:02 +03:00
Jia Tan
ef7fbe8393 Tests: Skip .lz files in test_files.sh if not configured.
Previously if the lzip decoder was not configured then test_files.sh
would pass the lzip tests instead of skipping them.
2023-08-01 18:41:42 +03:00
Jia Tan
e49815ba7a Tests: Add ARM64 filter test to test_compress.sh. 2023-08-01 18:41:23 +03:00
Jia Tan
6e21f1b4e2 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-18 13:26:48 +03:00
Jia Tan
c44c7e7590 Tests: Fix memory leaks in test_index.
Several tests were missing calls to lzma_index_end() to clean up the
lzma_index structs. The memory leaks were discovered by using
-fsanitize=address with GCC.
2023-07-18 13:26:48 +03:00
Jia Tan
b9499c94fc Tests: Fix memory leaks in test_block_header.
test_block_header was not properly freeing the filter options between
calls to lzma_block_header_decode(). The memory leaks were discovered by
using -fsanitize=address with GCC.
2023-07-18 13:26:48 +03:00
Jia Tan
1c558a2692 Tests: Remove unused macros and functions. 2023-03-13 20:53:26 +08:00
Jia Tan
7479a69a45 Tests: Refactors existing lzma_index tests.
Converts the existing lzma_index tests into tuktests and covers every
API function from index.h except for lzma_file_info_decoder, which can
be tested in the future.
2023-03-13 20:53:12 +08:00
Jia Tan
88101143cb Tests: Small tweak to test-vli.c.
The static global variables can be disabled if encoders and decoders
are not built. If they are not disabled and -Werror is used, it will
cause an usused warning as an error.
2023-03-07 23:24:56 +08:00
Jia Tan
85e01266a9 Tests: Create test_filter_str.c.
Tests lzma_str_to_filters(), lzma_str_from_filters(), and
lzma_str_list_filters() API functions.
2023-02-03 21:42:48 +08:00
Lasse Collin
c47ecd6d39 Tests: Fix warnings from clang --Wassign-enum.
Explicitly casting the integer to lzma_check silences the warning.
Since such an invalid value is needed in multiple tests, a constant
INVALID_LZMA_CHECK_ID was added to tests.h.

The use of 0x1000 for lzma_block.check wasn't optimal as if
the underlying type is a char then 0x1000 will be truncated to 0.
However, in these test cases the value is ignored, thus even with
such truncation the test would have passed.
2023-02-03 21:10:06 +08:00
Lasse Collin
34e13ce015 Tests: Silence warnings from -Wsign-conversion.
Note that assigning an unsigned int to lzma_check doesn't warn
on GNU/Linux x86-64 since the enum type is unsigned on that
platform. The enum can be signed on some other platform though
so it's best to use enumeration type lzma_check in these situations.
2023-02-03 21:10:01 +08:00
Lasse Collin
977dd2e26b Tests: test_lzip_decoder: Remove trailing white-space. 2023-02-03 21:09:12 +08:00
Lasse Collin
c55157ed74 Tests: test_lzip_decoder: Silence warnings from -Wsign-conversion. 2023-02-03 21:07:57 +08:00
Jia Tan
e3b42bfcb0 Tests: Fix test_filter_flags copy/paste error. 2023-01-11 17:31:54 +02:00
Jia Tan
21625b7e11 Tests: Fix type-limits warning in test_filter_flags.
This only occurs in test_filter_flags when the BCJ filters are not
configured and built. In this case, ARRAY_SIZE() returns 0 and causes a
type-limits warning with the loop variable since an unsigned number will
always be >= 0.
2023-01-11 17:31:54 +02:00
Jia Tan
b7fb438ea0 Tests: Fix unused function warning in test_block_header.
One of the global arrays of filters was only used in a test that
required both encoders and decoders to be configured in the build.
2023-01-11 17:31:54 +02:00
Jia Tan
68e9ef036d Tests: Fix unused function warning in test_index_hash.
test_index_hash does not use fill_index_hash() unless both encoders
and decoders are configured in the build.
2023-01-11 17:31:54 +02:00
Lasse Collin
43521e77ac Tests: test_filter_flags: Clean up minor issues.
Here are the list of the most significant issues addressed:
- Avoid using internal common.h header. It's not good to copy the
constants like this but common.h cannot be included for use outside
of liblzma. This is the quickest thing to do that could be fixed later.

- Omit the INIT_FILTER macro. Initialization should be done with just
regular designated initializers.

- Use start_offset = 257 for BCJ tests. It demonstrates that Filter
Flags encoder and decoder don't validate the options thoroughly.
257 is valid only for the x86 filter. This is a bit silly but
not a significant problem in practice because the encoder and
decoder initialization functions will catch bad alignment still.
Perhaps this should be fixed but it's not urgent and doesn't need
to be in 5.4.x.

- Various tweaks to comments such as filter id -> Filter ID
2023-01-09 16:58:27 +02:00
Jia Tan
6b44cead95 Tests: Refactors existing filter flags tests.
Converts the existing filter flags tests into tuktests.
2023-01-09 16:58:27 +02:00
Lasse Collin
1bbefa9659 Tests: tuktest.h: Support tuktest_malloc(0).
It's not needed in XZ Utils at least for now. It's good to support
it still because if such use is needed later, it wouldn't be
caught on GNU/Linux since malloc(0) from glibc returns non-NULL.
2023-01-09 16:58:27 +02:00
Jia Tan
bad44cfe19 Tests: Creates test_index_hash.c
Tests all API functions exported from index_hash.h. Does not have a
dedicated test for lzma_index_hash_end.

[Minor edits were made by Lasse Collin.]
2023-01-09 16:56:07 +02:00
Lasse Collin
34a9c2d650 Tests: Adjust style in test_compress.sh. 2023-01-04 23:17:09 +02:00
Jia Tan
761c208d58 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-05 00:30:22 +08:00
Lasse Collin
ab5229d32a Tests: test_check: Test corner cases of CLMUL CRC64. 2023-01-05 00:28:09 +08:00
Lasse Collin
8791826f31 Tests: Clarify a comment in test_lzip_decoder.c. 2023-01-05 00:28:01 +08:00
Jia Tan
b14b8dbba9 Tests: Adds lzip decoder tests 2022-12-28 01:20:16 +08:00
Lasse Collin
177ece1c8e Tests: Fix a typo in tests/files/README. 2022-12-13 12:30:45 +02:00
Lasse Collin
60f45bdbaa Tests: Add two ARM64 test files. 2022-12-13 12:30:09 +02:00
Lasse Collin
c8ef089c14 Tests: Test the .lz files in test_files.sh. 2022-11-09 14:32:33 +02:00
Lasse Collin
c8f70ebb46 Tests: Add .lz (lzip) test files. 2022-11-09 14:31:21 +02:00
Lasse Collin
05c72de06f Tests: test_files.sh: Make it not fail if features were disabled at build.
It now tries to test as many files as easily possible.
The exit status indicates skipping if any of the files were
skipped. This way it is easy to notice if something is being
skipped when it isn't expected.
2022-10-27 15:49:18 +03:00
Lasse Collin
b3459327a5 Tests: test_files.sh: Suppress an expected warning from the log.
xz (but not xzdec) will normally warn about unsupported check
but since we are testing specifically such a file, it's better
to silence that warning so that it doesn't look suspicious in
test_files.sh.log.

The use of -q and -Q in xzdec is just for consistency and
doesn't affect the result at least for now.
2022-10-27 15:30:13 +03:00
Lasse Collin
798c86e423 Tests: test_files.sh: Print the reason for skipping if xz & xzdec missing. 2022-10-27 15:27:50 +03:00
Lasse Collin
c1dd8524e1 Tests: Keep test_compress_* working when some filters are unavailable. 2022-10-27 01:12:40 +03:00
Jia Tan
ce30ada919 Tests: test_bcj_exact_size skips properly now if PowerPC filter disabled. 2022-10-26 20:12:01 +03:00
Lasse Collin
89c5cfcaca Tests: Test also unsupported-*.xz. 2022-10-26 00:05:57 +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
82fcb7cfc1 Tests: Fix a warning in test_memlimit.c when decoders are disabled. 2022-10-19 17:14:57 +03:00
Jia Tan
6a86e81cab Tests: Refactor test_stream_flags.c.
Converts test_stream_flags to tuktest. Also the test will now
compile and skip properly if encoders or decoders are disabled.

Thanks to Sebastian Andrzej Siewior.
2022-10-06 22:06:17 +03:00
Jia Tan
827ac5b482 Tests: Refactor test_block_header.c.
test_block_header now achieves higher test coverage. Also the
test will now compile and skip properly if encoders or decoders
are disabled.

Thanks to Sebastian Andrzej Siewior.
2022-10-06 21:51:48 +03:00