Skip to content
Snippets Groups Projects
Commit e1f82972 authored by Padok's avatar Padok
Browse files

own nix derivation

parent 59331672
No related branches found
No related tags found
1 merge request!26Ci fixes
cp -r $src/* ./
make
mkdir -p $out/bin/
cp calc $out/bin/rpn.calculator
\ No newline at end of file
with import (import ./nixpkgs.nix) {};
stdenv.mkDerivation {
name = "rpn-calculator";
src = ./.;
buildInputs = [ catch2 ];
nativeBuildInputs = [ afl ];
doCheck = true;
checkTarget = "run_test";
installPhase = ''
mkdir -p $out
find . -executable -type f -exec cp {} $out \;
'';
#with import (import ./nixpkgs.nix) {};
with import <nixpkgs> {};
derivation {
name = "build";
builder = "${pkgs.bash}/bin/bash";
args = [ ./builder.sh ];
system = builtins.currentSystem;
#PATH="${pkgs.coreutils}/bin/:${pkgs.gcc}/bin/:${pkgs.gnumake}/bin/";
PATH=pkgs.lib.strings.concatMapStringsSep ":" (x: x + "/bin") (with pkgs;[coreutils gcc gnumake]);
src = ./.;
}
/* pkgs.stdenv.mkDerivation {
name = "rpn-calc";
src = ./.;
buildInputs = with pkgs; [ afl ];
nativebuildInputs = with pkgs; [ afl ];
checkInputs = with pkgs; [ afl ];
buildPhase = ''
make fuzz_calc
'';
installPhase = ''
mkdir -p $out/bin
cp fuzz_calc $out/bin
'';
} */
\ No newline at end of file
fuzz.nix 0 → 100644
with import <nixpkgs> {};
derivation {
name = "fuzz";
builder = "${pkgs.bash}/bin/bash";
args = [ ./fuzz_seconds.sh ];
system = builtins.currentSystem;
#PATH="${pkgs.coreutils}/bin/:${pkgs.gcc}/bin/:${pkgs.gnumake}/bin/";
PATH=pkgs.lib.strings.concatMapStringsSep ":" (x: x + "/bin") (with pkgs;[coreutils gcc gnumake afl]);
src = ./.;
}
\ No newline at end of file
#!/usr/bin/env bash
cp -r $src/* ./
make fuzz_calc
fuzz_seconds=${1:-10} # 10 seconds by default
echo "Going to fuzz for $fuzz_seconds seconds."
......@@ -10,3 +13,7 @@ afl_pid=$!
sleep $fuzz_seconds
kill $afl_pid
#mkdir -p $out/bin/
cp -r out/ $out/
\ No newline at end of file
with import (import ./nixpkgs.nix) {};
let
rpncalc = import ./default.nix;
afl_rpncalc = rpncalc.overrideAttrs (_: {
nativeBuildInputs = [ afl ];
makeFlags = [ "fuzz_calc" ];
doCheck = false;
});
in {
inherit rpncalc afl_rpncalc;
sanitized = rpncalc.overrideAttrs (_: {
CXXFLAGS = "-fsanitize=undefined -fsanitize=address";
});
fuzz_rpncalc = afl_rpncalc.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ gnuplot which ];
preConfigure = ''
patchShebangs fuzz_seconds.sh
'';
postBuild = ''
./fuzz_seconds.sh 10
afl-plot out graph
'';
installPhase = ''
cp -r out $out
cp -r graph $out/
mkdir -p $out/nix-support
echo report testlog $out graph/index.html > $out/nix-support/hydra-build-products
'';
});
}
sudo 0 → 100644
core tee /proc/sys/kernel/core_pattern
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment