diff --git a/tests/pressure-vessel/wrap-setup.c b/tests/pressure-vessel/wrap-setup.c index ea708c14f25af266436dba5f9bf6c93a45fe30cc..fad380efb8d9e2c1c536c8e424492203f3562cf6 100644 --- a/tests/pressure-vessel/wrap-setup.c +++ b/tests/pressure-vessel/wrap-setup.c @@ -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); }