Remove abort() usage in libraries and test codes
Description
This MR removes direct usage of the C abort()
function from LAL libraries and test codes.
abort()
is a pretty ugly way of raising an error, as it will not only kill the current process, but may also kill any calling processes. In LAL library functions called from Python, abort()
will probably kill the Python interpreter and/or the IPython kernel from a Jupyter notebook (though the web browser serving the notebook should be safe). From test codes under lal/test/
, abort()
will kill the Autotools test harness scripts and will print a line like ../../gnuscripts/test-driver: line 107: 34225 Aborted (core dumped) "$@" > $log_file 2>&1
which looks like an unexpected/catastrophic failure.
In LAL library functions, this MR replaces abort()
with lalAbortHook()
. The default behaviour of lalAbortHook()
in LALSuite executables is to call abort()
, so existing behaviour is preserved. The SWIG wrappings modify lalAbortHook()
so that it raises a Python exception, so calling these functions from Python should now be safe from killing the Python interpreter.
In test codes under lal/test/
, abort()
is replaced with an appropriate LAL/XLAL error-raising function, or else a simple exit(1)
, in order to return a non-zero exit status to indicate a test failure.
API Changes and Justification
Backwards Compatible Changes
-
This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions -
This change adds new classes/functions/structs/types to a public C header file or Python module
Backwards Incompatible Changes
-
This change modifies an existing class/function/struct/type definition in a public C header file or Python module -
This change removes an existing class/function/struct/type from a public C header file or Python module
If any of the Backwards Incompatible check boxes are ticked please provide a justification why this change is necessary and why it needs to be done in a backwards incompatible way.
Review Status
cc @adam-mercer