1
0
Fork 0

stm32: add checkPhase to thermostat

This commit is contained in:
Astro 2020-09-18 01:14:45 +02:00
parent 5ba0896be6
commit 7c7c0cb58d
1 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,7 @@ let
rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix { rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix {
inherit rustManifest; inherit rustManifest;
}); });
buildStm32Firmware = { name, src, patchPhase ? "" }: buildStm32Firmware = { name, src, patchPhase ? "", checkPhase ? "" }:
let let
cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''cp "${src}/cargosha256.nix" $out''; cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''cp "${src}/cargosha256.nix" $out'';
in in
@ -26,7 +26,7 @@ let
cargo build --release cargo build --release
''; '';
doCheck = false; inherit checkPhase;
installPhase = '' installPhase = ''
mkdir -p $out $out/nix-support mkdir -p $out $out/nix-support
cp target/thumbv7em-none-eabihf/release/${name} $out/${name}.elf cp target/thumbv7em-none-eabihf/release/${name} $out/${name}.elf
@ -49,5 +49,8 @@ in
thermostat = buildStm32Firmware { thermostat = buildStm32Firmware {
name = "thermostat"; name = "thermostat";
src = <thermostatSrc>; src = <thermostatSrc>;
checkPhase = ''
cargo test --target=${pkgs.rust.toRustTarget pkgs.stdenv.targetPlatform}
'';
}; };
} }