Commit graph

6621 commits

Author SHA1 Message Date
Peter Hutterer
7909c99ead test: convert two spa tests to pwtest 2021-06-09 18:00:39 +10:00
Peter Hutterer
493f0724b5 test: move the array tests to pwtest
Add them to the existing pw_properties test binary and rename that to
pw-utils.

Same functionality as before for the pw_array tests.
2021-06-09 18:00:39 +10:00
Peter Hutterer
3865d8846e test: add a simple test for the library version 2021-06-09 18:00:39 +10:00
Peter Hutterer
44dcca0d99 test: add tests for pw_properties 2021-06-09 18:00:37 +10:00
Peter Hutterer
5911a629f3 test: add an example test for a failing daemon test
If we don't start a daemon from the test suite, we should fail connecting to
one even where a system daemon is running.
2021-06-09 18:00:06 +10:00
Peter Hutterer
28f74dc6b2 test: fall back to a timerfd if pidfd fails
Looks like we don't have pidfd in the CI runners, so let's fall back to a
timerfd that pings us every 20ms in case the test finished.
2021-06-09 18:00:06 +10:00
Peter Hutterer
9bc840efe2 test: detect if we're running through gdb and disable forking mode 2021-06-09 18:00:06 +10:00
Peter Hutterer
dc5751b569 test: add a helper function for making tempfiles
Having a helper aids with the file being in the right directory and cleaned up
automatically on exit. Plus, failing the test with the sytem error status code
signals that it's not the actual test failing here.
2021-06-09 18:00:06 +10:00
Peter Hutterer
dd3f14d9d6 test: add a function to load a SPA interface
Helper function to load a SPA interface. This enables a test to easily load a
specific interface and run tests against that interface without having to
instantiate a whole pipewire daemon.
2021-06-09 18:00:06 +10:00
Peter Hutterer
50180532a4 test: add errno check macros 2021-06-09 18:00:06 +10:00
Peter Hutterer
2073269f47 test: set PIPEWIRE_REMOTE to a garbage value if we didn't start a test daemon
Don't let tests connect to the system daemon which would happen if we don't
have PIPEWIRE_REMOTE set at all.
2021-06-09 18:00:06 +10:00
Peter Hutterer
e01faf42a1 test: give each test its own XDG_RUNTIME_DIR and TMPDIR
On startup, create /tmp/pwtest-$TIME-$RANDOM/ and give each test an
XDG_RUNTIME_DIR and TMPDIR inside that (simply numerically numbered). This
avoids the tests interfering with the system like accidentally connecting to
the real pipewire instance or trying to create files where they shouldn't.
2021-06-09 18:00:06 +10:00
Peter Hutterer
ed3f882fa9 test: add the pwtest test framework
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.
2021-06-09 18:00:06 +10:00
Peter Hutterer
0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Peter Hutterer
fee4d0eae1 spa: switch the include header test to C++ by default
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..
2021-06-09 07:43:46 +00:00
Wim Taymans
750cafd7d1 context: use pw_context_destroy() in error cases
Make sure we free all the resources of a context when it can't be
created.
2021-06-09 09:41:50 +02:00
Wim Taymans
c12bdb8c6c pipewire: cleanup on error
To make leak checks more accurate.
2021-06-09 09:41:50 +02:00
Wim Taymans
4c64afc4ff acp: add hw-mute and hw-volume as properties 2021-06-09 09:41:49 +02:00
Wim Taymans
e857856be7 0.3.30 2021-06-09 09:14:11 +02:00
Wim Taymans
db245fd0ce context: override the CORE_NAME in context
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
2021-06-08 16:56:22 +02:00
Peter Hutterer
f3a98debec spa: don't run the spa_scnprintf abort test under valgrind
valgrind doesn't know we expect this to fail, so let's not confuse it
2021-06-08 20:21:50 +10:00
Peter Hutterer
10270621c2 spa: fix a missing include 2021-06-08 20:21:50 +10:00
Wim Taymans
ec39cbee68 jack: improve debug
Add quotes around the port and client names.
2021-06-08 09:50:13 +02:00
Wim Taymans
2dcab4580f jack: store renamed port
When we rename the port, also store the new name in the port structure
so that we can actually find the port with the new name.

