-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
72 lines (56 loc) · 1.37 KB
/
default.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
let
pkgs = import <nixpkgs> { };
in {
default = pkgs.callPackage (
{ stdenv
, lib
, cmake
, toilet
, valgrind
}:
stdenv.mkDerivation rec {
pname = "libopenpmd";
version = "0.0.0-local";
src = ./.;
postUnpack = ''
rm -rf $sourceRoot/{.git,build}/
'';
nativeBuildInputs = [ cmake toilet valgrind ];
cmakeBuildType = "Debug";
cmakeFlags = [
# "-DUSE_LOWMEM=ON"
];
doCheck = true;
checkPhase = ''
print() {
toilet -f wideterm -F border $*
}
run_test() {
valgrind --leak-check=full --track-origins=yes -s $* 2>&1 | tee log
grep -q 'ERROR SUMMARY: 0 errors' log || exit 1
}
compare_two_hashes() {
hash1="$(sha256sum "$1")"
hash2="$(sha256sum "$2")"
echo $hash1
echo $hash2
if [[ "$(echo "$hash1" | cut -d' ' -f1)" != "$(echo "$hash2" | cut -d' ' -f1)" ]]; then
echo "Hashes don't match!"
exit 1
fi
}
print LOADTEST
run_test ./tools/loadtest ../examples/P86/RC1.P86
print COMPARING ORIGINAL AGAINST EXPORT TESTS
compare_two_hashes ../examples/P86/RC1.P86 TEST_MEM.P86
compare_two_hashes ../examples/P86/RC1.P86 TEST_FIL.P86
print P86EXTRACT
run_test ./tools/p86extract TEST_MEM.P86
print P86CREATE
run_test ./tools/p86create TEST_***.RAW
# print COMPARING HASHES
# compare_two_hashes TEST_MEM.P86 TEST.P86
'';
}
) { };
}