Commit graph

23 commits

Author SHA1 Message Date
George Kiagiadakis
60382df63f conf: refactor configuration loading
Changes:

- Configuration files are no longer located by libpipewire,
  which allows us to control the paths that are being looked up.
  This is a requirement for installations where pipewire and
  wireplumber are built using different prefixes, in which case
  the configuration files of wireplumber end up being installed in
  a place that libpipewire doesn't look into...

- The location of conf files is now again $prefix/share/wireplumber,
  /etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, instead of using
  the pipewire directories. Also, since the previous commits, we now
  also support $XDG_CONFIG_DIRS/wireplumber (typically /etc/xdg/wireplumber)
  and $XDG_DATA_DIRS/wireplumber for system-wide configuration.

- Since libpipewire doesn't expose the parser, we now also do the
  parsing of sections ourselves. This has the advantage that we can
  optimize it a bit for our use case.

- The WpConf API has changed to not be a singleton and it is a
  property of WpCore instead. The configuration is now expected
  to be opened before the core is created, which allows the caller
  to identify configuration errors in advance. By not being a singleton,
  we can also reuse the WpConf API to open other SPA-JSON files.

- WpConf also now has a lazy loading mechanism. The configuration
  files are mmap'ed and the various sections are located in advance,
  but not parsed until they are actually requested. Also, the sections
  are not copied in memory, unlike what happens in libpipewire. They
  are only copied when merging is needed.

- WpCore now disables loading of a configuration file in pw_context,
  if a WpConf is provided. This is to have complete control here.
  The 'context.spa-libs' and 'context.modules' sections are still
  loaded, but we load them in WpConf and pass them down to pw_context
  for parsing. If a WpConf is not provided, pw_context is left to load
  the default configuration file (client.conf normally).
2024-03-04 07:07:56 +00:00
George Kiagiadakis
98cd13284c tests: wait for the cores to connect before starting
Otherwise we end up executing the test without
an established connection
2023-07-04 15:09:31 +03:00
George Kiagiadakis
f94519a67a tests: upgrade failure notices to criticals
It's not very clear that these are the cause of failure when you look
at the logs
2023-07-04 14:57:26 +03:00
George Kiagiadakis
a0497b4256 Merge branch '0.4' into next 2023-06-21 20:59:04 +03:00
George Kiagiadakis
e738076cb0 conf: refactor component loading to use a dependency system
Each component can now list required and optional dependencies,
using the component feature names to match other components.
In addition, each component feature can be declared as required, optional
or disabled, making optional components easier to deal with.
The component flags (ifexists, nofail) have been removed.

Using virtual components, this system also allows easier customization
of which components should be loaded for a specific configuration,
without requiring the user to copy the list of components and edit it.

Also bump the required glib version to 2.68 for g_assert_cmpstrv()
2023-06-20 12:39:29 +03:00
George Kiagiadakis
4f27d18bd3 log: rename "message" level to "notice" and print criticals with "E"
Syslog calls this level "notice" and I prefer it because we use it
to display significant messages that are not warnings, but they
are not really "standard", as GLib wants them to be. There is nothing
"standard" about log messages in general.

Also, make these notice messages be enabled at debug level 2, together
with warnings. The default log.level is 2 and it is a good idea to show
notices by default too.

Finally, show them in the log with "N" and also change criticals to be
shown with "E", meaning "error"... Then promote G_LOG_LEVEL_ERROR
messages to be shown with "F", meaning "fatal", because in fact these
messages are always fatal and always call abort(). Still, keep the term
"critical" in the functions to make sure that whoever uses them is aware
that this level is only for critical conditions and not suitable to
display any kind of error.
2023-05-18 16:19:49 +03:00
George Kiagiadakis
4736d56557 log: implement a log topics system, like pipewire
The intention is to make checks for enabled log topics faster.

Every topic has its own structure that is statically defined in the file
where the logs are printed from. The structure is initialized transparently
when it is first used and it contains all the log level flags for the levels
that this topic should print messages. It is then checked on the wp_log()
macro before printing the message.

Topics from SPA/PipeWire are also handled natively, so messages are printed
directly without checking if the topic is enabled, since the PipeWire and SPA
macros do the checking themselves.

