[lxc-devel] [PATCH] tests: Tweak lxc-test-ubuntu to be faster

Serge Hallyn serge.hallyn at ubuntu.com
Fri Jan 24 05:44:35 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

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

> ---
>  src/tests/lxc-test-ubuntu | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/tests/lxc-test-ubuntu b/src/tests/lxc-test-ubuntu
> index 7fa1c89..be69eec 100755
> --- a/src/tests/lxc-test-ubuntu
> +++ b/src/tests/lxc-test-ubuntu
> @@ -23,7 +23,6 @@
>  # License along with this library; if not, write to the Free Software
>  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>  
> -
>  set -e
>  
>  FAIL() {
> @@ -54,11 +53,13 @@ for template in ubuntu ubuntu-cloud; do
>  	else
>  		name=lxc-test-$template
>  	fi
> +
>  	lxc-create -t $template -n $name || FAIL "creating $template container"
>  	lxc-start -n $name -d || FAIL "starting $template container"
>  	lxc-wait -n $name -s RUNNING || FAIL "waiting for $template container to run"
> +
>  	for tries in `seq 1 20`; do
> -		lxcip=`sudo lxc-info -i -n $name | awk -F: '{ print $2 }' | awk '{ print $1}' | head -1`
> +		lxcip=$(lxc-info -i -n $name -H | head -1)
>  		[ -z "$lxcip" ] || break
>  		sleep 1
>  	done
> @@ -66,12 +67,12 @@ for template in ubuntu ubuntu-cloud; do
>  
>  	ping -c 1 $lxcip || FAIL "to ping $template container"
>  	# Check apparmor
> -	lxcpid=`lxc-info -n $name -p | awk -F: '{ print $2 }' | awk '{ print $1}'`
> +	lxcpid=`lxc-info -n $name -p -H`
>  	aa=`cat /proc/$lxcpid/attr/current`
>  	if [ "$aa" != "lxc-container-default-with-nesting (enforce)" -a "$aa" != "lxc-container-default (enforce)" ]; then
>  		FAIL " to correctly set apparmor profile (profile is \"$aa\")"
>  	fi
> -	lxc-stop -n $name
> +	lxc-stop -n $name -k
>  	lxc-destroy -n $name
>  done
>  
> -- 
> 1.8.5.3
> 
> _______________________________________________
> 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