use of 'testing' function from testsuite/testing.sh
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Fri May 2 07:29:40 PDT 2008
Documentation:
# The "testing" function takes five arguments:
# $1) Description to display when running command
-# $2) Command line arguments to command
+# $2) Command and command line arguments
# $3) Expected result (on stdout)
# $4) Data written to file "input"
# $5) Data written to stdin
+# At least one of $4 and $5 should not be empty, but if both are empty
+# an input file name should be included in $2 (how do we validate that?).
Tests not specifying $4 or $5 _and_ the input (file) in $2 (when $4 is
non-empty) may not work at all. Some still do work due to a
"feature/bug" in the 'testing' function, which always does this:
echo -ne "$5" | eval "$2"
regardless. This should be probably done only if both $4 and $5 are
empty.
If $4 is non-emty the magic word 'input' should be present in $2, but even
if it's present, it could be placed in the wrong spot. And if $5 is
empty, then only:
eval "$2"
should be executed (no echo).
Are there cases where we want both stdin and input file(s)?
Are there cases where we _don't_ want them both?
If both $4 and $5 are non-empy, the magic word 'input' should be present
in $2, double input should be assumed and the 'testing' function should
execute:
echo "$5" | eval "$2"
Still, not totally reliable :(
Cheers,
--
Cristian
More information about the busybox
mailing list