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

tests: Test that LD_PRELOAD=libbasename.so is handled as expected

parent 8196049b
No related branches found
No related tags found
1 merge request!337pressure-vessel: Remap preloadable modules better
Pipeline #16568 passed
......@@ -222,6 +222,8 @@ populate_ld_preload (Fixture *f,
{ "/in-root-${FUTURE}.so" },
{ "./${RELATIVE}.so" },
{ "./relative.so" },
{ "libfakeroot.so" },
{ "libpthread.so.0" },
{
"/usr/local/lib/libgtk3-nocsd.so.0",
.warning = "Disabling gtk3-nocsd LD_PRELOAD: it is known to cause crashes.",
......@@ -373,6 +375,30 @@ test_remap_ld_preload (Fixture *f,
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=./relative.so");
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libfakeroot is not in the runtime or graphics stack provider, only
* the current namespace */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_64
"/libfakeroot.so:abi="
SRT_ABI_X86_64));
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_32
"/libfakeroot.so:abi="
SRT_ABI_I386));
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libpthread.so.0 *is* in the runtime, as we would expect */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=libpthread.so.0");
g_assert_cmpuint (argv->len, ==, i);
/* FlatpakExports never exports /app */
......@@ -520,6 +546,30 @@ test_remap_ld_preload_flatpak (Fixture *f,
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=./relative.so");
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libfakeroot is not in the runtime or graphics stack provider, only
* the current namespace */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_64
"/libfakeroot.so:abi="
SRT_ABI_X86_64));
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_32
"/libfakeroot.so:abi="
SRT_ABI_I386));
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libpthread.so.0 *is* in the runtime, as we would expect */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=libpthread.so.0");
g_assert_cmpuint (argv->len, ==, i);
}
......@@ -620,6 +670,30 @@ test_remap_ld_preload_no_runtime (Fixture *f,
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=./relative.so");
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libfakeroot is not in the runtime or graphics stack provider, only
* the current namespace */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_64
"/libfakeroot.so:abi="
SRT_ABI_X86_64));
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_32
"/libfakeroot.so:abi="
SRT_ABI_I386));
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libpthread.so.0 *is* in the runtime, as we would expect */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=libpthread.so.0");
g_assert_cmpuint (argv->len, ==, i);
/* FlatpakExports never exports /app */
......@@ -761,6 +835,30 @@ test_remap_ld_preload_flatpak_no_runtime (Fixture *f,
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=./relative.so");
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libfakeroot is not in the runtime or graphics stack provider, only
* the current namespace */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_64
"/libfakeroot.so:abi="
SRT_ABI_X86_64));
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==,
("--ld-preload=/path/to/"
MOCK_LIB_32
"/libfakeroot.so:abi="
SRT_ABI_I386));
/* Our mock implementation of pv_runtime_has_library() behaves as though
* libpthread.so.0 *is* in the runtime, as we would expect */
g_assert_cmpuint (argv->len, >, i);
g_assert_cmpstr (g_ptr_array_index (argv, i++),
==, "--ld-preload=libpthread.so.0");
g_assert_cmpuint (argv->len, ==, i);
}
......
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