Xwayland uses a timer for the scheduler which means any of our syscalls
can trigger EINTR. Let's make sure we may catch bugs related to that by
setting up our test suite to hammer us with timers.
Can't guarantee this will trigger all bugs but over time it may help or
at least ensure that the low-hanging fruit are all fixed.
This allows us to handle/manipulate argv and/or pass a userdata to the
tests. Same ELF section approach as we already have with the MUNIT_TEST
macro but this time it's for a global setup.
Note that for the generated __start and __stop section variables we have
to have at least one entry in that section which we do with one
hardcoded (and ignored) one.
SIGALRM *should* not really be an issue for us, most of our IO shouldn't
take long (posix_fallocate is the exception) so we can just retry it
instead of blocking someone's use of SIGALRM.
Doing it here mostly means that the rest of libei doesn't have to care
about EINTR, it'll just be handled transparently (just like before with
the SIGALRM blocks).
Limits the number of poll() iterations before triggering a shutdown.
This allows us to use this tool for shutdown testing too - previously
it would just get killed and never performed a proper unwind.
If we get disconnected there's no point sending anything anymore, the
server may have already closed the connection.
Otherwise this produces a confusing warning in the log:
18:37:31 | INFO | Disconnected by EIS
... | WARN | failed to send message: Broken pipe
See https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/262#note_2132619
Any error will cause ei_disconnect() which in turn unwinds our context.
Each object removed will cause an ei_send_message() to notify the server
but that will only cause error messages - our socket is already gone.
Fix this by removing the source and checking if the fd is still valid
before we write to it.
Fixes#47
Upstream commit 1250bf30a8c2e3c1bfac285489bc63f2c395b641 somehow breaks
things. Doesn't affect hugo v0.111 (F39) but it does break on F38 on
v0.101.
Let's not waste more time debugging this, hardcode the template and in a
few weeks time we can switch to F39 as the build host.
WARN 2023/10/11 12:41:19 "_index.md": WARNING you must call the ref /
relref shortcode with '% %' instead of '< >' to work correctly for the
anchor target attribute
The pages job is only run once we push to main, so any issues with the
documentation build won't be picked up until it's too late. Split those
up and build the doc in a separate job, the pages job simply takes the
artifacts from that job and publishes them.
posix_fallocate() may be interrupted (EINTR), e.g. by SIGALRM in the X
server's smart scheduler. On slow systems and for large allocations
this means we cannot ever succeed so let's block SIGALRM like everyone
else does.
See e.g.
4cfee39872
and the same code is in libwayland, libdecor, etc.
Not sure what platforms this isn't the case on and I'm even less sure we
need to care so let's fail the build where this is the case and work it
out if someone complains.
In case our outbound buffers are full we need we need to be able to have a
notification when we're able to write again.
There are two approaches to do this: one is to duplicate the source
(and dup() the fd) and use that for write notifications only. The other
approach is to toggle the source's EPOLLOUT flag on demand, thus
sharing the source dispatch. I picked the latter for simplicity.
With our strings being a 4-byte header followed by the string itself,
they're virtually guaranteed not to be 8-byte aligned. This causes an
issue on some architectures so we need to copy the string out before we
access it.
Since strings are the only protocol type with that extra buffer, let's
hack this in with the minimum effort approach - a null-terminated
char * pointer array that's filled with the strings as they appear in
on the wire. The brei_arg->s points to one of those strings as needed.
This means we can drop the brei_string struct, thanks to pointer alignment
issues this struct doesn't work on s390x, so let's drop it, it no longer
serves any meaningful value.
Fixes#41
We were leaking some of the utility functions, let's not do that.
This is technically an ABI break but if you're relying on libei to
export those functions...well, don't.
DBusMock is unittest based and the documentation points users to that
approach. That approach is limiting however because we can't use all
pytest features (see [1]). Luckily, the parent class in dbusmock doesn't
really do much so we can emulate the functionality ourselves - all we
need to do is call the same setUp/tearDowns and be done with it.
This means we can move the dbus-monitor and mainloop handling into
fixtures too which makes the code a fair bit nicer to read.
[1] https://docs.pytest.org/en/7.1.x/how-to/unittest.html#pytest-features-in-unittest-testcase-subclasses
This allows a caller to match up a region with other data, e.g. in the
remote desktop case the same mapping_id can be assigned to the pipewire
stream that represents that output.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Wrong calculation resulted in memmoving only the first 32 bytes (i.e. 8
fds) instead of the first 32 fds, resulting in an infinite loop when
cleaning up an iobuf with more than 8 fds.
Even where our client pretends to have higher interface versions, we
always send back version 1 from the EIS implementation.
This test probably won't really trigger anything useful until we switch to
version 2 somewhere, so let's hope the code works...