Commit graph

266 commits

Author SHA1 Message Date
Barnabás Pőcze
8ed46a283f treewide: meson.build: use project_{build,source}_root()
Use `meson.project_{build,source}_root()` instead of
`meson.{build,source}_root()` because those functions
do not work as expected when used inside a subproject,
and they have been deprecated in meson 0.56.0.
2021-12-28 18:37:18 +01:00
Barnabás Pőcze
2b110af366 treewide: meson.build: use dependency variable for SPA
Use `spa_dep` everywhere instead of `spa_inc`,
and remove `spa_inc` altogether.
2021-12-28 18:34:06 +01:00
Gleb Popov
f70dd7fa0c Use real sched_getcpu() implementation on FreeBSD 14. 2021-12-26 17:43:23 +03:00
Peter Hutterer
abd5f9fbe8 Remove remaining tabs from meson.build files
No changes, just tab-to-space replacement and a little bit of manual
twiddling.
2021-09-30 00:08:27 +00:00
Nils Tonnätt
dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Nils Tonnätt
f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Niklāvs Koļesņikovs
e062c4d8de meson.build: adds summary() to optional programs 2021-06-29 17:23:37 +00:00
Barnabás Pőcze
7cecb1567d spa: tests: remove double dot from names of test files
Previously, the configured test file would be named like the following:

  spa-include-test-spa_control_control_h..cpp

fix that by removing one of the dots.

Furthermore, use the already existing `find` object instead of
calling `find_program` one more time.
2021-06-16 19:45:27 +02:00
Peter Hutterer
9a65d90e88 test: move the spa tests to pwtest
Move the spa tests to the pwtest framework. The pod tests have only been
wrapped in the function callers, they don't use the variuos pwtest helpers -
too much work for very little gain here. Can be done incrementally if needed.

Note that this removes the spa tests from the installed tests. Arguably,
installing those tests was unnecessary anyway since they are static binaries
and don't load anything. So having them installed runs the same tests as
having them run in the source tree.

Goal for the pwtest framework is to allow for installed tests, just not there
yet.
2021-06-09 18:00:59 +10:00
Peter Hutterer
7909c99ead test: convert two spa tests to pwtest 2021-06-09 18:00:39 +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
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
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
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
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
Peter Hutterer
81cc466752 spa: the cpp test is a compilation test only
No point installing or even running it, we don't do anything here.
2021-06-04 18:46:29 +10:00
Peter Hutterer
4d45182801 spa: add SPA_FOR_EACH_ELEMENT for array traversal 2021-06-03 07:25:32 +00:00
Peter Hutterer
6826df07da spa/utils: add spa_atou32, spa_atoi64,spa_atou64, spa_atod, spa_atof
Same as the existing spa_atoi32 but for uint32_t, {u}int64_t, float and
double.
2021-06-02 07:39:41 +00:00
Peter Hutterer
1a5faa7b52 spa: add a header for ANSI color sequences
Makes the code more readable and guarantees we use the same sequences for the
same colors everywhere.
2021-06-02 14:17:29 +10:00
Wim Taymans
9262f576d5 spa: fix unit test, add new object type 2021-05-27 15:26:09 +02:00
Peter Hutterer
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
d8a9534a9a spa/string: add spa_streq() and spa_strneq() for string equality
Easier to use than strcmp() since their return value matches expectations. And
they do what is expected with NULL strings, two NULL pointers are equal, one
NULL pointer is not equal.
2021-05-18 22:10:27 +10:00
Peter Hutterer
5aa15d10e9 spa: add a new string helper with spa_strtol()
Most of the time when we convert a string to an integer we only care about
success. Let's wrap this with a helper function that sets the value to the
result and returns true on success.
2021-05-18 07:35:00 +00:00
Peter Hutterer
0504ebffeb spa: prefix SPA_*_LAST enum values with an underscore
These are not part of the ABI, prefixing them makes this a bit more obvious
that they shouldn't be used.
2021-05-18 10:41:26 +10:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Wim Taymans
7c819320c7 tests: fix test of array values
Don't assign but test. Also test the right array index..
2021-03-27 20:10:01 +01:00
Wim Taymans
db85339f50 json: handle overflow better
We need at least the length of the string+1 as the length of the
target in spa_json_get_string(). Add a unit test for this.
2021-03-18 19:44:25 +01:00
Wim Taymans
fc9a6d6b1e spa: spa_json_get_string does not return the length
The returned string is null terminated.
2021-03-18 18:57:26 +01:00
Wim Taymans
8e590df92f spa: improve info parsing
Make info parsing a bit easier to read by assigning the key and
value to temporary variables.
Improve the parsing of channelmap using json parser to make it
support more cases.
Add a unit test for channelmap parsing options.
2021-03-18 18:40:56 +01:00
Wim Taymans
f41de50b28 json: escape and unescape invalid unicode chars 2021-03-12 09:23:33 +01:00
eater
6a21909281
spa: escape double quotes 2021-02-18 14:01:28 +01:00
Wim Taymans
ebf324590b pod: handle various ways of making empty array/choice
Make it possible to make empty array/choice
Handle empty array/choice
Add some tests to make empty arrays/choice objects
2021-01-25 10:55:30 +01:00
Oschowa
f767521baf spa: fix test-buffer
there is a new meta type since b39a2258
2021-01-22 13:51:08 +01:00
Wim Taymans
579e8a4ea6 json: allocate one extra byte for the \0 2021-01-19 16:56:55 +01:00
Wim Taymans
948255f801 result: don't use undefined shift
Use a different way to generate the upper bits of the ASYNC mask
instead of undefined shift as warned by sanitizer
Add some unit test for this