See #1265
2021-06-08 09:40:14 +02:00
Evgeniy Khramtsov
98ce5acb69 utils: define SIGABRT for FreeBSD 2021-06-07 20:53:16 +03:00
Wim Taymans
8132c4e2b4 acp: add fallback alibpref just in case
Until we are sure that everybody has a recent enough version of
alsa-lib 1.2.5
2021-06-07 13:04:03 +02:00
Wim Taymans
1f85d06317 module-adapter: clear bound-resource when destroyed
So that we don't reference it anymore or try to remove the listener.
2021-06-07 12:57:09 +02:00
Barnabás Pőcze
b6c6a21747 pipewire: module-adapter: remove resource listener
Unregister the resource listener when the node is going
away to avoid use-after-free issues.

Fixes #1276
2021-06-07 10:54:19 +00:00
Barnabás Pőcze
bec615971c spa: utils: hook: use tab 2021-06-07 10:54:19 +00:00
Wim Taymans
16674a07a5 logger: improve formatting
Make enough room for the timestamp to include the last ]
Add a space before the actual log line.
2021-06-07 12:52:21 +02:00
Peter Hutterer
83f8a2896f alsa-mixer: drop the VALGRIND_HAVE_MEMCHECK hacks
Cause for this was a missing ioctl, fixed in 2014. See valgrind commit
4ef60ef1029e6933773b7de9966ece7185129d84
2021-06-07 10:44:27 +00:00
Peter Hutterer
b6e27822e5 pipewire: use RUNNING_ON_VALGRIND to determine if we're in valgrind
This removes the use of the VALGRIND environment variable
2021-06-07 10:44:27 +00:00
Peter Hutterer
d9cc1a25f1 Include the valgrind headers in our tree
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.
2021-06-07 10:44:27 +00:00
Peter Hutterer
d08d989412 spa: add a test for missing includes
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>
2021-06-07 10:31:17 +00:00
Peter Hutterer
6499f96396 spa: add missing #includes 2021-06-07 10:31:17 +00:00
Peter Hutterer
c049689884 logger: set linebuffering for the log
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>
2021-06-07 10:29:36 +00:00
Peter Hutterer
1c083a6d69 logger: clamp the log time to 5 digits
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.
2021-06-07 10:29:36 +00:00
Peter Hutterer
9737d6e3da logger: align debug messages better
Taken from https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/655#note_912691
2021-06-07 10:29:36 +00:00
Peter Hutterer
1a710cad3c logger: reduce the number of appending snprintf calls
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.
2021-06-07 10:29:36 +00:00
Wim Taymans
b142e7f09f jack: stop freewheeling correctly
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
2021-06-07 12:22:47 +02:00
Wim Taymans
9a90030596 pw-cli: fix command parsing after pw_split changes
Don't assume anything about the way the split function maintain the
state.
2021-06-07 11:17:45 +02:00
Wim Taymans
0792c690c2 jack: schedule port latency update from main thread
Ardour does the port latency update from the process thread. Schedule
an update on the main thread in all cases to avoid deadlocks.

See #1265
2021-06-07 11:16:24 +02:00
Peter Hutterer
db989d851d spa: auto-generate the cpp compilation test
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.
2021-06-07 07:20:21 +00:00
Peter Hutterer
fb75367975 spa: add a missing include
../spa/include/spa/node/node.h:639:14: error: ‘ENOTSUP’ was not declared in this scope
2021-06-07 07:20:21 +00:00
Peter Hutterer
48eadac1f1 logger: switch snprintf to spa_snprintf
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.
2021-06-07 15:37:51 +10:00
Peter Hutterer
47c173c83f spa/util: add spa_scnprintf to use over snprintf
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.
2021-06-07 15:16:35 +10:00
Wim Taymans
5a054cfc9e jack: call pw_ methods from within the lock
We're using a thread loop so always call methods with the lock or
we might cause lockups and crashes.

See #1265
2021-06-05 20:17:37 +02:00
Arun Raghavan
08daf3f4f4 pulse-server: Add a module-echo-cancel
Fairly straightforwad module to load libpipewire-module-echo-cancel
2021-06-05 17:54:02 +00:00
Huang-Huang Bao
8c42e6aecb alsa,bluez5: handle SPA_PARAM_Latency in port_set_param
Simply return 0 instead of -ENOENT.

Fixes #1262
2021-06-05 17:52:40 +00:00
Huang-Huang Bao
d3fcc0a37a bluez5: correct parameter names in spa_bt_sco_io_create declaration
From its definition and parameters passed to its function call, the 3rd parameter
is read_mtu and the 4th is write_mtu.

Fixes #1256
2021-06-05 15:17:10 +00:00