diff --git a/overlay.nix b/overlay.nix index 75c1881..083b47a 100644 --- a/overlay.nix +++ b/overlay.nix @@ -214,9 +214,10 @@ let inherit self super bsc callPackage; }; -# test = { + test = { # hwloc = callPackage ./test/bugs/hwloc.nix { }; -# }; + sigsegv = callPackage ./test/reproducers/sigsegv.nix { }; + }; }); in diff --git a/test/reproducers/sigsegv.c b/test/reproducers/sigsegv.c new file mode 100644 index 0000000..6283a24 --- /dev/null +++ b/test/reproducers/sigsegv.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +void sigsegv(int rank) +{ + if (rank == 2) raise(SIGSEGV); +} + +int main(int argc, char *argv[]) +{ + int rank; + char where; + + MPI_Init(&argc, &argv); + + if(!argv[1]) + { + fprintf(stderr, "missing \"before\" or \"after\" argument\n"); + exit(1); + } + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + where = argv[1][0]; + + if(where == 'b') sigsegv(rank); + + MPI_Finalize(); + + if(where == 'a') sigsegv(rank); + + return 0; +} diff --git a/test/reproducers/sigsegv.nix b/test/reproducers/sigsegv.nix new file mode 100644 index 0000000..783049c --- /dev/null +++ b/test/reproducers/sigsegv.nix @@ -0,0 +1,20 @@ +{ + stdenv +, mpi +}: + +stdenv.mkDerivation { + name = "sigsegv"; + + src = ./.; + + buildInputs = [ mpi ]; + + buildPhase = '' + mpicc sigsegv.c -o sigsegv + ''; + + installPhase = '' + cp sigsegv $out + ''; +}