spike: move test to installCheck phase (#143832)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

authored by

Julian Stecklina
Sandro
and committed by
GitHub
6204fa6c a325e50c

+15 -27
-1
nixos/tests/all-tests.nix
··· 418 418 sonarr = handleTest ./sonarr.nix {}; 419 419 spacecookie = handleTest ./spacecookie.nix {}; 420 420 spark = handleTestOn ["x86_64-linux"] ./spark {}; 421 - spike = handleTest ./spike.nix {}; 422 421 sslh = handleTest ./sslh.nix {}; 423 422 sssd = handleTestOn ["x86_64-linux"] ./sssd.nix {}; 424 423 sssd-ldap = handleTestOn ["x86_64-linux"] ./sssd-ldap.nix {};
-22
nixos/tests/spike.nix
··· 1 - import ./make-test-python.nix ({ pkgs, ... }: 2 - 3 - let 4 - riscvPkgs = import ../.. { crossSystem = pkgs.lib.systems.examples.riscv64-embedded; }; 5 - in 6 - { 7 - name = "spike"; 8 - meta = with pkgs.lib.maintainers; { maintainers = [ blitz ]; }; 9 - 10 - machine = { pkgs, lib, ... }: { 11 - environment.systemPackages = [ pkgs.spike riscvPkgs.riscv-pk riscvPkgs.hello ]; 12 - }; 13 - 14 - # Run the RISC-V hello applications using the proxy kernel on the 15 - # Spike emulator and see whether we get the expected output. 16 - testScript = 17 - '' 18 - machine.wait_for_unit("multi-user.target") 19 - output = machine.succeed("spike -m64 $(which pk) $(which hello)") 20 - assert "Hello, world!" in output 21 - ''; 22 - })
+15 -4
pkgs/applications/virtualization/spike/default.nix
··· 1 - { lib, stdenv, fetchgit, dtc, nixosTests, fetchpatch }: 1 + { lib, stdenv, fetchgit, dtc, fetchpatch }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "spike"; ··· 28 28 29 29 doCheck = true; 30 30 31 - passthru.tests = { 32 - can-run-hello-world = nixosTests.spike; 33 - }; 31 + # To test whether spike is working, we run the RISC-V hello applications using the RISC-V proxy 32 + # kernel on the Spike emulator and see whether we get the expected output. 33 + doInstallCheck = true; 34 + installCheckPhase = 35 + let 36 + riscvPkgs = import ../../../.. { crossSystem = lib.systems.examples.riscv64-embedded; }; 37 + in 38 + '' 39 + runHook preInstallCheck 40 + 41 + $out/bin/spike -m64 ${riscvPkgs.riscv-pk}/bin/pk ${riscvPkgs.hello}/bin/hello | grep -Fq "Hello, world" 42 + 43 + runHook postInstallCheck 44 + ''; 34 45 35 46 meta = with lib; { 36 47 description = "A RISC-V ISA Simulator";