Commit Graph

123 Commits

Author SHA1 Message Date
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
Tor Arne Vestbø
da81d0de66 Tweak language in docs about mount point access 2018-09-10 15:26:04 +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ø
b78b40a880 Always restore terminal to sane defaults after docker-compose 2018-09-10 10:36:25 +02:00
Tor Arne Vestbø
9afa26898c Run test cases in order 2018-09-09 02:33:53 +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ø
7e21a302ed Use consistent style for pointer declarations 2018-09-09 01:36:06 +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
Tor Arne Vestbø
46bfe7b547 Output log message when exiting the application 2018-09-08 22:15:10 +02:00
Tor Arne Vestbø
c831d584af Don't send syslog messages to console via LOG_CONS
It results in duplicate messages to the console when run in the
foreground on Ubuntu 16.04. We already get all messages to stderr
via LOG_PERROR.
2018-09-08 22:15:10 +02:00
Tor Arne Vestbø
1d65325a8b Add basic infrastructure for doing 32 and 64-bit GCC builds on macOS
Using make to do the platform selection is admittedly abusing the
hammer beyond any sort of sanity, but was a fun exercise ;)
2018-09-08 22:15:03 +02:00
Tor Arne Vestbø
63da17bdea Indent Makefile conditionals with spaces instead of tabs
Makes it less likely that make will confuse the indent for a command.
2018-08-04 19:22:41 +02:00
Tor Arne Vestbø
e4cae5363b Add dSYM files to gitignore 2018-08-03 01:24:37 +02:00