Messages coming from GLib are checked inside the handler.

An internal WpLogFields object is used to manage the state of each log
message, populating all the fields appropriately from the place they
are coming from (wp_log, spa_log, glib log), formatting the message and
then printing it. For printing to the journald, we still use the glib
message handler, converting all the needed fields to GLogField on demand.
That message handler does not do any checks for the topic or the level, so
we can just call it to send the message.
2023-05-16 20:42:28 +03:00
matoro
b7d41ac5bd tests: common: crank up timeout for slower devices
Timeout of 3 seconds is too slow for test-si-standard-link on slower
devices, crank this up with plenty of extra margin.  Does not
practically affect running time on faster devices.
2023-04-20 17:53:35 -04:00
Ashok Sidipotu
4d7ce2292e tests: Add tests for WpSettings object
- settings.c tests conf file loading & parsing, metadata updates,
  wpsetttings object creation and its API.
- settings.lua tests the API from lua scripts.
- Add a sample settings.conf file, this file contains sections copied
  over from client.conf along with the settings section. Add a file
  each for wp side and lua side of scripts.
- Make changes in base test infrastructure to take a custom conf file.
- Enhance the wp_settings_get_instance_api() to be take metadata_name
  parameter. So, Wpsetttings is now a singleton instance for a given
  metadata file.
- Enhance the m-settings module also to be take metadata_name parameter.
  this is handy for lua side of tests as its cumbersome to do this is
  lua.
2023-04-17 07:44:19 -04:00
Julian Bouzas
eb8f9a1a83 tests: common: add API to check if spa lib is installed
Allows to skip tests if specific spa lib is not installed
2021-07-16 11:49:35 -04:00
Julian Bouzas
85a7f01cb6 tests: common: make sure no events are pending before destroying core 2021-06-08 13:23:39 -04:00
George Kiagiadakis
1ca67abc66 object-manager: support declaring interest on all properties of globals
Until now, object manager could only match pw global properties on
pw global objects, because this is the only available properties set
at the time the registry creates the global.

With this change, the object manager will now bind the proxy
if the type and the pw global properties have matched and will wait
until the proxy is available with all of its properties and tries
the check again.
2021-06-07 17:47:42 +03:00
Julian Bouzas
120aab04ae session-item: refactor and inherit from WpObject
This adds WP_SESSION_ITEM_FEATURE_ACTIVE and WP_SESSION_ITEM_FEATURE_EXPORTED
features, so _activate and _export APIs have been removed. Modules and unit
tests have also been updated.
2021-03-18 14:30:05 -04:00
George Kiagiadakis
1afc487353 tests: fix library unit tests 2020-11-13 19:54:48 +02:00
Julian Bouzas
bd0218c3ee tests: base-test-fixure: make sure core is done before destroying it 2020-05-19 10:18:51 -04:00
George Kiagiadakis
68223e0ea3 tests: add unit test for WpCore disconnection 2020-05-13 15:21:10 +03:00
George Kiagiadakis
66a0bf6093 lib: implement a wp_init() function 2020-05-11 15:45:09 +03:00
George Kiagiadakis
11b99527b5 core: make the properties on wp_core_new to be (transfer full)
This aligns better with the general design of consuming property
objects on constructors, both in PipeWire and WirePlumber APIs
2020-05-08 17:12:31 +03:00
George Kiagiadakis
f24fc53d5a tests/common: add common function for ensuring an object manager is installed
It can be a bit tricky because the "installed" signal may be fired
from inside the context of wp_core_install_object_manager(),
in which case the main loop should not be executed (or it will never quit)
2020-05-07 16:16:45 +03:00
George Kiagiadakis
444814d753 tests: common: add common callbacks based on the si-simple-node-endpoint test 2020-04-23 17:54:49 +03:00
George Kiagiadakis
c1c91ce7d0 tests: add basic test for si-simple-node-endpoint 2020-04-23 15:49:32 +03:00
George Kiagiadakis
1d157f016a tests: move common fixture code to WpBaseTestFixture 2020-04-22 18:39:03 +03:00
George Kiagiadakis
4eaa99a698 tests: collect common helpers in the 'common' directory 2020-04-22 17:13:33 +03:00