Skip to content
Snippets Groups Projects
Commit 2ef8d3fe authored by Simon McVittie's avatar Simon McVittie
Browse files

Add a unit test for auto-detecting expectations from STEAM_RUNTIME

parent fe4f23c8
No related branches found
No related tags found
No related merge requests found
Pipeline #1400 failed
# Cut-down version of libglib2.0-0:amd64.symbols, to illustrate what we expect
# to find here
libgio-2.0.so.0 libglib2.0-0 #MINVER#
* Build-Depends-Package: libglib2.0-dev
g_action_activate@Base 2.28.0
g_action_change_state@Base 2.30.0
libglib-2.0.so.0 libglib2.0-0 #MINVER#
* Build-Depends-Package: libglib2.0-dev
g_access@Base 2.12.0
g_allocator_free@Base 2.12.0
g_allocator_new@Base 2.12.0
# Cut-down version of zlib1g:amd64.symbols, to illustrate what we expect
# to find here
libz.so.1 zlib1g #MINVER#
adler32@Base 1:1.1.4
# Cut-down version of libglib2.0-0:amd64.symbols, to illustrate what we expect
# to find here
libgio-2.0.so.0 libglib2.0-0 #MINVER#
* Build-Depends-Package: libglib2.0-dev
g_action_activate@Base 2.28.0
g_action_change_state@Base 2.30.0
libglib-2.0.so.0 libglib2.0-0 #MINVER#
* Build-Depends-Package: libglib2.0-dev
g_access@Base 2.12.0
g_allocator_free@Base 2.12.0
g_allocator_new@Base 2.12.0
# Cut-down version of zlib1g:amd64.symbols, to illustrate what we expect
# to find here
libz.so.1 zlib1g #MINVER#
adler32@Base 1:1.1.4
...@@ -47,6 +47,7 @@ tests_metadir = join_paths( ...@@ -47,6 +47,7 @@ tests_metadir = join_paths(
install_subdir('expectations', install_dir : tests_dir) install_subdir('expectations', install_dir : tests_dir)
install_subdir('expectations_with_missings', install_dir : tests_dir) install_subdir('expectations_with_missings', install_dir : tests_dir)
install_subdir('fake-steam-runtime', install_dir : tests_dir)
foreach test_name : tests foreach test_name : tests
exe = executable( exe = executable(
......
...@@ -286,6 +286,44 @@ libraries_presence (Fixture *f, ...@@ -286,6 +286,44 @@ libraries_presence (Fixture *f,
g_object_unref (info); g_object_unref (info);
} }
/*
* Check that the expectations can be auto-detected from the
* `STEAM_RUNTIME` environment variable.
*/
static void
auto_expectations (Fixture *f,
gconstpointer context)
{
SrtSystemInfo *info;
gchar *steam_runtime = NULL;
GList *libraries = NULL;
SrtLibraryIssues issues;
gchar **env;
if (strcmp (_SRT_MULTIARCH, "") == 0)
{
g_test_skip ("Unsupported architecture");
return;
}
env = g_get_environ ();
steam_runtime = g_build_filename (f->srcdir, "fake-steam-runtime", NULL);
env = g_environ_setenv (env, "STEAM_RUNTIME", steam_runtime, TRUE);
info = srt_system_info_new (NULL);
srt_system_info_set_environ (info, env);
issues = srt_system_info_check_libraries (info,
_SRT_MULTIARCH,
&libraries);
g_assert_cmpint (issues, ==, SRT_LIBRARY_ISSUES_NONE);
check_libraries_result (libraries);
g_list_free_full (libraries, g_object_unref);
g_object_unref (info);
g_strfreev (env);
g_free (steam_runtime);
}
static void static void
check_library_result (SrtLibrary *library) check_library_result (SrtLibrary *library)
{ {
...@@ -652,6 +690,8 @@ main (int argc, ...@@ -652,6 +690,8 @@ main (int argc,
setup, test_object, teardown); setup, test_object, teardown);
g_test_add ("/system-info/libraries_presence", Fixture, NULL, g_test_add ("/system-info/libraries_presence", Fixture, NULL,
setup, libraries_presence, teardown); setup, libraries_presence, teardown);
g_test_add ("/system-info/auto_expectations", Fixture, NULL,
setup, auto_expectations, teardown);
g_test_add ("/system-info/library_presence", Fixture, NULL, g_test_add ("/system-info/library_presence", Fixture, NULL,
setup, library_presence, teardown); setup, library_presence, teardown);
g_test_add ("/system-info/libraries_missing", Fixture, NULL, g_test_add ("/system-info/libraries_missing", Fixture, NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment