Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2017 16:39:23 -0800
From:      Ngie Cooper <yaneurabeya@gmail.com>
To:        Bryan Drewery <bdrewery@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r314886 - in head: bin/pwait bin/pwait/tests etc/mtree targets/pseudo/tests
Message-ID:  <5FFD1DE3-3BB8-484F-9EFF-E8D5084322D9@gmail.com>
In-Reply-To: <201703072216.v27MGuEq086764@repo.freebsd.org>
References:  <201703072216.v27MGuEq086764@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Mar 7, 2017, at 14:16, Bryan Drewery <bdrewery@FreeBSD.org> wrote:
>=20
> Author: bdrewery
> Date: Tue Mar  7 22:16:55 2017
> New Revision: 314886
> URL: https://svnweb.freebsd.org/changeset/base/314886
>=20
> 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 c=
ode returned is 124. It might be a good idea to mention that in the code.

> Added: head/bin/pwait/tests/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> --- /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=3D    pwait

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

> +atf_test_case basic
> +basic_head()
> +{
> +    atf_set "descr" "Basic tests on pwait(1) utility"
> +}
> +
> +basic_body()
> +{
> +    sleep 1 &
> +    p1=3D$!
> +
> +    sleep 5 &
> +    p5=3D$!
> +
> +    sleep 10 &
> +    p10=3D$!
> +
> +    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 o=
rder to use sh idioms, iirc.

Thanks so much :)!!!
-Ngie=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5FFD1DE3-3BB8-484F-9EFF-E8D5084322D9>