Heavily inspired by libinput's litest framework (built around check), this is
a from-scratch framework that simplifies adding tests for various parts of
pipewire. See the pwtest.h documentation for details but the basics are:
- PW_TEST() and PWTEST_SUITE() specify the tests to be run
- Test are run in forked processes, any errors/signals are caught and printed
to the log
- Tests have a custom pipewire daemon started on demand to talk to [1]. The
daemon's log is available in the test output.
- Output is YAML to be processed into whatever format needed
[1] There are limits here, since we can't emulate devices yet there is only
so much we can rely on with the daemon.
If we have a C++ compiler, compile all the #include tests with that - it'll
pick up any issues that a C compiler will pick up anyway. This saves us from
having a separate C++ compiler test and it'll test each header separately for
C++ compatibility..
Override the CORE_NAME using the env variable in the context instead
of pipewire.c. This avoids needing the _add_string() property method.
Remove the properties_add_string() method, there are new improved
plans for property parsing and merging: See #207
These headers are designed for including in the project. So the user doesn't
need to install valgrind-devel and we don't have to worry about whether the
headers are available or not.
For each header in the spa directory, generate a compilation test that
includes just that header. This way we can pick up missing #includes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Set this once during setup so we don't have to remember to call fflush() after
each logging operation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
In the interested of making the logs narrower, let's drop some digits from the
clock_gettime() seconds value. Clamping to 5 digigts, this gives us just under
28h before we wrap which is likely good enough for debugging.
Write the timestamp and location into a temporary buffer, then include them in
the message print. This makes bugs involving size vs length less likely and
provides a fixed limit for how much space the filename can take in the
message.
Setting a NULL value for the property will remove the property and
will thus not send an update to the server and will thus not stop
freewheeling. Use "" to remove ourselves from the freewheel group
instead of looping forever.
See #1265
Replace the manually maintained header list with a Python script that finds
all header files and includes them in order. This adds another 25 or so
previously headers to the C++ compilation tests.
The two are functionally equivalent, but spa_snprintf never returns a value
higher than the size, preventing memory corruption where our input string
exceeds the target buffer size (see c851349f1).
Niche case: we can no longer differ between real overflow and fitting an
N-byte string into an N+1 sized buffer, we now get a "...truncated" message
now for log messages of exactly 999 bytes long.
Wraps the glibc snprintf/vsnprintf calls, but aborts if given a negative size
and zero-terminates the buffer on error.
The returned value is clipped to size - 1 which avoids issues like the one
fixed in c851349f17.
Try to keep the full docs out of the headers and into the .c file.
A small short blurb in the header is enough for quick lookups.
Also try to use a regular comment to not confuse the doc system.
void* cannot be automatically type-casted so let's do this explicitly.
../spa/include/spa/param/latency-utils.h: In function ‘spa_pod* spa_latency_build(spa_pod_builder*, uint32_t, const spa_latency_info*)’:
../spa/include/spa/pod/builder.h:651:1: error: invalid conversion from ‘void*’ to ‘spa_pod*’ [-fpermissive]
First element is a spa_list, so {{0}} it is.
../spa/include/spa/node/utils.h:98:40: warning: missing braces around initializer for ‘spa_list’ [-Wmissing-braces]
98 | struct spa_hook listener = { 0 };