svn commit: r314886 - in head: bin/pwait bin/pwait/tests etc/mtree targets/pseudo/tests

Ngie Cooper yaneurabeya at gmail.com
Wed Mar 8 00:39:26 UTC 2017


> On Mar 7, 2017, at 14:16, Bryan Drewery <bdrewery at FreeBSD.org> wrote:
> 
> Author: bdrewery
> Date: Tue Mar  7 22:16:55 2017
> New Revision: 314886
> URL: https://svnweb.freebsd.org/changeset/base/314886
> 
> Log:
>  pwait: Add a -t flag to specify a timeout before exiting, and tests.

Thank you very much for writing tests!

One general comment: it's not clear outside the commit message why the exit code returned is 124. It might be a good idea to mention that in the code.

> Added: head/bin/pwait/tests/Makefile
> ==============================================================================
> --- /dev/null    00:00:00 1970    (empty, because file is newly added)
> +++ head/bin/pwait/tests/Makefile    Tue Mar  7 22:16:55 2017    (r314886)
> @@ -0,0 +1,5 @@
> +# $FreeBSD$
> +
> +ATF_TESTS_SH=    pwait

The convention for the FreeBSD test suite is foo_test. Could you please rename this to pwait_test?

> +atf_test_case basic
> +basic_head()
> +{
> +    atf_set "descr" "Basic tests on pwait(1) utility"
> +}
> +
> +basic_body()
> +{
> +    sleep 1 &
> +    p1=$!
> +
> +    sleep 5 &
> +    p5=$!
> +
> +    sleep 10 &
> +    p10=$!
> +
> +    atf_check \
> +        -o empty \
> +        -e empty \
> +        -s exit:0 \
> +        -x timeout --preserve-status 15 pwait $p1 $p5 $p10

This should work without -x.

> +    atf_check \
> +        -o empty \
> +        -e inline:"kill: $p1: No such process\n" \
> +        -s exit:1 \
> +        -x kill -0 $p1

-x is only really needed if you need to invoke the snippet with /bin/sh in order to use sh idioms, iirc.

Thanks so much :)!!!
-Ngie


More information about the svn-src-all mailing list