Re: [PATCH 2/8] fstests: _cleanup overrides are messy

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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.



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux