summaryrefslogtreecommitdiff
path: root/test_utils
Commit message (Collapse)AuthorAgeFilesLines
* replace time64 functions with normal ones (#1830)Rosen Penev2023-01-091-3/+3
| | | | | | | | | Otherwise there are 32/64-bit pointer conversions going on. In Windows since MSVC2005, time_t has been 64-bit. MinGW needs a hack to get 64-bit time_t. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Rosen Penev <rosenp@gmail.com>
* further cleanup _localtime64_s (#1824)Rosen Penev2022-12-281-10/+1
| | | | | | | These were missing from 2d329073435d36065ce30bfd29428f6a45e41016 Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Rosen Penev <rosenp@gmail.com>
* cleanup _localtime64_s (#1820)Rosen Penev2022-12-201-7/+7
| | | Signed-off-by: Rosen Penev <rosenp@gmail.com>
* test_main.c: omit always-true comparsionMartin Matuska2022-12-081-8/+6
| | | | | Reported by: CodeQL Code Scanning Alert: 127
* tests: silence localtime() CodeQL warningsMartin Matuska2022-12-081-2/+21
| | | | Use localtime_r() or _localtime64_s() if available
* tests: silence more CodeQL warnings in test_utils/test_main.cMartin Matuska2022-12-081-4/+6
| | | | Catch one more uncatched strcpy() and strcat()
* tests: silence some CodeQL warnings in test_utils/test_main.cMartin Matuska2022-12-071-8/+18
| | | | | Use fchmod() instead of chmod() if available Use strncpy() and strncat() instead of strcpy() and strcat()
* Fixed issue #1743: Changed sprintf to safer snprintfSean McBride2022-06-221-7/+7
| | | | | | Also changed a few vsprintf to vsnprintf. Most cases were trivial, one private function was changed to take the buffer length, one case required some fancy arithmetic.
* tests: fix style in test_utils/test_main.cMartin Matuska2022-02-081-3/+3
|
* Reorganize test code a bitTim Kientzle2022-02-014-105/+105
| | | | | | | | | | | | | | | | | | A few guiding principles: * Each test source file includes ONLY "test.h" to make it easy to create new tests. * Each test suite has a "test.h" that includes "test_util/test_common.h" to get access to all the common testing utility functions. So "test_common.h" is then responsible for including any smaller headers that declare specific pieces of shared test functionality. I've also pulled some test filtering logic that was _only_ used in test_main.c into that file, and repurposed "test_utils.[ch]" for common utility code. (Eventually, a lot of the assertion helpers currently in "test_main.c" should probably be organized into one or more source files of their own.)
* Avoid millions of rand() calls() when running testsAlex Richardson2022-01-152-0/+86
| | | | | | | | | | | | | | | Many tests use a loop calling rand() to fill buffers with test data. As these calls cannot be inlined, this adds up to noticeable overhead: For example, running on QEMU RISC-V the test_write_format_7zip_large_copy test took ~22 seconds before and with this change it's ~17 seconds. This change uses a simpler xorshift64 random number generator that can be inlined into the loop filling the data buffer. By default the seed for this RNG is rand(), but it can be overwritten by setting the TEST_RANDOM_SEED environment variable. For a native build the difference is much less noticeable, but it's still measurable: test_write_format_7zip_large_copy takes 314.9 ms ± 3.9 ms before and 227.8 ms ± 5.8 ms after (i.e. 38% faster for that test).
* added missing checks for canLzip, canLzma, and canXzjiat752021-10-041-1/+1
|
* Avoid getcwd(0, PATH_MAX) for GNU libcOwen W. Taylor2021-05-121-2/+2
| | | | | | | | | | | | Recent versions of GNU libc and GCC produce a warning on getcwd(0, PATH_MAX): test_main.c: In function ‘get_refdir’: test_main.c:3684:8: error: argument 1 is null but the corresponding size argument 2 value is 4096 [-Werror=nonnull] 3684 | pwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */ This is because getcwd() is marked with the 'write_only (1, 2)' attribute. Using the alternate getcwd(NULL, 0) path which is supported by GNU libc avoids this.
* tests: add new assertion for chmod()Luis Henriques2020-09-252-0/+17
|
* tests: mark failed_filename and tests static to fix WARNS=6 buildKyle Evans2020-09-081-2/+2
| | | | | Observed on FreeBSD with a higher WARNS level on bsdcat/tests, these two variables should be private to test_main.c in order to appease the build.
* Add printf attributes to the printflike functions used in tests and fixzoulasc2020-01-232-15/+28
| | | | | | the format errors. Closes #1318
* - Add the NetBSD-specific config.hzoulasc2020-01-162-10/+13
| | | | | - Use --help instead of -V when -V exits with non-zero code - Double the string size to prevent truncation
* Unify header style, header guard comes firstMartin Matuska2020-01-131-0/+4
| | | | Found by LGTM.com code analysis
* Fix possible off-by-one when dealing with readlink(2)Pawel Jakub Dawidek2019-12-291-1/+1
| | | | readlink(2) and readlinkat(2) don't append a null byte to the given buffer.
* Correct some typographical and grammatical errors.Peter Pentchev2019-09-211-1/+1
|
* Windows symlinks: new functions and extended tar headerMartin Matuska2019-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | New functions: archive_entry_symlink_type() archive_entry_set_symlink_type() Suppoted value constants: AE_SYMLINK_TYPE_UNDEFINED AE_SYMLINK_TYPE_FILE AE_SYMLINK_TYPE_DIRECTORY New extended tar header: LIBARCHIVE.symlinktype The function archive_entry_symlink_type() retrieves and the function archive_entry_set_symlink_type() sets the symbolic link type of an archive entry. The information about the symbolic link type is required to properly restore symbolic links on Microsoft Windows. If the symlink type is set to AE_SYMLINK_TYPE_FILE or AE_SYMLINK_TYPE_DIRECTORY and a tar archive is written, an extended tar header LIBARCHIVE.symlinktype is stored with the value "file" or "dir". When reading symbolic links on Windows, the link type is automatically stored in the archive_entry structure. On unix systems, the symlink type has no effect when reading or writing symbolic links.
* Windows symlink bugfixes and improvementsMartin Matuska2019-04-132-18/+70
| | | | | | | Treat targets ending with /. and /.. as directory symlinks Explicitly test for file and directory symlinks Improve debug output on test failure Fix two memory allocations
* Fix remaining MinGW testsMartin Matuska2019-04-071-3/+22
| | | | Enable tests on MinGW CI builds
* Fix various symlink bugs with Windows symlinksMartin Matuska2019-04-042-18/+36
| | | | tests: extend assertMakeSymlink with targetIsDir
* Cirrus CI: add Cygwin build, MinGW build use zlib, suppress download progressMartin Matuska2019-04-011-0/+2
|
* Add support for directory symlinks on WindowsMartin Matuska2019-03-271-2/+29
| | | | | Symlinks with the targets ".", ".." or with an ending slash in the target are treated as directory symlinks on Windows.
* Add basic read and write support for symbolic links on WindowsMartin Matuska2019-03-261-8/+132
| | | | | | TODO: proper handling of directory symlinks Fixes #1030
* Bug #1128: Deletion of unnecessary checks before calls of the function ↵Markus Elfring2019-02-041-4/+2
| | | | | | | | | | | | | “free” The function “free” is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. https://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software “Coccinelle 1.0.7”. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
* Use PATH_MAX if available for temporary path bufferMartin Matuska2018-09-201-4/+20
| | | | | | Check if temporary file path fits into buffer Fixes #1067
* Avoid ctype warnings.Joerg Sonnenberger2018-09-041-1/+1
|
* Fix warnings treated as errors during x64 buildBenjaminTrapani2018-01-251-1/+1
|
* Add zstd test suiteSean Purcell2017-05-152-0/+18
|
* Don't leak memory.Joerg Sonnenberger2017-04-291-0/+2
|
* Plug memory leaks in xattr and acl tests.Martin Matuska2017-04-032-3/+3
| | | | Detected with libasan on Linux.
* Improve extended attribute supportMartin Matuska2017-03-232-0/+95
| | | | | | | | | | | | | | | | | | Mac OS X changes: - add support for extended file attributes via sys/xattr.h - when extracting an archive entry that has mac_metadata and mac_metadata is requested to be extracted, extended attributes are restored only from mac_metadata. - by default, extended attributes are stored both in mac_metadata and SCHILY.xattr/LIBARCHIVE.xattr. This is subject to review and change. To match behavior on other platforms, store extended attributes on FreeBSD with extattr_set_link() if no fd is provided. Detection of extended attributes support in configure stage has been rewritten. Added xattr platform test to libarchive and xattrs option test to bsdtar.
* tar: fix conditionals and add richacl support to test_option_aclsMartin Matuska2017-03-231-0/+3
|
* Add NFSv4 ACL support for Linux via librichaclMartin Matuska2017-03-161-1/+24
| | | | | | | | | | | | Richacls are interpreted as NFSv4 ACLs and stored in archive_acl (Richacl flags and masks are not stored). Analog to mac_metadata, NFSv4 ACLs do not get extracted when the extraction of extended attributes is enabled and the "trusted.richacl" extended attribute is present. RichACL masks and are calculated from file mode on extraction. mac_metadata acl check has been moved in the code to be together with the richacl check.
* Move platform-specific ACL code to individual source files.Martin Matuska2017-03-142-62/+31
| | | | | | | | | | This makes the code much more readable and eases the addition of new ACL implementatons in the future. Additional changes: - most of ACL detection is now done at configure stage - configuration now reports what ACL was detected - NFSv4 ACL tests now test INHERIT_ONLY and NO_PROPAGATE_INHERIT
* Darwin ACL: avoid using mbr_identifier_to_uuid()Martin Matuska2017-03-072-3/+3
| | | | | | | Use mbr_uid_to_uuid() and mbr_gid_to_uuid() for backwards compatibility instead. These functions have been introduced together with membership.h. Fixes #882
* New tar test: test_option_aclsMartin Matuska2017-03-022-0/+252
| | | | | Add sunacl_get() and setTestAcl() to common test code Test for membership.h on Mac OS X and make it a requirement for ACLs
* Reorganize ACL defines and fix detection of ACL_SYNCHRONIZE on Mac OSMartin Matuska2017-03-021-3/+6
| | | | Adjust MacOS part of test_acl_platform_nfs4
* Change Solaris ACL support to use acl() and facl()Martin Matuska2017-03-021-4/+9
| | | | This removes dependency on libsec and enables compilation on Solaris 10.
* Compare full file flags in test_option_fflagsMartin Matuska2017-02-282-37/+66
|
* test_main: compact canNodump() source code a bitMartin Matuska2017-02-261-18/+2
|
* bsdtar tests: add test_option_fflagsMartin Matuska2017-02-262-4/+77
|
* Fix broken Linux fflags code since kernel 3.7 (Dec 2012)Martin Matuska2017-02-241-10/+59
|
* Improve verbosity of common functions for ACL testsMartin Matuska2017-02-222-44/+106
|
* test suite: use a single main test file for all testsMartin Matuska2017-02-214-163/+3730
|
* testsuite: allow 'dev' in versionPavel Raiskup2017-02-212-0/+163
|
* Fix matching test name to correctly check a test name terminator.Michihiro NAKAJIMA2012-10-101-4/+3
|