Commit Graph

153 Commits

Author SHA1 Message Date
Tor Arne Vestbø
f7cfe7ce93 Add more CI configurations 2021-07-06 23:18:48 +02:00
Tor Arne Vestbø
6553cfd466 Fix CI workflow 2021-07-06 23:00:27 +02:00
Tor Arne Vestbø
f0cb5945c6 Add CI workflow 2021-07-06 22:59:28 +02:00
Tor Arne Vestbø
4420e92b4d Add CodeQL badge 2021-07-06 22:45:23 +02:00
Tor Arne Vestbø
38c680f3d7 Install dependencies in CodeQL workflow 2021-07-06 22:36:19 +02:00
Tor Arne Vestbø
15d3d3821c Add CodeQL workflow 2021-07-06 22:32:29 +02:00
Tor Arne Vestbø
d3cc4b63ff Add install documentation 2021-07-06 22:27:18 +02:00
Tor Arne Vestbø
0c72dd7e42 Use standard variable names for install rules
As per
https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html

The INSTALL_PREFIX variable name has been deprecated in favour of
DESTDIR, so having both of them in the rule didn't make sense.

We now default to /usr/local as the install prefix, as recommended by
the GNU Make manual.
2021-07-06 22:21:36 +02:00
porst17
55f71e014c Add install and uninstall rules to Makefile 2021-07-01 00:44:57 +02:00
Tor Arne Vestbø
69e4d3ab9f Document how to mount APFS partitions
Fixes #36
2021-07-01 00:07:21 +02:00
Tor Arne Vestbø
e5354e8841 Fix CodeFactor issue 2021-06-30 23:27:38 +02:00
Tor Arne Vestbø
06dd45bfd5 Do special case ENOENT after all
Otherwise seeking into a raw dmg file will fail when hitting
parts of it that are not covered by a band. The expectation
in that case is to pad with zeroes, like we do for partial
bands.
2021-06-30 23:22:09 +02:00
Tor Arne Vestbø
b3f62d8f66 Add option to always close band files after use 2021-06-30 23:03:18 +02:00
Tor Arne Vestbø
5b75eeeebd Forward error code from process_band function 2021-06-30 22:52:49 +02:00
Tor Arne Vestbø
324d41ed89 Don't special case ENOENT (no such file) when opening bands
If a band is missing that's an error, and should be reported
as such.
2021-06-30 22:51:06 +02:00
Tor Arne Vestbø
3392ba1be1 Return -1 from sparsebundle_open_file on failure
As per the expectation of the call sites. Returning errno is not
necessary, as the caller can check errno directly.
2021-06-30 22:50:32 +02:00
Tor Arne Vestbø
c5dfc45e30 Use same variable name for band file descriptor 2021-06-30 22:50:32 +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ø
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