autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Background processes in GNU Autotest


From: Mike Frysinger
Subject: Re: Background processes in GNU Autotest
Date: Thu, 23 Jun 2016 01:19:55 -0400

On 22 Jun 2016 22:52, Olaf Mandel wrote:
> On 22.06.2016 21:12, Mike Frysinger wrote:
> > On 22 Jun 2016 11:03, Olaf Mandel wrote:
> >> I am trying to use GNU Autotest (via AX_GNU_AUTOTEST()) to run
> >> end-to-end tests on a network server. [...]
> >>
> >> AT_CHECK([server&],        , [ignore])
> >> AT_CHECK([client --cmd]),  , [expected-output])
> >> AT_CHECK([killall server], , [ignore])
> >>
> -Snipp-
> >> Now I want to combine this with valgrind checking [...]
> >>
> >> valgrind --error-exitcode=1 --quiet ./server &
> >>
> -Snipp-
> > 
> > wouldn't you want the test itself to spin up/down the server as need
> > be ?  that way you can write multiple end-to-end tests and have them
> > all run in parallel.
> > 
> You mean my "client" program starting the server itself? Didn't think of
> that... it would solve the cleanup question during testing. I see that
> valgrind provides the --trace-children=yes option: I will have to try if
> this gives suitable debugging information (I am mostly interested in
> memory debugging the real server, not the client that was only written
> for testing).
> 
> > i'm guessing your method described above also doesn't work when you
> > try to run all the tests in parallel.
> 
> Right. This would already fail because the TCP port would be blocked and
> there is no reliable way to feed back the port number from the server to
> the client (and no: I can't use Unix sockets instead of TCP ports
> without extending some external library). But here the suggestion of
> forking the server from the client may help as well: the client can try
> starting the server on different ports until one works.

probing for an open port would be one way to handle it.  if you can
conditionally rely on Linux namespace features, you could create a
new network namespace for each test which would give you a completely
blank slate with localhost available.
$ unshare -Urn
# ifconfig lo up
# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group 
default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: address@hidden: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
    link/sit 0.0.0.0 brd 0.0.0.0
3: address@hidden: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1
    link/tunnel6 :: brd ::
# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
-mike

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]