sqlite: fix tests on musl

Since test failures now fail the build, pkgsMusl.sqlite fails in
checkPhase for two reasons:

- testrunner builds fuzzcheck-asan and fuzzcheck-ubsan, which cannot be
  linked because neither GCC's libsanitizer nor compiler-rt's sanitizers
  are built for musl. Exclude them with a testrunner pattern.

- capi3c.test, a copy of capi3.test, still runs the intentional
  use-after-free cases that upstream disabled in capi3.test because they
  occasionally segfault. musl's allocator makes them segfault reliably.
  Disable them the same way upstream did.

Assisted-by: Claude Code (claude-opus-5-5)
(cherry picked from commit a66e91bfe8)
This commit is contained in:
Philip Taron
2026-10-06 07:12:21 -07:00
committed by Michael Daniels
parent fd63ca2d4d
commit 1bc29c0e28

View File

@@ -110,6 +110,16 @@ stdenv.mkDerivation (finalAttrs: {
})
];
# capi3c.test is a copy of capi3.test, but upstream only disabled the
# intentional use-after-free cases in the original. They segfault with
# allocators that return freed memory to the OS eagerly, such as musl's.
${if stdenv.hostPlatform.isMusl then "postPatch" else null} = ''
substituteInPlace test/capi3c.test \
--replace-fail \
'if {[clang_sanitize_address]==0} {' \
'if {0 && [clang_sanitize_address]==0} {'
'';
buildInputs = [
zlib
]
@@ -199,6 +209,9 @@ stdenv.mkDerivation (finalAttrs: {
doCheck = stdenv.hostPlatform.isLinux;
# When tcl is not available, only run test targets that don't need it.
checkTarget = lib.optionalString stdenv.hostPlatform.isStatic "fuzztest sourcetest";
# Neither GCC's libsanitizer nor compiler-rt's sanitizers are built for
# musl, so the fuzzcheck-asan and fuzzcheck-ubsan programs cannot be linked.
${if stdenv.hostPlatform.isMusl then "checkFlags" else null} = [ "TSTRNNR_OPTS=~fuzzcheck-%san" ];
passthru = {
tests = {