Merge pull request #302949 from codedownio/cling-smoke-test

cling: add a smoke test
This commit is contained in:
Weijia Wang 2024-04-11 10:28:31 +02:00 committed by GitHub
commit 6265d8dd7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 <<EOF
#include <iostream>
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;
}