[glib/wip/smcv/aligned-alloc-tests: 3/3] tests: Don't test invalid aligned allocations if avoiding UB




commit b0f686a00edd90341619ebcb758938b57bde67f0
Author: Simon McVittie <smcv collabora com>
Date:   Tue Feb 15 10:56:59 2022 +0000

    tests: Don't test invalid aligned allocations if avoiding UB
    
    We can't exercise precondition check failures if GLib was (inadvisably)
    compiled with -Dglib_checks=false, and we shouldn't necessarily exercise
    precondition check failures when using QA tools like valgrind, so skip
    these tests if run with -m no-undefined.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 glib/tests/utils.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/glib/tests/utils.c b/glib/tests/utils.c
index e712062f4..0b4782fcf 100644
--- a/glib/tests/utils.c
+++ b/glib/tests/utils.c
@@ -965,6 +965,7 @@ test_aligned_mem (void)
   g_assert_null (a);
 
 #define CHECK_SUBPROCESS_FAIL(name,msg) do { \
+      if (g_test_undefined ()) \
         { \
           g_test_message (msg); \
           g_test_trap_subprocess ("/utils/aligned-mem/subprocess/" #name, 0, 0); \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]