Lasse Collin
7dcabeec63
Tests: Include mythread.h in the tests that use MYTHREAD_ENABLED.
2022-10-05 16:20:47 +03:00
Jia Tan
6ca5c354bd
Tests: Fix compilation error when threading support has been disabled.
...
Now tests that require threading are skipped when threading
support has been disabled.
Thanks to Sebastian Andrzej Siewior.
2022-10-05 16:10:21 +03:00
Jia Tan
afd5a8bf53
Tests: Create a test for the lzma_index_cat bug.
2022-09-28 15:34:23 +03:00
Lasse Collin
5a4d3548ab
Tests: Add test_memlimit.c to test restarting after LZMA_MEMLIMIT_ERROR.
2022-09-28 11:12:07 +03:00
Lasse Collin
c3592d0a55
Tests: Add a test file for lzma_index_append() integer overflow bug.
...
This test fails before commit 18d7facd38
.
test_files.sh now runs xz -l for bad-3-index-uncomp-overflow.xz
because only then the previously-buggy code path gets tested.
Normal decompression doesn't use lzma_index_append() at all.
Instead, lzma_index_hash functions are used and those already
did the overflow check.
2022-09-16 17:08:53 +03:00
Lasse Collin
f2d084fe3f
Tests: Silence warnings about unused functions from tuktest.h.
...
Warnings about unused tuktest_run_test conveniently tell which
test programs haven't been converted to tuktest.h yet but I
silenced that warning too for now anyway.
It is fine to use __attribute__((__unused__)) even when the
function is actually used because the attribute only means
that the function might be unused.
2022-09-09 14:12:30 +03:00
Lasse Collin
2d2201bc63
Tests: Add the .lzma files to test_files.sh.
2022-07-14 20:33:05 +03:00
Lasse Collin
ce5549a591
Tests: Add .lzma test files.
2022-07-14 19:37:42 +03:00
Jia Tan
d1bfa3dc70
Created script to generate code coverage reports.
...
The script uses lcov and genhtml after running the tests
to show the code coverage statistics. The script will create
a coverage directory where it is run. It can be run both in
and out of the source directory.
2022-07-10 22:42:22 +03:00
Jia Tan
86a30b0255
Tests: Add more tests into test_check.
2022-06-16 17:39:59 +03:00
Lasse Collin
82e30fed66
Tests: Use char[][24] array for enum_strings_lzma_ret.
...
Array of pointers to short strings is a bit pointless here
and now it's fully const.
2022-06-16 15:02:57 +03:00
Lasse Collin
5ba9459e6c
Tests: tuktest.h: Add tuktest_error_impl to help with error conditions.
2022-06-16 14:12:14 +03:00
Lasse Collin
b339892668
Tests: tuktest.h: Rename file_from_* and use tuktest_malloc there.
2022-06-16 13:29:59 +03:00
Lasse Collin
d8b63a0ad6
Tests: tuktest.h: Add malloc wrapper with automatic freeing.
2022-06-16 13:08:19 +03:00
Lasse Collin
1d51536a4b
Tests: tuktest.h: Move a function.
2022-06-16 11:47:37 +03:00
Lasse Collin
70c7555f64
Tests: test_vli: Remove an invalid test-assertion.
...
lzma_vli is unsigned so trying a signed value results in
a compiler warning from -Wsign-conversion. (lzma_vli)-1
equals to LZMA_VLI_UNKNOWN anyway which is the next assertion.
2022-06-14 22:21:15 +03:00
Lasse Collin
154b73c5a1
Tests: test_vli: Add const where appropriate.
2022-06-14 22:17:01 +03:00
Jia Tan
a08f5ccf6b
Created tests for all functions exported in vli.h
...
Achieved 100% code coverage vli_encoder.c, vli_decoder.c, and vli_size.c
2022-06-14 22:00:34 +03:00
Lasse Collin
00e3613f12
Tests: Use good-1-empty-bcj-lzma2.xz in test_bcj_exact_size.
...
It's much nicer this way so that the test data isn't a hardcoded
table inside the C file.
2022-06-14 21:29:21 +03:00
Lasse Collin
86bab755be
Tests: Add file reading helpers to tuktest.h.
2022-06-14 21:26:13 +03:00
Lasse Collin
83d2337b72
Tests: tuktest.h: Move a printf from a macro to a helper function.
2022-06-14 18:21:57 +03:00
Lasse Collin
f9e8176ea7
Tests: Add test file good-1-empty-bcj-lzma2.xz.
...
This is from test_bcj_exact_size.c.
It's good to have it as a standalone file.
2022-06-14 17:20:49 +03:00
Jia Tan
aa75c5563a
Tests: Created tests for hardware functions.
...
Created tests for all API functions exported in
src/liblzma/api/lzma/hardware.h. The tests are fairly trivial
but are helpful because they will inform users if their machines
cannot support these functions. They also improve the code
coverage metrics.
2022-06-10 16:58:47 +03:00
Lasse Collin
5c8ffdca20
Tests: Convert test_check to tuktest.
...
Thanks to Jia Tan for help with all the tests.
2022-06-02 21:06:58 +03:00
Lasse Collin
faf5ff8899
Tests: Convert test_block_header to tuktest.
2022-06-02 20:45:05 +03:00
Lasse Collin
754d39fbeb
Tests: Convert test_bcj_exact_size to tuktest.
...
The compress() and decompress() functions were merged because
the later depends on the former so they need to be a single
test case.
2022-06-02 20:28:23 +03:00
Lasse Collin
96da21470f
Tests: Include tuktest.h in tests.h.
...
This breaks -Werror because none of the tests so far use
tuktest.h and thus there are warnings about unused variables
and functions.
2022-06-02 20:27:00 +03:00
Lasse Collin
df71ba1c99
Tests: Add tuktest.h mini-test-framework.
2022-06-02 20:25:21 +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
c7758ac9c7
Test: Make create_compress_files.c a little more flexible.
...
If a command line argument is given, then only the test file
of that type is created. It's quite dumb in sense that unknown
names don't give an error but it's good enough here.
Also use EXIT_FAILURE instead of 1 as exit status for errors.
2022-05-23 20:59:47 +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
555de11873
Tests: Add bad-1-lzma2-11.xz.
2022-02-20 19:38:55 +02:00
Lasse Collin
bb1d5c1fdd
Tests: Add bad-1-lzma2-10.xz and also modify -9.xz.
2021-01-24 22:32:41 +02:00
Lasse Collin
939fc5ed65
Tests: Add bad-1-lzma2-9.xz.
2021-01-24 18:51:51 +02:00
Lasse Collin
fdd30032f8
Tests: Add bad-1-check-crc32-2.xz.
2021-01-24 17:04:51 +02:00
Lasse Collin
cf2df0f05a
Use $(LIB_FUZZING_ENGINE) in tests/ossfuzz/Makefile.
...
https://github.com/google/oss-fuzz/pull/3219#issuecomment-573751048
Thanks to Bhargava Shastry for sending the patch.
2020-01-19 21:54:33 +02:00
Lasse Collin
7136f1735c
Rename unaligned_read32ne to read32ne, and similarly for the others.
2019-12-31 00:47:49 +02:00
Lasse Collin
8b72950a6b
Tests: Hopefully fix test_check.c to work on EBCDIC systems.
...
Thanks to Daniel Richard G.
2019-12-29 22:51:58 +02:00
Lasse Collin
e873902641
Tests: Silence warnings from clang -Wassign-enum.
...
Also changed 999 to 99 so it fits even if lzma_check happened
to be 8 bits wide.
2019-06-25 00:08:13 +03:00
Lasse Collin
c2d2ab6a9d
Tests: Silence a warning from -Wsign-conversion.
2019-06-24 20:53:55 +03:00
Lasse Collin
dfda7cf6af
Tests: Remove a duplicate branch from tests/tests.h.
...
The duplication was introduced about eleven years ago and
should have been cleaned up back then already.
This was caught by -Wduplicated-branches.
2019-06-24 00:57:23 +03:00
Lasse Collin
106d1a663d
Tests: Add a fuzz test program and a config file for OSS-Fuzz.
...
Thanks to Bhargava Shastry and Github user pdknsk.
2018-11-02 20:40:14 +02:00
Lasse Collin
372e402713
Tests: Add tests for the two bugs fixed in index.c.
2015-10-12 21:07:41 +03:00
Lasse Collin
c7f4041f6b
Tests: Fix a memory leak in test_bcj_exact_size.
...
Thanks to Cristian Rodríguez.
2015-05-13 20:57:55 +03:00
Lasse Collin
d2d484647d
Tests: Don't hide unexpected error messages in test_files.sh.
...
Hiding them makes no sense since normally there's no error
when testing the "good" files. With "bad" files errors are
expected and then it makes sense to keep the messages hidden.
2015-01-06 20:30:15 +02:00
Lasse Collin
381ac14ed7
xzgrep: List xzgrep_expected_output in tests/Makefile.am.
2014-06-13 19:21:54 +03:00
Lasse Collin
4244b65b06
xzgrep: Improve the test script.
...
Now it should be close to the functionality of the original
version by Pavel Raiskup.
2014-06-13 18:58:22 +03:00
Lasse Collin
1e60f2c0a0
xzgrep: Add a test for the previous fix.
...
This is a simplified version of Pavel Raiskup's
original patch.
2014-06-11 21:03:25 +03:00
Lasse Collin
d625c7cf82
Tests: Remove tests/test_block.c that had gotten committed accidentally.
2012-07-05 07:36:28 +03:00