Added features created by Flash Sheridan:
=========================================
Attached are some revisions I'd like to submit to the Linux Test
Project's
runltp. My main motive was that I wanted to be able to run a small
number of
tests conveniently. The existing method, of creating a test file, was
inconvenient for quick testing, and I encountered an apparent bug while
using
it (#1106474).
I added an option -s, which takes a string, and only runs files
whose test case line matches the given string. For my own use in
testing, I
also added a -v option, which prints the command line used to invoke
pan. I
also made a couple of minor corrections to the usage text.
There are a number of limitations to my code for -s:
* It relies on the presence of grep. I don't know if the absence of
grep is
at all common in Linux testing, but there should be no impact on anyone
not
using the -s option. (This restricted my coding significantly; it
would have
been more elegant to use grep everywhere, handling the absence of the
-s flag
as a universal pattern.)
* I don't support the -f and -N cases in conjunction with -s; instead I
report an
error and exit.
* grep searches the whole test case line; searching just the tag might
have
been neater, but would require relying on grep details more than seemed
prudent.
* -s doesn't report an error if there are no matches; pan eventually
reports
the problem instead, not very informatively.
* My code doesn't check for failure to create an output file. The
existing
code does this by repeatedly checking the return code from cat. But
grep's
return code can be non-zero if a pattern doesn't match a particular
file.
My implementation of -v is also suboptimal; I originally used a
variable for
both the echoing of the command line invoking pan, and for executing
it. But
when the command results in an error, the error message included my
variable
name rather than the command. So the command and variable are now
duplicated
code.
---
flash
1 file changed