2
Fork 0
mirror of https://sourceware.org/git/bzip2-tests.git synced 2026-06-10 13:59:27 +00:00
No description
Find a file
Mark Wielaard fbe320e54b Test bzip2recover works on valid .bz2 and doesn't crash on bad files
Run bzip2recover on all good .bz2 files (except empty.bz2). For all
bad files check that bzip2recover exits normally and doesn't crash.
2026-06-04 03:08:41 +02:00
commons-compress Initial bzip2 test suite. 2019-06-30 23:48:53 +02:00
dotnetzip Initial bzip2 test suite. 2019-06-30 23:48:53 +02:00
go Initial bzip2 test suite. 2019-06-30 23:48:53 +02:00
lbzip2 Initial bzip2 test suite. 2019-06-30 23:48:53 +02:00
pyflate Initial bzip2 test suite. 2019-06-30 23:48:53 +02:00
README Test bzip2recover works on valid .bz2 and doesn't crash on bad files 2026-06-04 03:08:41 +02:00
run-tests.sh Test bzip2recover works on valid .bz2 and doesn't crash on bad files 2026-06-04 03:08:41 +02:00

= BZ2 test file collection =

This is a collection of "interesting" .bz2 files that can be used to
test bzip2 works correctly. They come from different projects.

Each directory should contain a README file explaining where the .bz2
files originally came from. Plus a reference to the (Free Software)
license that the project files were distributed under.

Some files are deliberately bad, and are use to see how bzip2 handles
corrupt files. They are explicitly not intended to decompress correctly,
but to catch errors in bzip2 trying to deal with deliberately bad data.
All such files have a name ending in .bz2.bad.

All non-bad files end in bz2. And should come with a .md5 file for
the original input file. The .md5 file is used to check that bzip2
could correctly decompress the file. The original (non-compressed)
files are deliberately not checked in.

A .md5 sum is generated by:
  md5sum < file > file.md5

This generates a .md5 file that doesn't carry a file name (but just "-").
They can then be checked again with:
  md5sum --check file.md5 < file

Note do NOT name a file ending in .testfilecopy or .testfilecopy.bz2.
Also do NOT name a file starting with rec0[0-9]+ and ending in .bz2,
as created by the bzip2recover utility.
Those will automatically be cleaned by up the testframework.

There is a simple bash script to run the tests:

run-tests [--bzip2=bzip2-command] [--without-valgrind]
          [--ignore-md5] [--tests-dir=/path/to/bzip2-tests-dir]

It will by default test with the command 'bzip2', running under
valgrind (if installed on the system), checking md5 sum files
after decompression using the current directory (".") to find
any .bz2 or .bz2.bad files (and .md5 files if checked).

For each .bz2 file found it is decompressed, recompressed and
decompressed again. Once with the default bzip2 settings and
once in --small (-s) mode.

For each .bz2.bad file decompression is tried twice also. In
default mode and small mode. The bzip2 binary is expected to
return either 1 or 2 as exit status. Any other exit code is
interpreted as failure.

The bzip2recover utility is run on all .bz2 files to check the
blocks can be recovered. For all .bz2.bad files bzip2recover
should try to recover any blocks and should exit gracefully.

If you just want to check a directory (and any subdirectories)
full of (known good) .bz2 files you can invoke the script as:

  ./run-test --ignore-md5 --tests-dir=/dir/full/off/bz2/files