See #497
2020-12-21 21:08:56 +01:00
Wim Taymans
af8bb55762 spa: fix test on 32 bit
Fixes #441
2020-12-04 09:36:05 +01:00
Wim Taymans
62cdec8448 spa: move json parser to utils
Add unit test
Add escape function
2020-11-28 15:34:01 +01:00
Wim Taymans
fc2b0b20ad hook: zero hooks before adding them
Clear the hook before adding it so that we are sure the removed
callback doesn't contain garbage and cause a crash on disconnect.

Mark the removed and priv fields as private. Make sure to add the
removed callback after adding the hook.

Fixes a crash in kwin
2020-11-20 09:40:24 +01:00
Simon McVittie
a652edce0a Only assert about x86_64 struct sizes if ABI is LP64, not x32
The __x86_64__ macro identifies a CPU family, and is unfortunately not
enough to identify a concrete ABI.

The normal x86_64 ABI that is used by practical Linux distributions is
LP64 (i.e. 32-bit int, and 64-bit long and pointer), and defines
__x86_64__ and __LP64__.

x32 is a niche ILP32 ABI (i.e. 32-bit int, long and pointer) for x86_64
CPUs, which has different struct sizes due to sizeof(long) and
sizeof(void *) being smaller. It defines __x86_64__ and __ILP32__.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-07 15:21:17 +00:00
Simon McVittie
b852b58f82 Optionally install examples and tests
This makes it easier to test PipeWire in its "as-installed" state,
for example in an OS distribution.

The .test metadata files in ${datadir}/installed-tests/${package} are
a convention taken from GNOME's installed-tests initiative, allowing a
generic test-runner like gnome-desktop-testing to discover and run tests
in an automatic way.

The installation path ${libexecdir}/installed-tests/${package} is also
a convention borrowed from GNOME's installed-tests initiative.

In addition to the automated tests, I've installed example executables
in the same place, for manual testing. They could be separated into
a different directory if desired, but they seem like they have more
similarities with the automated tests than differences: both are there
to test that PipeWire works correctly, and neither should be relied on
for production use. Some examples are installed in deeper subdirectories
to avoid name clashes.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-16 17:58:02 +00:00
Wim Taymans
eb93f259e0 avoid some useless assignments 2020-05-20 15:24:25 +02:00
Wim Taymans
42b1e163d7 tests: make benchmarks less busy
Reduce iterations of the benchmark so that can finish on slower
devices.
2020-02-07 15:22:35 +01:00
Wim Taymans
3317af804b pw-profiler: add profiler tool
Add Profiler object and fields.
Add profiler extension API. It notifies Profiler objects with
real-time performance data.
Add module that implements the profiler extension.
Add pw-profiler tool that binds to the profiler API and dumps the
data into a log file, gnuplot files, a html page and a script to
generate svg graphs. This is almost the same as what JACK2
JackEngineProfiling does.
2020-01-31 15:13:47 +01:00
Wim Taymans
ffc50a1bbf tests: make test work on 32 bits 2020-01-15 20:53:47 +01:00
Wim Taymans
f649c6f3c1 tests: pass the right type to SPA_POD_Long() 2020-01-15 16:39:00 +01:00
Wim Taymans
4e8d85da2f Fix some unit test
Run abi checks only on x86_64 until we have sizes for more archs
Don't start a daemon in the tests because that would require
XDG_RUNTIME_DIR set
2020-01-15 13:23:49 +01:00