[1/2] travis: check docker checkpoint

Submitted by Andrei Vagin on Oct. 5, 2017, 5:58 p.m.

Details

Message ID 20171005175847.2432-1-avagin@openvz.org
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrei Vagin Oct. 5, 2017, 5:58 p.m.
From: Andrei Vagin <avagin@virtuozzo.com>

Install the last version of Docker, start a container and C/R it a few times.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 .travis.yml                   |  2 ++
 scripts/travis/Makefile       |  3 ++
 scripts/travis/docker-test.sh | 65 +++++++++++++++++++++++++++++++++++++++++++
 scripts/travis/travis-tests   |  3 ++
 4 files changed, 73 insertions(+)
 create mode 100755 scripts/travis/docker-test.sh

Patch hide | download patch | download mbox

diff --git a/.travis.yml b/.travis.yml
index b0f7f6cee..c0321a6c3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,9 +20,11 @@  env:
   - TR_ARCH=ppc64le     CLANG=1
   - TR_ARCH=alpine      CLANG=1
   - TR_ARCH=fedora-rawhide
+  - TR_ARCH=docker-test
 matrix:
   allow_failures:
     - env: TR_ARCH=fedora-rawhide
+    - env: TR_ARCH=docker-test
 script:
   - sudo make CCACHE=1 -C scripts/travis $TR_ARCH
 after_success:
diff --git a/scripts/travis/Makefile b/scripts/travis/Makefile
index 48853c17f..4d89610bf 100644
--- a/scripts/travis/Makefile
+++ b/scripts/travis/Makefile
@@ -22,5 +22,8 @@  $(TARGETS):
 	$(MAKE) -C ../build $@$(target-suffix)
 	docker run --rm -it --privileged -v /lib/modules:/lib/modules --tmpfs /run criu-$@ ./scripts/travis/asan.sh $(ZDTM_OPTIONS)
 
+docker-test:
+	./docker-test.sh
+
 %:
 	$(MAKE) -C ../build $@$(target-suffix)
diff --git a/scripts/travis/docker-test.sh b/scripts/travis/docker-test.sh
new file mode 100755
index 000000000..2fad42854
--- /dev/null
+++ b/scripts/travis/docker-test.sh
@@ -0,0 +1,65 @@ 
+#!/bin/bash
+set -x -e -o pipefail
+
+apt-get install -qq \
+    apt-transport-https \
+    ca-certificates \
+    curl \
+    software-properties-common
+
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+
+add-apt-repository \
+   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+   $(lsb_release -cs) \
+   stable"
+
+
+apt-get update -qq
+
+apt-get install -qq docker-ce
+
+cat > /etc/docker/daemon.json <<EOF
+{
+    "experimental": true
+}
+EOF
+
+service docker restart
+
+export SKIP_TRAVIS_TEST=1
+
+./travis-tests
+
+cd ../../
+
+touch /usr/sbin/criu
+mount --bind criu/criu /usr/sbin/criu
+
+docker info
+
+criu --version
+
+docker run --security-opt=seccomp:unconfined --name cr -d alpine /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
+
+sleep 1
+for i in `seq 50`; do
+	# docker start returns 0 silently if a container is already started
+	# docker checkpoint doesn't wait when docker updates a container state
+	# Due to both these points, we need to sleep after docker checkpoint to
+	# avoid races with docker start.
+	docker exec cr ps axf &&
+	docker checkpoint create cr checkpoint$i &&
+	sleep 1 &&
+	docker start --checkpoint checkpoint$i cr 2>&1 | tee log || {
+		cat "`cat log | grep 'log file:' | sed 's/log file:\s*//'`" || true
+		docker logs cr || true
+		cat /tmp/zdtm-core-* || true
+		dmesg
+		docker ps
+		exit 1
+	}
+	docker ps
+	sleep 1
+done
+
diff --git a/scripts/travis/travis-tests b/scripts/travis/travis-tests
index 062da8396..6459e0e68 100755
--- a/scripts/travis/travis-tests
+++ b/scripts/travis/travis-tests
@@ -49,6 +49,9 @@  echo "|`pwd`/test/abrt.sh %P %p %s %e" > /proc/sys/kernel/core_pattern
 
 export GCOV
 time make CC="$CC" -j4
+
+[ -n "$SKIP_TRAVIS_TEST" ] && return
+
 time make CC="$CC" -j4 -C test/zdtm
 
 [ -f "$CCACHE_LOGFILE" ] && cat $CCACHE_LOGFILE

Comments

Andrey Vagin Oct. 10, 2017, 1:01 a.m.
Applied

