Debian Codegraph @

debian/patches/disable-memory-tests.patch

raw
1 From: Christopher Obbard <[email protected]>
2 Date: Fri, 14 Aug 2026 20:40:57 +0100
3 Subject: Disable the dlsym-based memory fault-injection tests
4
5 The upstream test suite interposes malloc(), memcpy(), memset() and
6 realloc() via dlsym(RTLD_NEXT, ...) in tests/vhdi_test_memory.c and
7 counts the calls made by the function under test, so that it can inject
8 a failure at the n-th call. Upstream itself notes in that file that this
9 "might fail if compiled with optimation and as a shared libary": when
10 the library is built optimised, fixed-size memory_copy() calls are
11 expanded inline as compiler builtins and never reach the interposer, so
12 the accounting drifts and the injected failure lands on an unrelated
13 memcpy() whose result nobody checks. The test then sees success where it
14 expects -1 and fails.
15
16 This has been worked around per-architecture since #978528, most
17 recently disabling the tests on alpha, arm64, powerpc, ppc64, ppc64el,
18 riscv64 and s390x. With the current toolchain in unstable amd64 fails
19 the same way:
20
21 vhdi_test_dynamic_disk_header.c:561 result (1) != -1
22 Unable to run test: libvhdi_dynamic_disk_header_read_data
23 Testing: dynamic_disk_header (FAIL)
24
25 Since the architecture blocklist has to be extended on every toolchain
26 change and these tests only exercise upstream's own out-of-memory error
27 paths rather than anything about the shipped library, disable them
28 everywhere instead.
29
30 Original patch by Aurelien Jarno <[email protected]>.
31
32 Author: Christopher Obbard <[email protected]>
33 Bug-Debian: https://bugs.debian.org/978528
34 Bug-Debian: https://bugs.debian.org/1143760
35 Forwarded: not-needed
36 Last-Update: 2026-08-14
37
38 Signed-off-by: Christopher Obbard <[email protected]>
39 ---
40 tests/vhdi_test_memory.h | 2 +-
41 1 file changed, 1 insertion(+), 1 deletion(-)
42
43 diff --git a/tests/vhdi_test_memory.h b/tests/vhdi_test_memory.h
44 index 529f1c1..c2734f6 100644
45 --- a/tests/vhdi_test_memory.h
46 +++ b/tests/vhdi_test_memory.h
47 @@ -28,7 +28,7 @@
48 extern "C" {
49 #endif
50
51 -#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN )
52 +#if 0
53 #define HAVE_VHDI_TEST_MEMORY 1
54 #endif
55