[lxc-devel] [PATCH 1/3] Allow criu >= 1.3 in c/r test

Serge Hallyn serge.hallyn at ubuntu.com
Fri Sep 5 14:42:01 UTC 2014


Quoting Tycho Andersen (tycho.andersen at canonical.com):
> On Thu, Sep 04, 2014 at 10:04:34PM +0000, Serge Hallyn wrote:
> > Quoting Tycho Andersen (tycho.andersen at canonical.com):
> > > criu version 1.3 has been tagged, which has the minimal set of patches to allow
> > > checkpointing and restoring containers. lxc-test-checkpoint-restore is now
> > > skipped on any version of criu lower than 1.3.
> > > 
> > > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > > ---
> > >  src/tests/lxc-test-checkpoint-restore | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/tests/lxc-test-checkpoint-restore b/src/tests/lxc-test-checkpoint-restore
> > > index 43068ef..a6777d1 100755
> > > --- a/src/tests/lxc-test-checkpoint-restore
> > > +++ b/src/tests/lxc-test-checkpoint-restore
> > > @@ -15,7 +15,13 @@ if [ "$(id -u)" != "0" ]; then
> > >  	exit 1
> > >  fi
> > >  
> > > -if [ "$(criu --version | head -n1 | cut -d' ' -f 2)" != "1.3-rc2" ]; then
> > > +vergte() {
> > > +	! [ "$1" = "$(echo "$1\n$2" | sort -V | tail -n1)" ]
> > 
> > A few things here:
> > 
> > 1. anyone who has /bin/sh linked to /bin/bash will fail here, because
> > the \n will be printed as '\n'
> 
> Ok, I guess printf is more portable?
> 
> > 2. vergte sounds like 'vergion greater than or equal", but looking at how
> > you use it you mean the inverse, verlte?
> 
> Yes, absolutely. Below is a patch that fixes both issues.
> 
> Tycho
> 
> 
> criu version 1.3 has been tagged, which has the minimal set of patches to allow
> checkpointing and restoring containers. lxc-test-checkpoint-restore is now
> skipped on any version of criu lower than 1.3.
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

Thanks, looks good.


Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/tests/lxc-test-checkpoint-restore | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/tests/lxc-test-checkpoint-restore b/src/tests/lxc-test-checkpoint-restore
> index 43068ef..c25d941 100755
> --- a/src/tests/lxc-test-checkpoint-restore
> +++ b/src/tests/lxc-test-checkpoint-restore
> @@ -15,7 +15,13 @@ if [ "$(id -u)" != "0" ]; then
>  	exit 1
>  fi
>  
> -if [ "$(criu --version | head -n1 | cut -d' ' -f 2)" != "1.3-rc2" ]; then
> +verlte() {
> +	! [ "$1" = "$(printf "$1\n$2" | sort -V | tail -n1)" ]
> +}
> +
> +criu_version="$(criu --version | head -n1 | cut -d' ' -f 2)"
> +
> +if verlte "$criu_version" "1.3"; then
>  	echo "SKIP: skipping test because no (or wrong) criu installed."
>  	exit 0
>  fi
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list