mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01:00
gtestutils: Default to -m no-undefined under AddressSanitizer
AddressSanitizer detects memory leaks, NULL parameters where only a non-NULL parameter is expected, and other suspicious behaviour, so if we try to test that sort of thing we can expect it to fail. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
98804781ce
commit
9fef98cf84
@ -309,8 +309,12 @@
|
||||
* behaviour, to verify that appropriate warnings are given. It might, in some
|
||||
* cases, be useful to turn this off with if running tests under valgrind;
|
||||
* in tests that use g_test_init(), the option `-m no-undefined` disables
|
||||
* those tests, while `-m undefined` explicitly enables them (the default
|
||||
* behaviour).
|
||||
* those tests, while `-m undefined` explicitly enables them (normally
|
||||
* the default behaviour).
|
||||
*
|
||||
* Since GLib 2.68, if GLib was compiled with gcc or clang and
|
||||
* [AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer)
|
||||
* is enabled, the default changes to not exercising undefined behaviour.
|
||||
*
|
||||
* Returns: %TRUE if tests may provoke programming errors
|
||||
*/
|
||||
@ -1573,6 +1577,10 @@ void
|
||||
g_return_if_fail (g_test_config_vars->test_initialized == FALSE);
|
||||
mutable_test_config_vars.test_initialized = TRUE;
|
||||
|
||||
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||
mutable_test_config_vars.test_undefined = FALSE;
|
||||
#endif
|
||||
|
||||
va_start (args, argv);
|
||||
while ((option = va_arg (args, char *)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user