[CRIU] [PATCH] [v2] travis: run tests with asan

Andrei Vagin avagin at openvz.org
Wed Mar 29 16:34:01 PDT 2017


From: Andrei Vagin <avagin at virtuozzo.com>

v2: Use the devicemapper storage driver for docker containers to
run more tests. AUFS doesn't support file handles, so a few tests
(e.g. inotify00 can't be run).

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 .travis.yml                          |  1 +
 scripts/build/Dockerfile.fedora-asan | 16 ++++++++++++++++
 scripts/build/Makefile               |  2 +-
 scripts/travis/Makefile              |  5 +++++
 scripts/travis/asan.sh               | 21 +++++++++++++++++++++
 5 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 scripts/build/Dockerfile.fedora-asan
 create mode 100755 scripts/travis/asan.sh

diff --git a/.travis.yml b/.travis.yml
index a5dfb9f..78b1f0c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@ env:
   - TR_ARCH=local       GCOV=1
   - TR_ARCH=local       CLANG=1
   - TR_ARCH=alpine
+  - TR_ARCH=asan
   - TR_ARCH=x86_64
   - TR_ARCH=armv7hf
   - TR_ARCH=aarch64
diff --git a/scripts/build/Dockerfile.fedora-asan b/scripts/build/Dockerfile.fedora-asan
new file mode 100644
index 0000000..13aad28
--- /dev/null
+++ b/scripts/build/Dockerfile.fedora-asan
@@ -0,0 +1,16 @@
+FROM fedora:latest
+ARG CC=gcc
+ARG ENV1=FOOBAR
+
+RUN dnf install -y git gcc make
+RUN dnf install -y protobuf-devel protobuf-c-devel libaio-devel libcap-devel libnl3-devel libnet-devel
+RUN dnf install -y python ccache libasan findutils tar python-yaml protobuf-python iptables iproute python-ipaddr procps-ng
+
+COPY . /criu
+WORKDIR /criu
+
+ENV CCACHE_DIR=/tmp/.ccache CCACHE_NOCOMPRESS=1 $ENV1=yes
+RUN mv .ccache /tmp; make mrproper; ccache -s; \
+	date; make -j $(nproc) ASAN=1 CC="$CC"; date
+RUN make ASAN=1 -C test/zdtm -j $(nproc)
+
diff --git a/scripts/build/Makefile b/scripts/build/Makefile
index b17bf10..5308711 100644
--- a/scripts/build/Makefile
+++ b/scripts/build/Makefile
@@ -1,6 +1,6 @@
 QEMU_ARCHES := armv7hf aarch64 ppc64le # require qemu
 ARCHES := $(QEMU_ARCHES) x86_64
-TARGETS := $(ARCHES) alpine
+TARGETS := $(ARCHES) alpine fedora-asan
 TARGETS_CLANG := $(addsuffix $(TARGETS),-clang)
 
 all: $(TARGETS) $(TARGETS_CLANG)
diff --git a/scripts/travis/Makefile b/scripts/travis/Makefile
index 0dadd65..e759ac2 100644
--- a/scripts/travis/Makefile
+++ b/scripts/travis/Makefile
@@ -15,6 +15,11 @@ alpine:
 	$(MAKE) -C ../build $@$(target-suffix)
 	docker run --rm -it --privileged -v /lib/modules:/lib/modules criu-alpine ./test/zdtm.py run -t zdtm/static/env00
 
+asan:
+	echo 'DOCKER_OPTS="--storage-driver=devicemapper"' > /etc/default/docker
+	restart docker
+	$(MAKE) -C ../build fedora-asan
+	docker run --rm -it --privileged -v /lib/modules:/lib/modules criu-fedora-asan ./scripts/travis/asan.sh
 
 %:
 	$(MAKE) -C ../build $@$(target-suffix)
diff --git a/scripts/travis/asan.sh b/scripts/travis/asan.sh
new file mode 100755
index 0000000..5b34da6
--- /dev/null
+++ b/scripts/travis/asan.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -x
+
+cat /proc/self/mountinfo
+
+chmod 0777 test
+chmod 0777 test/zdtm/transition/
+chmod 0777 test/zdtm/static
+
+./test/zdtm.py run -a --keep-going -k always --parallel 4 -x zdtm/static/rtc
+ret=$?
+
+for i in `find / -name 'asan.log*'`; do
+	echo $i;
+	echo ========================================
+	cat $i;
+	echo ========================================
+	ret=1;
+done;
+exit $ret
-- 
2.7.4



More information about the CRIU mailing list