Re: [PATCH 03/13] fstests: refactor test boilerplate code
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-06-17 00:02:12
Also in:
fstests
On Wed, Jun 16, 2021 at 01:47:32PM -0700, Eric Biggers wrote:
On Mon, Jun 14, 2021 at 01:59:15PM -0700, Darrick J. Wong wrote:quoted
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 <redacted> Reviewed-by: Allison Henderson <redacted>Looks good: Reviewed-by: Eric Biggers <redacted> A couple nits below:quoted
+# Standard cleanup function. Individual tests should override this. +_cleanup() +{ + cd / + rm -r -f $tmp.* +}It should say "can override this", not "should override this".
Fixed.
quoted
+# 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."
Ok, I'll change that. # Prepare to run a fstest by initializing the global seq, seqres, here, # tmp, and status variables to their defaults, importing common # functions, registering a cleanup function, and removing the # $seqres.full file. # # The list of group memberships for this test (e.g. auto quick rw) must # be passed as arguments to this helper. It is not necessary to name # this test explicitly as a member of the 'all' group. --D
- Eric