From a23fbeb6e8d5c7f35c9feba25da0061ebcf79efe Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 14 May 2022 03:09:20 +0300 Subject: [PATCH] testers.testVersion: if grep failed then print the output of the command --- pkgs/build-support/testers/default.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix index 3ab97760e72..020352836c8 100644 --- a/pkgs/build-support/testers/default.nix +++ b/pkgs/build-support/testers/default.nix @@ -9,10 +9,19 @@ version ? package.version, }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } '' if output=$(${command} 2>&1); then - grep -Fw "${version}" - <<< "$output" - touch $out + if grep -Fw "${version}" - <<< "$output"; then + touch $out + else + echo "Version string '${version}' not found!" >&2 + echo "The output was:" >&2 + echo "$output" >&2 + exit 1 + fi else - echo "$output" >&2 && exit 1 + echo -n ${lib.escapeShellArg command} >&2 + echo " returned a non-zero exit code." >&2 + echo "$output" >&2 + exit 1 fi '';