On Thu, Oct 05, 2017 at 08:58:46PM +0300, Andrei Vagin wrote:
> From: Andrei Vagin <avagin@virtuozzo.com>
> 
> Install the last version of Docker, start a container and C/R it a few times.
> 
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
> ---
>  .travis.yml                   |  2 ++
>  scripts/travis/Makefile       |  3 ++
>  scripts/travis/docker-test.sh | 65 +++++++++++++++++++++++++++++++++++++++++++
>  scripts/travis/travis-tests   |  3 ++
>  4 files changed, 73 insertions(+)
>  create mode 100755 scripts/travis/docker-test.sh
> 
> diff --git a/.travis.yml b/.travis.yml
> index b0f7f6cee..c0321a6c3 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -20,9 +20,11 @@ env:
>    - TR_ARCH=ppc64le     CLANG=1
>    - TR_ARCH=alpine      CLANG=1
>    - TR_ARCH=fedora-rawhide
> +  - TR_ARCH=docker-test
>  matrix:
>    allow_failures:
>      - env: TR_ARCH=fedora-rawhide
> +    - env: TR_ARCH=docker-test
>  script:
>    - sudo make CCACHE=1 -C scripts/travis $TR_ARCH
>  after_success:
> diff --git a/scripts/travis/Makefile b/scripts/travis/Makefile
> index 48853c17f..4d89610bf 100644
> --- a/scripts/travis/Makefile
> +++ b/scripts/travis/Makefile
> @@ -22,5 +22,8 @@ $(TARGETS):
>  	$(MAKE) -C ../build $@$(target-suffix)
>  	docker run --rm -it --privileged -v /lib/modules:/lib/modules --tmpfs /run criu-$@ ./scripts/travis/asan.sh $(ZDTM_OPTIONS)
>  
> +docker-test:
> +	./docker-test.sh
> +
>  %:
>  	$(MAKE) -C ../build $@$(target-suffix)
> diff --git a/scripts/travis/docker-test.sh b/scripts/travis/docker-test.sh
> new file mode 100755
> index 000000000..2fad42854
> --- /dev/null
> +++ b/scripts/travis/docker-test.sh
> @@ -0,0 +1,65 @@
> +#!/bin/bash
> +set -x -e -o pipefail
> +
> +apt-get install -qq \
> +    apt-transport-https \
> +    ca-certificates \
> +    curl \
> +    software-properties-common
> +
> +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
> +
> +add-apt-repository \
> +   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> +   $(lsb_release -cs) \
> +   stable"
> +
> +
> +apt-get update -qq
> +
> +apt-get install -qq docker-ce
> +
> +cat > /etc/docker/daemon.json <<EOF
> +{
> +    "experimental": true
> +}
> +EOF
> +
> +service docker restart
> +
> +export SKIP_TRAVIS_TEST=1
> +
> +./travis-tests
> +
> +cd ../../
> +
> +touch /usr/sbin/criu
> +mount --bind criu/criu /usr/sbin/criu
> +
> +docker info
> +
> +criu --version
> +
> +docker run --security-opt=seccomp:unconfined --name cr -d alpine /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
> +
> +sleep 1
> +for i in `seq 50`; do
> +	# docker start returns 0 silently if a container is already started
> +	# docker checkpoint doesn't wait when docker updates a container state
> +	# Due to both these points, we need to sleep after docker checkpoint to
> +	# avoid races with docker start.
> +	docker exec cr ps axf &&
> +	docker checkpoint create cr checkpoint$i &&
> +	sleep 1 &&
> +	docker start --checkpoint checkpoint$i cr 2>&1 | tee log || {
> +		cat "`cat log | grep 'log file:' | sed 's/log file:\s*//'`" || true
> +		docker logs cr || true
> +		cat /tmp/zdtm-core-* || true
> +		dmesg
> +		docker ps
> +		exit 1
> +	}
> +	docker ps
> +	sleep 1
> +done
> +
> diff --git a/scripts/travis/travis-tests b/scripts/travis/travis-tests
> index 062da8396..6459e0e68 100755
> --- a/scripts/travis/travis-tests
> +++ b/scripts/travis/travis-tests
> @@ -49,6 +49,9 @@ echo "|`pwd`/test/abrt.sh %P %p %s %e" > /proc/sys/kernel/core_pattern
>  
>  export GCOV
>  time make CC="$CC" -j4
> +
> +[ -n "$SKIP_TRAVIS_TEST" ] && return
> +
>  time make CC="$CC" -j4 -C test/zdtm
>  
>  [ -f "$CCACHE_LOGFILE" ] && cat $CCACHE_LOGFILE
> -- 
> 2.13.3
>