File: test-support.c

package info (click to toggle)
pipewire 1.4.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,892 kB
  • sloc: ansic: 296,152; cpp: 2,815; xml: 407; python: 234; sh: 211; makefile: 168; pascal: 85
file content (68 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2021 Red Hat, Inc. */
/* SPDX-License-Identifier: MIT */

#include "pwtest.h"

#include <spa/utils/names.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>

PWTEST(pwtest_load_nonexisting)
{
	struct pwtest_spa_plugin *plugin;
	void *iface;

	plugin = pwtest_spa_plugin_new();

	pwtest_neg_errno_check(
		pwtest_spa_plugin_try_load_interface(plugin, &iface,
					"support/does_not_exist",
					SPA_NAME_SUPPORT_LOG, SPA_TYPE_INTERFACE_Log,
					NULL),
		-ENOENT);

	pwtest_neg_errno_check(
		pwtest_spa_plugin_try_load_interface(plugin, &iface,
					"support/libspa-support",
					"foo.bar", SPA_TYPE_INTERFACE_Log,
					NULL),
		-EINVAL);

	pwtest_neg_errno_check(
		pwtest_spa_plugin_try_load_interface(plugin, &iface,
					"support/libspa-support",
					SPA_NAME_SUPPORT_LOG,
					"foo", NULL),
		-ENOSYS);

	pwtest_spa_plugin_destroy(plugin);

	return PWTEST_PASS;
}

PWTEST(pwtest_load_plugin)
{
	struct pwtest_spa_plugin *plugin;
	void *iface;

	plugin = pwtest_spa_plugin_new();

	pwtest_neg_errno_ok(
		pwtest_spa_plugin_try_load_interface(plugin, &iface,
					"support/libspa-support",
					SPA_NAME_SUPPORT_LOG, SPA_TYPE_INTERFACE_Log,
					NULL)
		);

	pwtest_spa_plugin_destroy(plugin);
	return PWTEST_PASS;
}

PWTEST_SUITE(support)
{
	pwtest_add(pwtest_load_nonexisting, PWTEST_NOARG);
	pwtest_add(pwtest_load_plugin, PWTEST_NOARG);

	return PWTEST_PASS;
}