Re: [PATCH 03/13] fstests: refactor test boilerplate code

Eric Biggers
2021-06-16T20:47:35Z

On Mon, Jun 14, 2021 at 01:59:15PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Create two new helper functions to deal with boilerplate test code:
>
> A helper function to set the seq and seqnum variables. We will expand
> on this in the next patch so that fstests can autogenerate group files
> from now on.
>
> A helper function to register cleanup code that will run if the test
> exits or trips over a standard range of signals.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>

Looks good:

Reviewed-by: Eric Biggers <ebiggers@google.com>

A couple nits below:

> +# Standard cleanup function. Individual tests should override this.
> +_cleanup()
> +{
> + cd /
> + rm -r -f $tmp.*
> +}

It should say "can override this", not "should override this".

> +# Initialize the global seq, seqres, here, tmp, and status variables to their
> +# defaults. Group memberships are the only arguments to this helper.
> +_begin_fstest()
> +{

This function does more than what the comment says. It should say something
more along the lines of "Prepare for executing a fstest by initializing some
global variables, registering a default cleanup function, importing helper
functions, and removing $seqres.full. This must be passed the list of groups to
which the test belongs."

- Eric