Run RISCOF test suite via nix on normal builds
This commit is contained in:
parent
3888a0d65a
commit
73ddd6c5e2
3 changed files with 45 additions and 12 deletions
20
flake.lock
20
flake.lock
|
@ -15,9 +15,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"riscv-arch-test": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1719853882,
|
||||
"narHash": "sha256-SSsRbutbJb5c9dn3cL5ocOtx/fYn9Ygjp5w4sBwP50U=",
|
||||
"owner": "riscv",
|
||||
"repo": "riscv-arch-test",
|
||||
"rev": "eb66181dd27ff7847e2c3a010705b13490b0bf75",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "riscv",
|
||||
"repo": "riscv-arch-test",
|
||||
"rev": "eb66181dd27ff7847e2c3a010705b13490b0bf75",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"riscv-arch-test": "riscv-arch-test"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
18
flake.nix
18
flake.nix
|
@ -4,10 +4,14 @@
|
|||
# Flake inputs
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs"; # also valid: "nixpkgs";
|
||||
riscv-arch-test = {
|
||||
url = "github:riscv/riscv-arch-test?rev=eb66181dd27ff7847e2c3a010705b13490b0bf75";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Flake outputs
|
||||
outputs = { self, nixpkgs }:
|
||||
outputs = { self, nixpkgs, riscv-arch-test }:
|
||||
let
|
||||
# Systems supported
|
||||
allSystems = [
|
||||
|
@ -21,22 +25,16 @@
|
|||
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
});
|
||||
riscv-pkgs = import nixpkgs {
|
||||
localSystem = "x86_64-linux";
|
||||
crossSystem = {
|
||||
config = "riscv32-unknown-linux-gnu";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = forAllSystems( {pkgs}:
|
||||
{
|
||||
lisp = (pkgs.callPackage ./rve.nix {riscv-pkgs=riscv-pkgs;});
|
||||
default = (pkgs.callPackage ./rve.nix {riscv-pkgs=riscv-pkgs;});
|
||||
lisp = (pkgs.callPackage ./rve.nix {riscv-arch-test=riscv-arch-test;});
|
||||
default = (pkgs.callPackage ./rve.nix {riscv-arch-test=riscv-arch-test;});
|
||||
}
|
||||
);
|
||||
overlays.default = final: prev: {
|
||||
lisp = (prev.callPackage ./rve.nix {riscv-pkgs=riscv-pkgs;});
|
||||
lisp = (prev.callPackage ./rve.nix {riscv-arch-test=riscv-arch-test;});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
19
rve.nix
19
rve.nix
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, stdenv, riscv-pkgs }:
|
||||
{ pkgs, stdenv, riscv-arch-test }:
|
||||
pkgs.gcc13Stdenv.mkDerivation rec {
|
||||
pname = "rve";
|
||||
version = "0.1.0";
|
||||
|
@ -38,6 +38,23 @@ pkgs.gcc13Stdenv.mkDerivation rec {
|
|||
ln -s build/compile_commands.json compile_commands.json
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
export PATH=`pwd`:$PATH
|
||||
cd ../test
|
||||
riscof run --config=config.ini \
|
||||
--suite=${riscv-arch-test}/riscv-test-suite \
|
||||
--env=${riscv-arch-test}/riscv-test-suite/env \
|
||||
--no-browser 2>report.txt
|
||||
# This is needed because `riscof` doesn't return
|
||||
# error code on failed tests
|
||||
if [ ! -z "$(grep ERROR report.txt)" ]; then
|
||||
cat report.txt
|
||||
echo "Some of the RISCOF tests failed"
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
src = ./.;
|
||||
|
|
Loading…
Reference in a new issue