Skip to content

Commit

Permalink
Add script to run all rust test
Browse files Browse the repository at this point in the history
  • Loading branch information
szg251 committed Feb 8, 2025
1 parent df6df3d commit 64923fb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion flake-lang/rust/flake-rust.nix
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,22 @@ in
"${crateName}-rust-test" = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
doCheck = false;
buildInputs = [ pkgs.bash ];
cargoExtraArgs = cargoNextestExtraArgs + " --tests";
nativeBuildInputs = commonArgs.nativeBuildInputs ++ testTools ++ [ pkgs.jq ];
installPhaseCommand = ''
files=$(cat $cargoBuildLog | jq 'select(.target.kind | . != null and contains(["test"])).executable')
files=$(cat $cargoBuildLog | jq -r 'select(.target.kind | . != null and contains(["test"])).executable')
mkdir -p $out/bin
echo $files | xargs -r mv -t $out/bin
echo "#!${pkgs.bash}/bin/bash" > $out/bin/run_tests.sh
echo "set -e" >> $out/bin/run_tests.sh
for file in $files; do
echo $out/bin/$(basename $file) >> $out/bin/run_tests.sh
done
chmod a+x $out/bin/run_tests.sh
'';
});
}) // {
Expand Down

0 comments on commit 64923fb

Please sign in to comment.