diff --git a/config.h.in b/config.h.in index 27b06c306afdd8004733223619f84bf3b52267aa..016f10f0b47465f1eec546616b0b155d90e0fde7 100644 --- a/config.h.in +++ b/config.h.in @@ -7,6 +7,7 @@ #define _SRT_SONAME "libsteam-runtime-tools-@api_major@.so.@abi_major" #define _GNU_SOURCE 1 #mesondefine _SRT_MULTIARCH +#mesondefine _SRT_TESTS_STRICT #mesondefine VERSION /* Allow using stuff from Flatpak with minimal modifications */ diff --git a/meson.build b/meson.build index fcf4b0e60092bc0f8732d260466bfcb5c3b0da34..346cc565febface673b0fa1073aff7f3fe27c3c3 100644 --- a/meson.build +++ b/meson.build @@ -262,10 +262,17 @@ elif host_machine.cpu_family() == 'x86' multiarch = 'i386-linux-gnu' elif host_machine.cpu_family() == 'aarch64' and host_machine.endian() == 'little' multiarch = 'aarch64-linux-gnu' +elif get_option('werror') + # Some of our test coverage is skipped if we don't know the multiarch tuple + error('-Dmultiarch_tuple is required when building with --werror on an unknown CPU') else multiarch = '' endif +if get_option('werror') + conf_data.set('_SRT_TESTS_STRICT', true) +endif + if multiarch != '' conf_data.set_quoted('_SRT_MULTIARCH', multiarch) endif diff --git a/tests/pressure-vessel/adverb-preload.c b/tests/pressure-vessel/adverb-preload.c index fbe595a5dbb81fb7ce0487e8269a8ea55820eeca..6078455a09ea49ac62fed49220b1e5dea7e66e9d 100644 --- a/tests/pressure-vessel/adverb-preload.c +++ b/tests/pressure-vessel/adverb-preload.c @@ -46,6 +46,13 @@ setup (Fixture *f, if (config->can_discover_platform) { f->lib_temp_dirs = pv_per_arch_dirs_new (&local_error); +#ifdef _SRT_TESTS_STRICT + /* We allow this to fail because it might fail on particularly strange + * OS configurations, but for platforms we actively support, + * we expect it to work */ + g_assert_no_error (local_error); + g_assert_nonnull (f->lib_temp_dirs); +#endif if (f->lib_temp_dirs == NULL) { diff --git a/tests/pressure-vessel/adverb-sdl.c b/tests/pressure-vessel/adverb-sdl.c index d6fde6ef8382bbc0591199b871ee950757854901..207f3c4b877ff37c9d00a225ab2e6210b91ee9ad 100644 --- a/tests/pressure-vessel/adverb-sdl.c +++ b/tests/pressure-vessel/adverb-sdl.c @@ -43,6 +43,13 @@ setup (Fixture *f, f->old_fds = tests_check_fd_leaks_enter (); f->bwrap = flatpak_bwrap_new (flatpak_bwrap_empty_env); f->lib_temp_dirs = pv_per_arch_dirs_new (&f->lib_temp_dirs_error); +#ifdef _SRT_TESTS_STRICT + /* We allow this to fail because it might fail on particularly strange + * OS configurations, but for platforms we actively support, + * we expect it to work */ + g_assert_no_error (f->lib_temp_dirs_error); + g_assert_nonnull (f->lib_temp_dirs); +#endif if (f->lib_temp_dirs != NULL) { diff --git a/tests/utils.c b/tests/utils.c index 270daf4fca94fec5dfa8434dd8fb8cb9dd7b52d6..8fbb2e9138b5e9fdd02dfff0c6aca8901fe6d713 100644 --- a/tests/utils.c +++ b/tests/utils.c @@ -1434,6 +1434,11 @@ test_recursive_list (Fixture *f, } else { +#ifdef _SRT_TESTS_STRICT + /* We expect this to exist in our official CI, + * so make the test fail if it doesn't. */ + g_warning ("/dev/pts doesn't exist or isn't a directory"); +#endif /* This could conceivably be false in some containers. * Mark the test as skipped but intentionally don't early-return * here: we can still check for /dev/stderr. */ @@ -1450,6 +1455,11 @@ test_recursive_list (Fixture *f, } else { +#ifdef _SRT_TESTS_STRICT + /* We expect this to exist in our official CI, + * so make the test fail if it doesn't. */ + g_warning ("/dev/stderr isn't a symlink"); +#endif /* This could conceivably be false in some containers. * Again, intentionally not early-returning here. */ g_test_skip ("/dev/stderr isn't a symlink");