aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2023-01-31Reintegrate test code with library codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-31Move library source into src sub-directoryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-30Remove without-tools feature switchDavid Oberhollenzer
This was originally added for the Windows port, which initially didn't have tool support. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-26libio: add a test case for append_sparse fallback implementationDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-19Split stream compression out of libioDavid Oberhollenzer
Move it to a separate libxfrm library, where it can be independently tested as well. The bulk of the new code is also mainly test cases for the compressors. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-19Implement rudimentary reference counting for sqfs_object_tDavid Oberhollenzer
Implement grab/drop functions to increase/decrease reference count and destroy the object if the count drops to 0. Make sure that all objects that maintain internal references actually grab that reference, duplicate it in the copy function, drop it in the destroy handler. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-29Add dummy hierarchy for fstree_from_dir testDavid Oberhollenzer
Instead of abusing the directory tree of another test case, add a proper dummy hierarchy. This also fixes issues with parallel tests, where another test generates squashfs images in the target path. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-27Continue cleanup of the test casesDavid Oberhollenzer
- Force all tests into their proper sub directory - Temporarily remove the corpora tests. They have been used for regression tests before releases and are disabled by default, so we should not ship them either. A script should be added for that, downloading what is needed. - The "pack a directory" test is also removed. It was rather hacky and there already is a test case for the fstree_from_dir function, which isn't ideal either. Something should be added to the regression test suite. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-27Improve thread pool testDavid Oberhollenzer
Instead of sleeping in the worker thread, busy-loop-wait on a ticket counter to try and serialize the workers in backward order. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-22Move gensquashfs specific code from libfstree to gensquashfsDavid Oberhollenzer
The "from dir" and from "from file" code, as well as the "sort file" code is specific to gensquashfs, so move them there and the test cases as well. The medium term idea is to reduce libfstree to a stub, merge it into the generic writer and ultimately hoist that into libsquashfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-21Fix windows build for get_node_path testDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-18Add a single, central base64 decoderDavid Oberhollenzer
Similar to the hex blob decoder, we need this once for tar and once for the filemap xattr parser. Simply add a single, central implementation to libutil, with a simple unit test, and then use it in both libtar and gensquashfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-18Add a single, central hex blob decoderDavid Oberhollenzer
Since we need it twice (once for tar, once for the filemap xattr parser), add a single, central implementation to libutil, add a unit test for that implementation and then use it in both libtar and gensquashfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-11-16filemap xattr: Add a test caseDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-08-20Overhaul tar compression test script, add to corpora test setDavid Oberhollenzer
- Make the script faster by unpacking everything at once instead of file-by-file - Also compare symlinks and directories - More verbose output Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: Get rid of libfstree "internal.h" headerDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: move source date epoch code back to libutilDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: move filename_sane & canonicalize_path functions to libutilDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Add test case for sqfs_tree_node_get_pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: move test.h to libutilDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: split libtar header, move to sub directoryDavid Oberhollenzer
Some of the on-disk format internals are moved to a separate header and some of the stuff from internal.h is moved to that format header. C++ guards are added in addtion. Everything PAX related is moved to pax_header.c, some internal functions are marked as static. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: rename libfstream to libio, split headersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-07-08Cleanup: move libutil headers to sub directoryDavid Oberhollenzer
Move all the libutil stuff from the toplevel include/ to a util/ sub directory and fix up the includes that make use of them. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-04-10Remove builtin copy of zlibDavid Oberhollenzer
On GNU/Linux, *BSD or MacOS we can simply use the system default library. The copy was primarily only there for the Windows build. The build script for Windows has now been adapted to download and compile a shared library from a tarball. This removes a huge chunk of code from the git tree as well as the release tarballs. Additionally it gets rid of iffy things like removing the Zlib copyright/version strings, so the libsquashfs DLL doesn't export it. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-03-30Cleanup: remove struct stat from libtarDavid Oberhollenzer
The idea was originally to use struct stat in the libfstree code, so we can simply hose data read from a directory into the fstree_t. The struct was then also used with libtar, for simpler interoperation, but it turned out to introduce a lot of platform quirks and causes more trouble than it's worth. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-03-30Fix: unit test and sample program Windows buildDavid Oberhollenzer
Now that there is a wrapper for main() on Windows, all executable programs must use a common, cannonical signature for main(). Furthermore, the Windows version of the epoch test needs wrappers for setenv/unsetenv. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-03-30Add a rudimentary unit test for sort filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-03-30Add a unit test for the SOURCE_DATE_EPOCH logicDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-03-30Cleanup: remove node sorting from libfstreeDavid Oberhollenzer
Always insert the tree nodes in the correct oder and remove the post-process sorting step. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-12-05Fix: unit test and sample program Windows buildDavid Oberhollenzer
Now that there is a wrapper for main() on Windows, all executable programs must use a common, cannonical signature for main(). Furthermore, the Windows version of the epoch test needs wrappers for setenv/unsetenv. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-09-13Fix struct offset testing in ABI test caseDavid Oberhollenzer
The intention of the (severely incomplete) ABI test case is to detect changes to the ABI of libsquashfs. Currently it tries to blurt out if the layout of some structure is changed unintentionally. Unfortunately, the test uses some unportable assumptions. Among other things, it was assumed that a 64 bit field will always require 64 bit alignment. This is apparently no the case on 32 bit x86. This patch makes the check work on 32 bit and 64 bit x86, by adding an additional runtime check that relies on the __alignof__ extension offered by gcc and clang (the only 2 compilers that are really supported at the moment). Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-08-15Fix checksums for the corpora testsDavid Oberhollenzer
Due to the change in directory size accounting, the checksums no longer matched. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-08-14Add a test case for the path traversal bugDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-07-09ABI test: add sizes/layouts of structures likely to be expandedDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-06-25Add a somewhat more extensive tar2sqfs test scriptDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-06-25Remove casual un-const casting in various placesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-06-23Fix: add missing zlib to fstream if using the builtin oneDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-06-04Add a test case for concatenated zstd streamsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-06-04Add test case for Bzip2 stream concatenation, fix XZ test caseDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-05-17Add Automake conditional for zstd stream compression supportDavid Oberhollenzer
In addition to the preprocessor define, use an Automake conditional for optional compilation of the zstd stream tests. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-05-09Add a test case for XZ stream concatenationDavid Oberhollenzer
A modified version of the libfstream XZ stream uncompress test case is added that deliberately chops the compressed data up into two independend XZ streams to test the behaviour where the decompressor has to read across stream boundaries, like those resulting from parallel compression. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-05-09Add a basic de-compressor stream testDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-29Fix build failure if tools are disabledDavid Oberhollenzer
The xattr_benchmark program requires libcommon.a, which isn't built if the tools are not built. Since the intention of the --without-tools switch is to build libsquashfs only, this commit makes the xattr_benchmark build depend on BUILD_TOOLS. Reported-by: Matt Turner <mattst88@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-25libfstree: Allow / as argument for "glob" and "dir" commandsDavid Oberhollenzer
This allows putting globbed files & directories into the filesystem root, as well as explicitly setting attributes of the root directory from the file lisiting. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-24Fix reference of the pack_dir_root testDavid Oberhollenzer
For the test, we pack the license ifle directory. The musl license text got added, so the result changed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-22Cleanup the block processor file structureDavid Oberhollenzer
A cleaner separation between common code, frontend code and backend code is made. The "is this byte blob zero" function is moved out to libutil (with test case and everything) with a more optimized implementation. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-21Add a thread pool implementation to libutilDavid Oberhollenzer
The thread pool enforces ordering of items during dequeue similar to the already existing implementation in libsqfs. The idea is to eventually pull this functionality out of the block processor and turn it into a cleaner, separately tested module. The thread pool is implemented as an abstract interface, so we can have multiple implementations around, including the serial fallback implementation which we can then *always* test, irregardless of the compile config and run through static analysis as well. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-07Rewrite the str_table to internally use the more opimized hash_tableDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-07Add a simple benchmark program for the xattr key/value recorderDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-03-06Fix wrong byte-swap macro in libsqfs table testDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>