diff --git a/tests/fake-steam-runtime/usr/lib/steamrt/expectations/i386-linux-gnu/libglib2.0-0.symbols b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/i386-linux-gnu/libglib2.0-0.symbols new file mode 100644 index 0000000000000000000000000000000000000000..17fc854ac6138920c30c24ddbc20ce719c88917f --- /dev/null +++ b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/i386-linux-gnu/libglib2.0-0.symbols @@ -0,0 +1,11 @@ +# 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 diff --git a/tests/fake-steam-runtime/usr/lib/steamrt/expectations/i386-linux-gnu/zlib1g.symbols b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/i386-linux-gnu/zlib1g.symbols new file mode 100644 index 0000000000000000000000000000000000000000..63be790e3612555c3aae70b905be7b349964ee34 --- /dev/null +++ b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/i386-linux-gnu/zlib1g.symbols @@ -0,0 +1,4 @@ +# 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 diff --git a/tests/fake-steam-runtime/usr/lib/steamrt/expectations/x86_64-linux-gnu/libglib2.0-0.symbols b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/x86_64-linux-gnu/libglib2.0-0.symbols new file mode 100644 index 0000000000000000000000000000000000000000..17fc854ac6138920c30c24ddbc20ce719c88917f --- /dev/null +++ b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/x86_64-linux-gnu/libglib2.0-0.symbols @@ -0,0 +1,11 @@ +# 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 diff --git a/tests/fake-steam-runtime/usr/lib/steamrt/expectations/x86_64-linux-gnu/zlib1g.symbols b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/x86_64-linux-gnu/zlib1g.symbols new file mode 100644 index 0000000000000000000000000000000000000000..63be790e3612555c3aae70b905be7b349964ee34 --- /dev/null +++ b/tests/fake-steam-runtime/usr/lib/steamrt/expectations/x86_64-linux-gnu/zlib1g.symbols @@ -0,0 +1,4 @@ +# 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 diff --git a/tests/meson.build b/tests/meson.build index de2c93df2b67e2029951d62e3cb5d9314750aea7..53a323a8aaf07477412fdbcad6ae68cad1947451 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -47,6 +47,7 @@ tests_metadir = join_paths( install_subdir('expectations', 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 exe = executable( diff --git a/tests/system-info.c b/tests/system-info.c index 936882a2195d334efbd276205c731b1ed69e93be..afe4d58b1c1a9da6bc8c40b04630d6eb941dcda9 100644 --- a/tests/system-info.c +++ b/tests/system-info.c @@ -286,6 +286,44 @@ libraries_presence (Fixture *f, 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 check_library_result (SrtLibrary *library) { @@ -652,6 +690,8 @@ main (int argc, setup, test_object, teardown); g_test_add ("/system-info/libraries_presence", Fixture, NULL, 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, setup, library_presence, teardown); g_test_add ("/system-info/libraries_missing", Fixture, NULL,