[PATCH] Enhance tests.

Jim Meyering jim at meyering.net
Fri Oct 1 22:03:39 UTC 2010


Jeff Darcy wrote:
> Added failure check for "PUT to root" test.
> Added "-s -S" to curl commands to kill silly progress bars.
> Removed "-v" from iwhd command line.
> Added rdbuf call in meta.cpp to silence C++ code.
>
> Also, I'd like to comment a bit on "black box" vs. "white box" testing.

I'll reply to that later.
...
> +
> +# Comment this out if you want to see all the spam.
> +silent="-s -S"

Please put the above in the curl function that's defined
in t/init.cfg instead.  Then most of the remaining changes here
are not needed.

>  # Create an empty bucket.
> -curl -X PUT http://localhost:$port/b1 || fail=1
> +curl $silent -X PUT http://localhost:$port/b1 || fail=1
>  test -d FS/b1 || fail=1
>
> -# Post to root; should fail (but FIXME: how to detect failure?)
> -curl -X PUT http://localhost:$port || fail=1
> +# PUT to root; should fail
> +curl $silent -f -X PUT http://localhost:$port 2> root_put.err
> +egrep " 404$" root_put.err || fail=1

Thanks for addressing that FIXME.
Please use grep instead (egrep is deprecated and not as portable),
and single quotes:

    grep ' 404$' root_put.err || fail=1

If you ever need egrep, use grep -E.
For ultimate portability, use the configure-set $EGREP, which you
can ensure is exported into the environment via a line in
t/Makefile.am's TESTS_ENVIRONMENT definition like this:

    EGREP="$(EGREP)" \


More information about the iwhd-devel mailing list