[CRIU] [PATCH] test: allocate port for page server dinamicaly
Andrew Vagin
avagin at parallels.com
Mon Dec 29 03:42:43 PST 2014
On Fri, Dec 26, 2014 at 09:23:09PM +0300, Pavel Emelyanov wrote:
> On 11/21/2014 01:50 PM, Andrey Vagin wrote:
> > $ cat test/dump/static/write_read02/94/3/page_server.log
> > (00.000006) Starting page server on port 12345
> > (00.000030) Error (page-xfer.c:303): Can't bind page server: Address already in use
>
> Maybe run each test in its own net namespace? :)
> And pid namespace to avoid pid conflicts...
We don't have pid conflicts. Tests are already executed in pid
namespaces when it's required.
>
> > Reported-by: Mr Jenkins
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> > crtools.c | 2 +-
> > test/zdtm.sh | 8 +++++---
> > 2 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/crtools.c b/crtools.c
> > index 0ac667c..398552e 100644
> > --- a/crtools.c
> > +++ b/crtools.c
> > @@ -337,7 +337,7 @@ int main(int argc, char *argv[], char *envp[])
> > break;
> > case 1052:
> > opts.ps_port = htons(atoi(optarg));
> > - if (!opts.ps_port)
> > + if (opts.ps_port < 0)
> > goto bad_arg;
> > break;
> > case 'j':
> > diff --git a/test/zdtm.sh b/test/zdtm.sh
> > index ac897ba..c22ee8f 100755
> > --- a/test/zdtm.sh
> > +++ b/test/zdtm.sh
> > @@ -322,7 +322,6 @@ ITERATIONS=1
> > EXCLUDE_PATTERN=""
> > CLEANUP=0
> > PAGE_SERVER=0
> > -PS_PORT=12345
> > COMPILE_ONLY=0
> > START_ONLY=0
> > BATCH_TEST=0
> > @@ -577,6 +576,7 @@ run_test()
> > local test=$1
> > local snappdir=
> > local ps_pid=
> > + local ps_port=
> >
> > [ -n "$EXCLUDE_PATTERN" ] && echo $test | grep "$EXCLUDE_PATTERN" && return 0
> >
> > @@ -661,13 +661,15 @@ EOF
> > [ -n "$DUMP_ONLY" ] && dump_only=1
> >
> > if [ $PAGE_SERVER -eq 1 ]; then
> > - $CRIU page-server -D $ddump -o page_server.log -v4 --port $PS_PORT $ps_args --daemon --pidfile $ddump/page-server.pid || return 1
> > + $CRIU page-server -D $ddump -o page_server.log -v4 --port 0 $ps_args --daemon --pidfile $ddump/page-server.pid || return 1
> > ps_pid=`cat $ddump/page-server.pid`
> > ps -p "$ps_pid" -o cmd h | grep -q page-server || {
> > echo "Unable to determing PID of page-server"
> > return 1
> > }
> > - cpt_args="$cpt_args --page-server --address 127.0.0.1 --port $PS_PORT"
> > + ps_port=`lsof -p $ps_pid | grep LISTEN | sed "s/.*:\([0-9]*\)\s(LISTEN).*/\1/"`
> > + echo "The page server binds to $ps_port"
> > + cpt_args="$cpt_args --page-server --address 127.0.0.1 --port $ps_port"
> > fi
> >
> > if [ -n "$SNAPSHOT" ]; then
> >
>
More information about the CRIU
mailing list