From e233ccb7a0f6455104730eca306fb8a59f23afa0 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 21 Sep 2024 21:16:26 +0100 Subject: [PATCH] cvise: explicitly point to `clang-format` Without the cnage `cvise` fails to normalize sources with `clang-format` and produces less than ideal intermediate sources to lines-based pass. That affects reduction speed among other things. Before the change `cvise` complained as: $ cvise --command 'grep foo a.c' a.c 00:00:00 INFO Using temporary interestingness test: /tmp/tmp4a_4wut0.sh 00:00:00 ERROR cannot find external program clang-format 00:00:00 ERROR Prereqs not found for pass IndentPass::regular After the change `clang-format` is found: $ result/bin/cvise --command 'grep foo a.c' a.c 00:00:00 INFO Using temporary interestingness test: /tmp/tmpudipespb.sh 00:00:00 INFO ===< 1539388 >=== While at it used `--replace-fail`. --- pkgs/development/tools/misc/cvise/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/misc/cvise/default.nix b/pkgs/development/tools/misc/cvise/default.nix index 228f8ed98a67..d74dfaa7e760 100644 --- a/pkgs/development/tools/misc/cvise/default.nix +++ b/pkgs/development/tools/misc/cvise/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonApplication , fetchFromGitHub +, clang-tools , cmake , colordiff , flex @@ -34,11 +35,11 @@ buildPythonApplication rec { # Avoid blanket -Werror to evade build failures on less # tested compilers. substituteInPlace CMakeLists.txt \ - --replace " -Werror " " " + --replace-fail " -Werror " " " substituteInPlace cvise/utils/testing.py \ - --replace "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \ - --replace "'colordiff'" "'${colordiff}/bin/colordiff'" + --replace-fail "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \ + --replace-fail "'colordiff'" "'${colordiff}/bin/colordiff'" ''; nativeBuildInputs = [ @@ -65,6 +66,12 @@ buildPythonApplication rec { unifdef ]; + cmakeFlags = [ + # By default `cvise` looks it up in `llvm` bin directory. But + # `nixpkgs` moves it into a separate derivation. + "-DCLANG_FORMAT_PATH=${clang-tools}/bin/clang-format" + ]; + disabledTests = [ # Needs gcc, fails when run noninteractively (without tty). "test_simple_reduction"