[CRIU] [PATCH] tests: add a runc based test

Adrian Reber adrian at lisas.de
Wed Jul 18 22:49:29 MSK 2018


From: Adrian Reber <areber at redhat.com>

Using runc with CRIU does currently not work if /tmp is read-only.

To detect runc breakage earlier this downloads the runc repository to
run the checkpoint part of runc's test suite.

Related: #520

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 .travis.yml                    |  1 +
 scripts/travis/Dockerfile.runc |  9 +++++++++
 scripts/travis/Makefile        | 21 +++++++++++++++++++++
 3 files changed, 31 insertions(+)
 create mode 100644 scripts/travis/Dockerfile.runc

diff --git a/.travis.yml b/.travis.yml
index d8a50a0..3718d70 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,7 @@ env:
   - TR_ARCH=local       GCOV=1
   - TR_ARCH=centos
   - TR_ARCH=phaul-test
+  - TR_ARCH=runc-test
 matrix:
   allow_failures:
     - env: TR_ARCH=docker-test
diff --git a/scripts/travis/Dockerfile.runc b/scripts/travis/Dockerfile.runc
new file mode 100644
index 0000000..f482f5b
--- /dev/null
+++ b/scripts/travis/Dockerfile.runc
@@ -0,0 +1,9 @@
+FROM golang:1.10-stretch
+
+RUN apt-get update && apt-get install -y build-essential
+
+WORKDIR /go/src/github.com/opencontainers/runc
+
+ADD runc /go/src/github.com/opencontainers/runc
+
+RUN make recvtty
diff --git a/scripts/travis/Makefile b/scripts/travis/Makefile
index f7181ac..59343a9 100644
--- a/scripts/travis/Makefile
+++ b/scripts/travis/Makefile
@@ -37,5 +37,26 @@ phaul-test:
 docker-test:
 	./docker-test.sh
 
+runc-test:
+	SKIP_TRAVIS_TEST=1 ./travis-tests
+	# clone runc we actually just want the test suite
+	git clone https://github.com/opencontainers/runc
+	# download the released binary
+	curl -o runc/runc -sSL https://github.com/opencontainers/runc/releases/download/v1.0.0-rc5/runc.amd64
+	chmod 755 runc/runc
+	# for the test suite we need to build recvtty
+	docker build -t runc -f Dockerfile.runc .
+	docker run runc tar c -C contrib/cmd/recvtty recvtty | tar x -C runc/contrib/cmd/recvtty
+	# install current criu
+	install -D -m0755 ../../criu/criu /usr/local/sbin/criu
+	# get bats to run tests
+	git clone https://github.com/sstephenson/bats.git
+	cd bats && git reset --hard 03608115df2071fff4eaaff1605768c275e5f81f
+	cd bats && ./install.sh /usr/local
+	# the runc test suite does 'go env GOARCH' to detect the arch, let's fake this
+	echo '#!/bin/bash\necho travis\n' > /usr/local/bin/go
+	chmod 755 /usr/local/bin/go
+	cd runc && bats -t tests/integration/checkpoint.bats
+
 %:
 	$(MAKE) -C ../build $@$(target-suffix)
-- 
1.8.3.1



More information about the CRIU mailing list