Commit Graph

136 Commits

Author SHA1 Message Date
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ø
a52497c2b6 Log when we're opening and closing files for basic reads 2021-06-30 22:28:13 +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ø
f34eb1dac3 Allow running single test by name 2021-06-27 23:54:24 +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ø
6c837549ad Use short-form of testsuite when printing missing testcase 2021-06-27 22:07:55 +02:00
Tor Arne Vestbø
fb86e90f00 Run test setup and teardown the same way test cases are run 2021-06-27 22:07:55 +02:00
Tor Arne Vestbø
75cfaff6c3 Create test bundle with no partition map
Allows us to mount it directly without fiddling with offsets.
2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
c04732613c Run tests with build directory in PATH 2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
ae6a7df365 Use standard variable name for linker flags 2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
6b39c2bdd5 Pass architecture flags though single variable 2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
a10d93a02e Support running docker-builds from out-of-tree (shadow) builds 2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
b70e8fb4be Move sources into their own subdirectory 2021-06-27 19:55:01 +02:00
Tor Arne Vestbø
14dba80c03 Properly set architecture flags for both compiler and linker 2021-06-27 19:52:07 +02:00
Tor Arne Vestbø
3e7b6acbf6 Enable -Wextra for additional compilation warnings 2021-06-27 15:44:12 +02:00
Tor Arne Vestbø
1181dee042 Account for already used file descriptors when computing max open files
The process already has some existing file descriptors open, e.g. stdin,
stdout and stderr, so we can't assume we can open as many files as the
RLIMIT_NOFILE tells us.

A different approach to this is to not use a static limit of maximum
open files, but instead react to EMFILE when trying to open new files,
and then close existing files, but as a stop gap we compute a more
accurate static value for the maximum open files.

Fixes #35
2021-06-26 23:05:35 +02:00
Tor Arne Vestbø
b8993dc56f Verify that pkg-config is available
Fixes #32
2021-06-26 16:41:40 +02:00
Tor Arne Vestbø
c899404e30 Explicitly include limits header
Fixes #37
2021-06-26 16:36:37 +02:00
Tor Arne Vestbø
262ae2420f Actually return the fuse_main return value from main() 2021-06-26 16:35:37 +02:00
Tor Arne Vestbø
414f30f268 Force single-threaded operation
The codebase is not thread safe, so limit to single-thread operation
until this can be improved.
2019-05-22 14:46:20 +02:00
Tor Arne Vestbø
3cfb00979a Fix ShellSheck warning SC2162 2018-09-13 16:52:32 +02:00
Tor Arne Vestbø
ba76dfa458 Properly clean up subprocesses in tests
Relying on the process group to figure out which processes to treat
as children and grandchildren of the test run was not correct, as
the testrunner didn't ensure it was creating a new process group.

When running inside 'make check' the process group was actually that
of make, not testrunner.sh.

Since setpgid is not universally available, we iterate the process
tree via ps, and kill the children recursively.
2018-09-13 16:46:31 +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ø
d56ff2a19a Tweak language in README 2018-09-12 13:19:22 +02:00
Tor Arne Vestbø
501f1ca5f1 Fix Makefile indentation 2018-09-11 23:59:18 +02:00
Tor Arne Vestbø
d5691b1418 Update FUSE link 2018-09-11 23:54:37 +02:00
Tor Arne Vestbø
5851bf70fa Add LGTM badge 2018-09-11 23:45:02 +02:00
Tor Arne Vestbø
9ac1d2d230 Fix Markdown code block indentation 2018-09-11 23:44:47 +02:00
Tor Arne Vestbø
134f8b61c1 Add CodeFactor badge 2018-09-11 23:24:59 +02:00
Tor Arne Vestbø
9a4d8f3567 Make use of getgrnam() thread-safe
getgrnam is not thread-safe on Linux (but is on macOS). To ensure
we don't call it from two threads at the same time we move its use
inside a lambda that initializes a local static. This is fine, as
we don't expect the 'nogroup' gid to change.
2018-09-11 23:18:31 +02:00
Tor Arne Vestbø
9b3c59f63c Fix ShellSheck issues 2018-09-11 11:08:49 +02:00
Tor Arne Vestbø
c1f54577df Only print colors during testing if attached to a color-capable TTY 2018-09-10 16:39:39 +02:00
Tor Arne Vestbø
7aad5ce703 Update macOS naming 2018-09-10 16:33:33 +02:00