From 2393d6ff328ab6e18f05b52fe56224dc577bbbf0 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 1 Mar 2026 11:32:51 -0800 Subject: [PATCH] bogofilter: fix and run tests They were failing previously because the bogofilter test suite passes $VERBOSE as a flag to bash, which won't work if VERBOSE is set to `y`. Additionally, the bogofilter test suite hard-codes the path for grep, so we have to patch that. --- pkgs/by-name/bo/bogofilter/package.nix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/bo/bogofilter/package.nix b/pkgs/by-name/bo/bogofilter/package.nix index e81a232154f3..eb079a8625a1 100644 --- a/pkgs/by-name/bo/bogofilter/package.nix +++ b/pkgs/by-name/bo/bogofilter/package.nix @@ -2,11 +2,13 @@ lib, stdenv, fetchurl, - flex, db, + flex, + gnugrep, makeWrapper, pax, perl, + valgrind, database ? db, }: @@ -22,6 +24,12 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-MkihNzv/VSxQCDStvqS2yu4EIkUWrlgfslpMam3uieo="; }; + # bogofilter's test-cases hard-code the search path for grep. + postPatch = '' + substituteInPlace ./src/tests/t.frame \ + --replace-fail 'GREP=/bin/grep' 'GREP=${lib.getExe gnugrep}' + ''; + nativeBuildInputs = [ makeWrapper ]; buildInputs = [ @@ -34,7 +42,16 @@ stdenv.mkDerivation (finalAttrs: { "--with-database=${dbName}" ]; - doCheck = false; # needs "y" tool + nativeCheckInputs = [ + valgrind + ]; + + doCheck = true; + checkFlags = [ + "BF_RUN_VALGRIND=1" + "BF_CHECKTOOL=glibc" + "VERBOSE=-x" + ]; postInstall = '' wrapProgram "$out/bin/bf_tar" --prefix PATH : "${lib.makeBinPath [ pax ]}"