mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 12:41:50 +01:00
tests: Don't test --external-data with toolchains that can't do the setup
There are several reasons why we might not be able to do the test setup for --external-data: non-Linux platform, missing ld or objcopy, objcopy doesn't support --add-symbol, or the CPU family is MIPS (on which cc -r does not necessarily emit the specific MIPS ABI flavour that we are targeting, for example different functionality levels or different NaN encodings). If we can't link in the test data, then obviously this test is not going to pass. It was already skipped on non-Linux, but not on platforms that hit one of the other reasons for the test setup to fail. In particular, this test failed on Debian mips64el since commit81059169
, which stopped linking the necessary resource on MIPS platforms, but continued to assert that the resource is present at runtime. Fixes:81059169
"GIO/tests: skip test_resources_binary on MIPS platform" Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3226 Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
parent
38f5ba3c2f
commit
fb5dd18f21
@ -934,9 +934,19 @@ if not meson.is_cross_build()
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and \
|
||||
objcopy.found() and objcopy_supports_add_symbol and ld.found() and \
|
||||
build_machine.cpu_family() not in ['mips', 'mips64']
|
||||
if build_machine.system() != 'linux'
|
||||
why_no_external_data = 'only works on Linux'
|
||||
elif not objcopy.found()
|
||||
why_no_external_data = 'objcopy not found'
|
||||
elif not objcopy_supports_add_symbol
|
||||
why_no_external_data = 'objcopy does not support --add-symbol'
|
||||
elif not ld.found()
|
||||
why_no_external_data = 'ld not found'
|
||||
elif build_machine.cpu_family() in ['mips', 'mips64']
|
||||
why_no_external_data = 'cc -r can produce a mismatched MIPS ABI family, see GNOME/glib!3640'
|
||||
else
|
||||
why_no_external_data = ''
|
||||
|
||||
test_gresource_binary = custom_target('test5.gresource',
|
||||
input : 'test5.gresource.xml',
|
||||
output : 'test5.gresource',
|
||||
@ -994,8 +1004,15 @@ if not meson.is_cross_build()
|
||||
]
|
||||
endif
|
||||
|
||||
resources_c_args = []
|
||||
|
||||
if why_no_external_data != ''
|
||||
resources_c_args += '-DNO_EXTERNAL_DATA="@0@"'.format(why_no_external_data)
|
||||
endif
|
||||
|
||||
gio_tests += {
|
||||
'resources' : {
|
||||
'c_args' : resources_c_args,
|
||||
'extra_sources' : resources_extra_sources,
|
||||
'depends' : resource_plugin,
|
||||
# FIXME: musl: https://gitlab.gnome.org/GNOME/glib/-/issues/3160
|
||||
|
@ -642,10 +642,10 @@ test_resource_manual2 (void)
|
||||
static void
|
||||
test_resource_binary_linked (void)
|
||||
{
|
||||
#ifndef __linux__
|
||||
g_test_skip ("--external-data test only works on Linux");
|
||||
#ifdef NO_EXTERNAL_DATA
|
||||
g_test_skip ("--external-data cannot be tested: " NO_EXTERNAL_DATA);
|
||||
return;
|
||||
#else /* if __linux__ */
|
||||
#else /* !NO_EXTERNAL_DATA */
|
||||
GError *error = NULL;
|
||||
gboolean found;
|
||||
gsize size;
|
||||
@ -669,7 +669,7 @@ test_resource_binary_linked (void)
|
||||
g_assert_cmpint (size, ==, 6);
|
||||
g_assert_cmpstr (g_bytes_get_data (data, NULL), ==, "test1\n");
|
||||
g_bytes_unref (data);
|
||||
#endif /* if __linux__ */
|
||||
#endif /* !NO_EXTERNAL_DATA */
|
||||
}
|
||||
|
||||
/* Test resource whose xml file starts with more than one digit
|
||||
|
Loading…
Reference in New Issue
Block a user