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

Darrick J. Wong
2021-06-12T00:34:28Z

On Fri, Jun 11, 2021 at 05:08:04PM -0700, Eric Biggers wrote:
> On Tue, Jun 08, 2021 at 10:19:38AM -0700, Darrick J. Wong wrote:
> > diff --git a/common/preamble b/common/preamble
> > new file mode 100644
> > index 00000000..63f66957
> > --- /dev/null
> > +++ b/common/preamble
> > @@ -0,0 +1,49 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2021 Oracle. All Rights Reserved.
> > +
> > +# Boilerplate fstests functionality
> > +
> > +# Standard cleanup function. Individual tests should override this.
> > +_cleanup()
> > +{
> > + cd /
> > + rm -f $tmp.*
> > +}
>
> This probably should use "rm -rf" so that tests don't need to override this just
> because they created directories rather than files.

Hm. I've been told (many years) in the past that I shouldn't really be
using recursive rm unless I /know/ that I've created a $tmp.dir
directory. OTOH that gets rid of a few thousand more lines of cruft...

<shrug> I'll change it to rm -r -f and see what kind of reaction I get.

--D

>
> - Eric