On Tue, May 24, 2022 at 6:39 PM Dave Chinner <david@xxxxxxxxxxxxx> wrote: > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > Most _cleanup() function overrides look like: > > _cleanup() > { > # do something test specific > cd / > rm -rf $tmp.* > } > > But they often get the last two lines either wrong or omit them. > These are the lines the common/preamble::_cleanup() define. > > The problem here is that we are just overriding the generic _cleanup > function by redeclaring it after calling _begin_fstest. What we > should be doing is registering a new local cleanup function that > calls the generic cleanup function when we have finished the local > cleanup. i.e.: > > _local_cleanup() > { > # do something test specific > > _cleanup > } > > Make _register_cleanup() function to cancel the existing > cleanup trap and register the new trap function so that local > cleanups can be done cleanly. > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx> Thanks, Amir.