test: add sigsegv after MPI_Finalize test
The current srun version used in MN4 returns 0 if the program crashes after MPI_Finalize, as shown by this test.
This commit is contained in:
parent
07253c3fa0
commit
604cfd90a3
@ -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
|
||||
|
35
test/reproducers/sigsegv.c
Normal file
35
test/reproducers/sigsegv.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include <mpi.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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;
|
||||
}
|
20
test/reproducers/sigsegv.nix
Normal file
20
test/reproducers/sigsegv.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
stdenv
|
||||
, mpi
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "sigsegv";
|
||||
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ mpi ];
|
||||
|
||||
buildPhase = ''
|
||||
mpicc sigsegv.c -o sigsegv
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp sigsegv $out
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user