mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-17 11:28:10 +02:00
lua tests: give a label to the current Lua script tests
This allows for Lua test scripts to be grouped into a label. So that they can be treated different in terms of the init infrastructure that the script-tester lays out for those tests.
This commit is contained in:
parent
81c468cf23
commit
5dcdad4db7
2 changed files with 14 additions and 11 deletions
|
|
@ -22,42 +22,42 @@ script_tester = executable('script-tester',
|
|||
test(
|
||||
'test-lua-pod',
|
||||
script_tester,
|
||||
args: ['pod.lua'],
|
||||
args: ['lua-api-tests', 'pod.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
test(
|
||||
'test-lua-json',
|
||||
script_tester,
|
||||
args: ['json.lua'],
|
||||
args: ['lua-api-tests', 'json.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
test(
|
||||
'test-lua-monitor-rules',
|
||||
script_tester,
|
||||
args: ['monitor-rules.lua'],
|
||||
args: ['lua-api-tests', 'monitor-rules.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
test(
|
||||
'test-lua-require',
|
||||
script_tester,
|
||||
args: ['require.lua'],
|
||||
args: ['lua-api-tests', 'require.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
test(
|
||||
'test-lua-async-activation',
|
||||
script_tester,
|
||||
args: ['async-activation.lua'],
|
||||
args: ['lua-api-tests', 'async-activation.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
test(
|
||||
'test-lua-settings',
|
||||
script_tester,
|
||||
args: ['settings.lua'],
|
||||
args: ['lua-api-tests', 'settings.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
test(
|
||||
'test-lua-event-hooks',
|
||||
script_tester,
|
||||
args: ['event-hooks.lua'],
|
||||
args: ['lua-api-tests', 'event-hooks.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,11 +30,14 @@ script_runner_teardown (ScriptRunnerFixture *f, gconstpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
script_run (ScriptRunnerFixture *f, gconstpointer data)
|
||||
script_run (ScriptRunnerFixture *f, gconstpointer argv)
|
||||
{
|
||||
g_autoptr (WpPlugin) plugin = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autofree gchar *pluginname = NULL;
|
||||
gchar **args = (gchar **) argv;
|
||||
gchar *test_type = args [1];
|
||||
gchar *test_script = args [2];
|
||||
|
||||
/* TODO: we could do some more stuff here to provide the test script with an
|
||||
API to deal with the main loop and test asynchronous stuff, if necessary */
|
||||
|
|
@ -60,11 +63,11 @@ script_run (ScriptRunnerFixture *f, gconstpointer data)
|
|||
NULL, (GAsyncReadyCallback) test_object_activate_finish_cb, f);
|
||||
g_main_loop_run (f->base.loop);
|
||||
}
|
||||
wp_core_load_component (f->base.core, (const gchar *) data, "script/lua",
|
||||
wp_core_load_component (f->base.core, (const gchar *) test_script, "script/lua",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
pluginname = g_strdup_printf ("script:%s", (const gchar *) data);
|
||||
pluginname = g_strdup_printf ("script:%s", (const gchar *) test_script);
|
||||
|
||||
plugin = wp_plugin_find (f->base.core, pluginname);
|
||||
g_assert_nonnull (plugin);
|
||||
|
|
@ -81,7 +84,7 @@ main (gint argc, gchar *argv[])
|
|||
|
||||
g_assert_cmpint (argc, >=, 1);
|
||||
|
||||
g_test_add ("/lua/script/run", ScriptRunnerFixture, argv[1],
|
||||
g_test_add ("/lua/script/run", ScriptRunnerFixture, argv,
|
||||
script_runner_setup, script_run, script_runner_teardown);
|
||||
|
||||
return g_test_run ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue