28 Commits

Author SHA1 Message Date
Tor Arne Vestbø
d6fb55b81f Fix CodeFactor issue 2021-07-07 16:59:52 +02:00
Tor Arne Vestbø
e5354e8841 Fix CodeFactor issue 2021-06-30 23:27:38 +02:00
Tor Arne Vestbø
00a45b9edc Keep files open for non-zero-copy reads as well
Opening and closing files is bad for performance, so now that
we accurately track the situation of hitting too many open files
we can keep the band files open, even for the non-readbuf code
path.

This unifies the logic of opening (and caching file descriptors)
between the readbuf and non-readbuf code paths.
2021-06-30 22:50:32 +02:00
Tor Arne Vestbø
b5398b1958 Catch EMFILE instead of trying to compute when we'll hit max open files
The previous logic was flawed anyways, as reading a range could
potentially span multiple bands, but we only checked if we were
just below the max limit.
2021-06-30 22:28:50 +02:00
Tor Arne Vestbø
fab4ea622e Add test for hitting max open files 2021-06-30 22:28:13 +02:00
Tor Arne Vestbø
80f5a0dda4 Clean up testsuite children before entire testsuite 2021-06-30 22:08:45 +02:00
Tor Arne Vestbø
a4ad1d74c5 Pass mount dir and DMG file out of mount_sparsebundle 2021-06-30 18:23:20 +02:00
Tor Arne Vestbø
4db576a284 Bail out of testsuite doesn't have testcases 2021-06-30 18:23:20 +02:00
Tor Arne Vestbø
b2d42503d4 Verify that testcase is a defined function 2021-06-30 18:23:20 +02:00
Tor Arne Vestbø
47d66c39bb Add option and test for reading without read_buf 2021-06-27 23:46:16 +02:00
Tor Arne Vestbø
365d3a35cd Use hfsfuse to test correctness of sparsebundlefs 2021-06-27 23:32:55 +02:00
Tor Arne Vestbø
970ad5e38d Move allow_other tests into main test suite 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
3a95b0cd73 Return dmg path and filename from mount_sparsebundle 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
64a1462dfb Use process group to kill children instead of parent PIDs
Using the process group (now that we've got one that's exclusive
to the testrunner) allows us to also clean up children that have
been detached from their original parent (and now have PID 1 as
their parent).
2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
a215104a15 Run testrunner in its own process group 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
26a141b86d Only remove test bundle dir if unmount was successful 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
a5ad123db1 Look for sparsebundle.dmg when setting up tests 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
fef3aeadfa Share test code between test suites 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
24400ff67b Use .tst extension for tests suites 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
d426e4345b Ensure sparsebundlefs process is alive while we're waiting for it 2021-06-27 22:07:55 +02:00
Tor Arne Vestbø
7b7a15e75a Ensure TEST_BUNDLE is set in test suites 2021-06-27 22:07:55 +02:00
Tor Arne Vestbø
c04732613c Run tests with build directory in PATH 2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
ed8c830af8 Remove unused pid variable in tests 2018-09-13 16:37:28 +02:00
Tor Arne Vestbø
cb7bbdffee Convert tests indentation to spaces 2018-09-13 16:36:47 +02:00
Tor Arne Vestbø
7d81b50bb8 Clarify access, ownership, and permissions for mounted sparsebundle
We now reflect the user who mounted the sparsebundle as the owner of
the resulting .dmg file, and try to reflect the state of allow_other
and allow_root through the file permission bits.

These are just informative. The real access control happens in FUSE
based on the allow_other/allow_root options (unless user also passes
the default_permissions option, in which case the permission bits
will also be checked).

Fixes issue #15
2018-09-10 15:22:03 +02:00
Tor Arne Vestbø
84f4844991 Tweak teardown test function style 2018-09-09 02:11:45 +02:00
Tor Arne Vestbø
9405bb2a93 Fix large file support on 32-bit systems
The move from off_t to size_t in 90c81b1776 was misguided. Although
it semantically makes sense to use an unsigned datatype for file sizes,
the size_t data type is only 32-bit wide on 32-bit systems, so the move
broke reading of large sparsebundles on 32-bit systems, since we could
no longer represent the file size.

We now use uint64_t explicitly, which is both unsigned, and wide enough
to represent all the files we want.

The uintmax_t datatype has been demoted to be used only for printing,
to make it clearer what width is actually expected and used in the code.

Fixes #26
2018-09-09 02:06:37 +02:00
Tor Arne Vestbø
d7a1f72062 Add test harness and initial mount test
Tests are run using 'make check', and can be combined with the
existing Makefile targets, e.g. 'make check all' to run checks
on all available platforms.

Pass DEBUG=1 for additional test output.
2018-09-08 22:24:46 +02:00