Skip to content

Commit 9e648a9

Browse files
committed
test(u4): only accept expected child abort signals in sphere phi-cut test
1 parent 7184c99 commit 9e648a9

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

u4/tests/SpherePhiCutQuarterShellTest.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ enum ConvertOutcome
4444
CONVERT_ERROR
4545
};
4646

47+
bool IsExpectedRejectSignal(int signal)
48+
{
49+
return signal == SIGABRT || signal == SIGINT;
50+
}
51+
4752
int CountPartialPhiSpheres(const G4VSolid* solid)
4853
{
4954
const G4Sphere* sphere = dynamic_cast<const G4Sphere*>(solid);
@@ -97,8 +102,15 @@ ConvertOutcome ConvertInChildProcess(const G4VSolid* solid)
97102

98103
if (WIFSIGNALED(status))
99104
{
100-
std::cout << "child rejected conversion with signal " << WTERMSIG(status) << std::endl;
101-
return CONVERT_REJECTED;
105+
int signal = WTERMSIG(status);
106+
if (IsExpectedRejectSignal(signal))
107+
{
108+
std::cout << "child rejected conversion with expected signal " << signal << std::endl;
109+
return CONVERT_REJECTED;
110+
}
111+
112+
std::cerr << "child crashed with unexpected signal " << signal << std::endl;
113+
return CONVERT_ERROR;
102114
}
103115

104116
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)

0 commit comments

Comments
 (0)