3
0
Fork 0
forked from mirrors/nixpkgs

spike: move test to installCheck phase (#143832)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Julian Stecklina 2021-11-01 21:26:38 +01:00 committed by GitHub
parent a325e50cff
commit 6204fa6c7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 27 deletions

View file

@ -418,7 +418,6 @@ in
sonarr = handleTest ./sonarr.nix {};
spacecookie = handleTest ./spacecookie.nix {};
spark = handleTestOn ["x86_64-linux"] ./spark {};
spike = handleTest ./spike.nix {};
sslh = handleTest ./sslh.nix {};
sssd = handleTestOn ["x86_64-linux"] ./sssd.nix {};
sssd-ldap = handleTestOn ["x86_64-linux"] ./sssd-ldap.nix {};

View file

@ -1,22 +0,0 @@
import ./make-test-python.nix ({ pkgs, ... }:
let
riscvPkgs = import ../.. { crossSystem = pkgs.lib.systems.examples.riscv64-embedded; };
in
{
name = "spike";
meta = with pkgs.lib.maintainers; { maintainers = [ blitz ]; };
machine = { pkgs, lib, ... }: {
environment.systemPackages = [ pkgs.spike riscvPkgs.riscv-pk riscvPkgs.hello ];
};
# Run the RISC-V hello applications using the proxy kernel on the
# Spike emulator and see whether we get the expected output.
testScript =
''
machine.wait_for_unit("multi-user.target")
output = machine.succeed("spike -m64 $(which pk) $(which hello)")
assert "Hello, world!" in output
'';
})

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchgit, dtc, nixosTests, fetchpatch }:
{ lib, stdenv, fetchgit, dtc, fetchpatch }:
stdenv.mkDerivation rec {
pname = "spike";
@ -28,9 +28,20 @@ stdenv.mkDerivation rec {
doCheck = true;
passthru.tests = {
can-run-hello-world = nixosTests.spike;
};
# To test whether spike is working, we run the RISC-V hello applications using the RISC-V proxy
# kernel on the Spike emulator and see whether we get the expected output.
doInstallCheck = true;
installCheckPhase =
let
riscvPkgs = import ../../../.. { crossSystem = lib.systems.examples.riscv64-embedded; };
in
''
runHook preInstallCheck
$out/bin/spike -m64 ${riscvPkgs.riscv-pk}/bin/pk ${riscvPkgs.hello}/bin/hello | grep -Fq "Hello, world"
runHook postInstallCheck
'';
meta = with lib; {
description = "A RISC-V ISA Simulator";