graphene-hardened-malloc: refactor
- use finalAttrs instead of lib.fix - use checkTarget
This commit is contained in:
parent
2c9ecd1f04
commit
2a619ae20e
|
@ -7,23 +7,21 @@
|
||||||
, stress-ng
|
, stress-ng
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.fix (self: stdenv.mkDerivation rec {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "graphene-hardened-malloc";
|
pname = "graphene-hardened-malloc";
|
||||||
version = "11";
|
version = "11";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "GrapheneOS";
|
owner = "GrapheneOS";
|
||||||
repo = "hardened_malloc";
|
repo = "hardened_malloc";
|
||||||
rev = version;
|
rev = finalAttrs.version;
|
||||||
sha256 = "sha256-BbjL0W12QXFmGCzFrFYY6CZZeFbUt0elCGhM+mbL/IU=";
|
sha256 = "sha256-BbjL0W12QXFmGCzFrFYY6CZZeFbUt0elCGhM+mbL/IU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
nativeCheckInputs = [ python3 ];
|
nativeCheckInputs = [ python3 ];
|
||||||
# these tests cover use as a build-time-linked library
|
# these tests cover use as a build-time-linked library
|
||||||
checkPhase = ''
|
checkTarget = "test";
|
||||||
make test
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -Dm444 -t $out/include include/*
|
install -Dm444 -t $out/include include/*
|
||||||
|
@ -38,8 +36,8 @@ lib.fix (self: stdenv.mkDerivation rec {
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
ld-preload-tests = stdenv.mkDerivation {
|
ld-preload-tests = stdenv.mkDerivation {
|
||||||
name = "${self.name}-ld-preload-tests";
|
name = "${finalAttrs.pname}-ld-preload-tests";
|
||||||
src = self.src;
|
inherit (finalAttrs) src;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
|
@ -66,13 +64,13 @@ lib.fix (self: stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
tests = {
|
tests = {
|
||||||
ld-preload = runCommand "ld-preload-test-run" {} ''
|
ld-preload = runCommand "ld-preload-test-run" { } ''
|
||||||
${self}/bin/preload-hardened-malloc ${self.ld-preload-tests}/bin/run-tests
|
${finalAttrs.finalPackage}/bin/preload-hardened-malloc ${finalAttrs.passthru.ld-preload-tests}/bin/run-tests
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
# to compensate for the lack of tests of correct normal malloc operation
|
# to compensate for the lack of tests of correct normal malloc operation
|
||||||
stress = runCommand "stress-test-run" {} ''
|
stress = runCommand "stress-test-run" { } ''
|
||||||
${self}/bin/preload-hardened-malloc ${stress-ng}/bin/stress-ng \
|
${finalAttrs.finalPackage}/bin/preload-hardened-malloc ${stress-ng}/bin/stress-ng \
|
||||||
--no-rand-seed \
|
--no-rand-seed \
|
||||||
--malloc 8 \
|
--malloc 8 \
|
||||||
--malloc-ops 1000000 \
|
--malloc-ops 1000000 \
|
||||||
|
|
Loading…
Reference in a new issue