From 46f5689c73b2b00a91ac26aed92a4ec9057ff3d2 Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Tue, 9 Apr 2024 14:29:58 -0700 Subject: [PATCH] cling: add a smoke test --- .../interpreters/cling/default.nix | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/pkgs/development/interpreters/cling/default.nix b/pkgs/development/interpreters/cling/default.nix index a5a3de81bd5a..2f3327b0554a 100644 --- a/pkgs/development/interpreters/cling/default.nix +++ b/pkgs/development/interpreters/cling/default.nix @@ -155,11 +155,41 @@ let in -runCommand "cling-${unwrapped.version}" { +stdenv.mkDerivation { + pname = "cling"; + version = unwrapped.version; + nativeBuildInputs = [ makeWrapper ]; inherit unwrapped flags; inherit (unwrapped) meta; -} '' - makeWrapper $unwrapped/bin/cling $out/bin/cling \ - --add-flags "$flags" -'' + + dontUnpack = true; + dontConfigure = true; + + buildPhase = '' + runHook preBuild + + makeWrapper $unwrapped/bin/cling $out/bin/cling \ + --add-flags "$flags" + + runHook postBuild + ''; + + doCheck = true; + checkPhase = '' + runHook preCheck + + output=$($out/bin/cling < + std::cout << "hello world" << std::endl + EOF + ) + + echo "$output" | grep -q "Type C++ code and press enter to run it" + echo "$output" | grep -q "hello world" + + runHook postCheck + ''; + + dontInstall = true; +}