mirror_zfs/tests/test-runner
Ryan Moeller 0a0f9a7dc6
ZTS: Provide for nested cleanup routines
Shared test library functions lack a simple way to ensure proper
cleanup in the event of a failure.  The `log_onexit` cleanup pattern
cannot be used in library functions because it uses one global
variable to store the cleanup command.

An example of where this is a serious issue is when a tunable that
artifically stalls kernel progress gets activated and then some check
fails.  Unless the caller knows about the tunable and sets it back,
the system will be left in a bad state.

To solve this problem, turn the global cleanup variable into a stack.
Provide push and pop functions to add additional cleanup steps and
remove them after it is safe again.

The first use of this new functionality is in attempt_during_removal,
which sets REMOVAL_SUSPEND_PROGRESS.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10080
2020-03-03 10:28:09 -08:00
..
bin ZTS: Change issue URL template to OpenZFS org 2020-03-02 09:42:22 -08:00
include ZTS: Provide for nested cleanup routines 2020-03-03 10:28:09 -08:00
man Fix typos 2019-09-02 18:17:39 -07:00
Makefile.am Retire legacy test infrastructure 2017-08-15 17:26:38 -07:00