Re: CVS commit: src/external/bsd/atf/dist/atf-sh

2014-01-10 Thread Julio Merino
On Fri, Jan 10, 2014 at 1:39 AM, Christos Zoulas  wrote:
> Module Name:src
> Committed By:   christos
> Date:   Fri Jan 10 01:39:32 UTC 2014
>
> Modified Files:
> src/external/bsd/atf/dist/atf-sh: libatf-sh.subr
>
> Log Message:
> Undo previous; unfortunately the cleanup routine gets called in a different
> shell so it can't cleanup stuff set in the environment of the first shell.

What are you trying to fix?

> There are 2 problems:
> - calling the test routine directly does not cleanup (not using
>   atf-run)
> - when using atf-run, the cleanup routine needs state from the
>   running code which can only be stored in files. This will never
>   allow us to run tests in parallel since we need to keep a known
>   place to pass state.

I don't see how this prevents running tests in parallel. You just need
to maintain one work directory for every test body/cleanup pair and
delete the directory only after cleanup... and you cannot share work
directories among tests anyway so you have to do that one way or
another.

-- 
Julio Merino / @jmmv


Re: CVS commit: src/external/bsd/atf/dist/atf-sh

2014-01-10 Thread Christos Zoulas
In article ,
Julio Merino   wrote:
>On Fri, Jan 10, 2014 at 1:39 AM, Christos Zoulas  wrote:
>> Module Name:src
>> Committed By:   christos
>> Date:   Fri Jan 10 01:39:32 UTC 2014
>>
>> Modified Files:
>> src/external/bsd/atf/dist/atf-sh: libatf-sh.subr
>>
>> Log Message:
>> Undo previous; unfortunately the cleanup routine gets called in a different
>> shell so it can't cleanup stuff set in the environment of the first shell.
>
>What are you trying to fix?

In the test case for t_hostent in lib/libc/net/, the tests initially
contained the cleanup code after the test. If the test failed, then
the cleanup did not get called. So I decided to use the _cleanup()
feature of ATF. I ran the test with atf-run and the cleanup did
not work. I wanted to examine the single test case that failed and
I did not know how to run a single test case with atf-run.  So I
ran the test directly. The cleanup code did not get called which
was unexpected. So I made that change and it worked for the most
part but not in the error case. Then I realized that all the tests
do set -e, so that makes the shell exit on error. That made me
realize that the reason the cleanup does not work when it gets
called from atf-run is because the cleanup is invoked in a separate
shell, so the state of the test is lost (like shell variables set
by the setup code). So I decided to set all the variables again
during the cleanup.

I would have preferred that the cleanup functionality was implemented
differently, running in the context of the shell that ran the test.
This could have been done by issuing a 'trap test_cleanup 0' before
invoking the test, instead of all the complex stuff that is currently
been done (unless I am missing something).

>I don't see how this prevents running tests in parallel. You just need
>to maintain one work directory for every test body/cleanup pair and
>delete the directory only after cleanup... and you cannot share work
>directories among tests anyway so you have to do that one way or
>another.

If I need to pass state between the body of the test function and
the cleanup function, where do I put that state?

christos



Re: CVS commit: src/tests/lib/libc/ssp

2014-01-10 Thread Jukka Ruohonen
On Fri, Jan 10, 2014 at 10:45:34AM +, Martin Husemann wrote:
> Module Name:  src
> Committed By: martin
> Date: Fri Jan 10 10:45:34 UTC 2014
> 
> Modified Files:
>   src/tests/lib/libc/ssp: t_ssp.sh
> 
> Log Message:
> In the strcat test, smash the stack more severely (this all may depend
> on alignment and stack frame details).
> The gcc folks disagree with this test in general:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59750

I got a bit lost with Jelinek's reply above. Aren't those tests specifically
for NetBSD's ssp(3), a.k.a. -D_FORTIFY_SOURCE=2 and not -fstack-protector?

- Jukka.


Re: CVS commit: src/tests/lib/libc/ssp

2014-01-10 Thread Martin Husemann
On Fri, Jan 10, 2014 at 08:47:01PM +0200, Jukka Ruohonen wrote:
> I got a bit lost with Jelinek's reply above. Aren't those tests specifically
> for NetBSD's ssp(3), a.k.a. -D_FORTIFY_SOURCE=2 and not -fstack-protector?

Yes, the ticket could be improved, but actually the behaviour is
identical. As long as you don't overwrite anything (due to stack layout
or what have you) the ssp won't trigger - and the exact details are
very machine dependent.

Martin


Re: CVS commit: src/external/bsd/atf/dist/atf-sh

2014-01-10 Thread Martin Husemann
On Fri, Jan 10, 2014 at 06:31:57PM +, Christos Zoulas wrote:
> If I need to pass state between the body of the test function and
> the cleanup function, where do I put that state?

Create a temporary file in . - this will be a private directory for this
test case when run from atf-run.

Martin