[CRIU] [PATCH] test: use .pid.inprogress file for macvlan test

Tycho Andersen tycho.andersen at canonical.com
Wed Oct 26 13:58:00 PDT 2016


On Wed, Oct 26, 2016 at 11:20:14AM -0700, Andrei Vagin wrote:
> On Wed, Oct 26, 2016 at 04:23:48PM +0000, Tycho Andersen wrote:
> > Note, this depends on Pavel's patch here:
> > https://lists.openvz.org/pipermail/criu/2016-October/032499.html which is
> > not yet applied.
> > 
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > ---
> >  test/zdtm/static/macvlan.hook | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/test/zdtm/static/macvlan.hook b/test/zdtm/static/macvlan.hook
> > index 0dea7d1..d0a06b6 100755
> > --- a/test/zdtm/static/macvlan.hook
> > +++ b/test/zdtm/static/macvlan.hook
> > @@ -6,7 +6,8 @@ if [ "$1" == "--post-start" ]; then
> >  	set -e
> >  
> >  	i=0
> > -	while [ -z "$(pidof -s macvlan)" ]; do
> > +	PIDF="zdtm/static/macvlan.pid.inprogress"
> > +	while [ ! -f "$PIDF" ]; do
> >  		i=$(($i+1))
> >  		if [ "$i" -eq "10" ]; then
> >  			echo "failed to create macvlan test"
> > @@ -15,12 +16,14 @@ if [ "$1" == "--post-start" ]; then
> >  		sleep 1
> >  	done
> >  
> > +	TPID=$(cat $PIDF)
> 
> It is racy, because open() + write() is not atomic.

Yes, I think we can make it not racy by this little patch to pidfile;
this will fix both Pavel's and my tests. Does that make sense?

Tycho
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-test-make-write_pidfile-atomic.patch
Type: text/x-diff
Size: 1585 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/criu/attachments/20161026/6d4cd285/attachment-0001.bin>


More information about the CRIU mailing list