forked from runtimeverification/llvm-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.nix
46 lines (36 loc) · 950 Bytes
/
test.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
let
sources = import ./nix/sources.nix;
pinned = import sources."nixpkgs" { config = {}; overlays = []; };
in
{ pkgs ? pinned }:
let
inherit (pkgs) stdenv;
inherit (pkgs) diffutils;
default = import ./. { inherit pkgs; };
inherit (default) llvm-backend llvm-kompile-testing;
in
stdenv.mkDerivation {
name = "llvm-backend-test";
src = llvm-backend.src;
preferLocalBuild = true;
buildInputs = [
diffutils # for golden testing
llvm-kompile-testing # for constructing test input without the frontend
llvm-backend # the system under test
];
configurePhase = "true";
buildPhase = ''
runHook preBuild
mkdir -p build; cd build
cp ../test/Makefile .
make KOMPILE=llvm-kompile-testing clean
make KOMPILE=llvm-kompile-testing -O -j$NIX_MAX_JOBS
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -a -t "$out" .
runHook postInstall
'';
}