2016-02-23 03:23:00 +03:00
|
|
|
#!/bin/sh
|
|
|
|
set -x -e
|
|
|
|
|
2019-10-29 15:17:40 +01:00
|
|
|
TRAVIS_PKGS="protobuf-c-compiler libprotobuf-c-dev libaio-dev python-future
|
2019-05-08 21:45:39 +01:00
|
|
|
libgnutls28-dev libgnutls30 libprotobuf-dev protobuf-compiler
|
2019-10-29 15:17:40 +01:00
|
|
|
libcap-dev libnl-3-dev gdb bash python-protobuf python-yaml
|
|
|
|
libnet-dev util-linux asciidoctor libnl-route-3-dev
|
|
|
|
python-junit.xml python-ipaddress time ccache flake8
|
|
|
|
libbsd-dev"
|
|
|
|
|
|
|
|
X86_64_PKGS="gcc-multilib"
|
|
|
|
|
|
|
|
UNAME_M=`uname -m`
|
|
|
|
|
|
|
|
if [ "$UNAME_M" != "x86_64" ]; then
|
|
|
|
# For Travis only x86_64 seems to be baremetal. Other
|
|
|
|
# architectures are running in unprivileged LXD containers.
|
|
|
|
# That seems to block most of CRIU's interfaces.
|
|
|
|
SKIP_TRAVIS_TEST=1
|
|
|
|
fi
|
2016-10-19 10:34:00 +03:00
|
|
|
|
2016-10-08 17:22:00 +03:00
|
|
|
travis_prep () {
|
|
|
|
[ -n "$SKIP_TRAVIS_PREP" ] && return
|
|
|
|
|
|
|
|
cd ../../
|
|
|
|
|
2019-10-29 15:17:40 +01:00
|
|
|
# This can fail on aarch64 travis
|
|
|
|
service apport stop || :
|
2016-08-24 23:09:00 +03:00
|
|
|
|
2017-03-15 16:17:22 -07:00
|
|
|
CC=gcc
|
|
|
|
# clang support
|
|
|
|
if [ "$CLANG" = "1" ]; then
|
|
|
|
TRAVIS_PKGS="$TRAVIS_PKGS clang"
|
|
|
|
CC=clang
|
|
|
|
fi
|
|
|
|
|
2018-03-02 00:49:12 +03:00
|
|
|
[ -n "$GCOV" ] && {
|
|
|
|
apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
|
|
|
apt-get update -yq
|
|
|
|
apt-get -yq --no-install-suggests --no-install-recommends --force-yes install g++-7
|
|
|
|
CC=gcc-7
|
|
|
|
}
|
|
|
|
|
2017-03-15 16:17:22 -07:00
|
|
|
# ccache support, only enable for non-GCOV case
|
|
|
|
if [ "$CCACHE" = "1" -a -z "$GCOV" ]; then
|
|
|
|
# ccache is installed by default, need to set it up
|
|
|
|
export CCACHE_DIR=$HOME/.ccache
|
|
|
|
[ "$CC" = "clang" ] && export CCACHE_CPP2=yes
|
|
|
|
# uncomment the following to get detailed ccache logs
|
|
|
|
#export CCACHE_LOGFILE=$HOME/ccache.log
|
|
|
|
CC="ccache $CC"
|
|
|
|
fi
|
|
|
|
|
2019-10-29 15:17:40 +01:00
|
|
|
# Do not install x86_64 specific packages on other architectures
|
|
|
|
if [ "$UNAME_M" = "x86_64" ]; then
|
|
|
|
TRAVIS_PKGS="$TRAVIS_PKGS $X86_64_PKGS"
|
|
|
|
fi
|
|
|
|
|
2016-10-08 17:22:00 +03:00
|
|
|
apt-get update -qq
|
2017-05-17 12:32:40 -07:00
|
|
|
apt-get install -qq --no-install-recommends $TRAVIS_PKGS
|
2016-10-08 17:22:00 +03:00
|
|
|
chmod a+x $HOME
|
|
|
|
}
|
2016-02-23 03:23:00 +03:00
|
|
|
|
2020-06-10 20:25:36 +00:00
|
|
|
test_stream() {
|
|
|
|
# We must test CRIU features that dump content into an image file to ensure
|
|
|
|
# streaming compatibility.
|
|
|
|
STREAM_TEST_PATTERN='.*(ghost|fifo|unlink|memfd|shmem|socket_queue).*'
|
|
|
|
./test/zdtm.py run --stream -p 2 --keep-going -T $STREAM_TEST_PATTERN $ZDTM_OPTS
|
|
|
|
}
|
|
|
|
|
2016-10-08 17:22:00 +03:00
|
|
|
travis_prep
|
|
|
|
|
2016-10-11 18:46:59 -07:00
|
|
|
export GCOV
|
2019-10-29 15:17:40 +01:00
|
|
|
$CC --version
|
2017-03-15 16:17:22 -07:00
|
|
|
time make CC="$CC" -j4
|
2017-10-05 20:38:24 +03:00
|
|
|
|
2019-10-29 15:17:40 +01:00
|
|
|
./criu/criu -v4 cpuinfo dump || :
|
|
|
|
./criu/criu -v4 cpuinfo check || :
|
|
|
|
|
|
|
|
make lint
|
|
|
|
|
|
|
|
# Check that help output fits into 80 columns
|
|
|
|
WIDTH=$(./criu/criu --help | wc --max-line-length)
|
|
|
|
if [ "$WIDTH" -gt 80 ]; then
|
|
|
|
echo "criu --help output does not obey 80 characters line width!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-11-04 08:52:55 +01:00
|
|
|
[ -n "$SKIP_TRAVIS_TEST" ] && exit 0
|
2017-10-05 20:38:24 +03:00
|
|
|
|
2019-10-29 15:17:40 +01:00
|
|
|
ulimit -c unlimited
|
|
|
|
|
|
|
|
echo "|`pwd`/test/abrt.sh %P %p %s %e" > /proc/sys/kernel/core_pattern
|
|
|
|
|
2019-04-10 15:03:02 +01:00
|
|
|
if [ "${COMPAT_TEST}x" = "yx" ] ; then
|
|
|
|
# Dirty hack to keep both ia32 & x86_64 shared libs on a machine:
|
|
|
|
# headers are probably not compatible, so apt-get doesn't allow
|
|
|
|
# installing both versions, while we need one for CRIU and one
|
|
|
|
# for 32-bit tests. A better way would involve launching docker..
|
|
|
|
# But it would require making zdtm.py aware of docker and launching
|
|
|
|
# tests inside the CT.
|
|
|
|
INCOMPATIBLE_LIBS="libaio-dev libcap-dev libnl-3-dev libnl-route-3-dev"
|
|
|
|
IA32_PKGS=""
|
|
|
|
REFUGE=64-refuge
|
|
|
|
|
|
|
|
mkdir "$REFUGE"
|
|
|
|
for i in $INCOMPATIBLE_LIBS ; do
|
|
|
|
for j in $(dpkg --listfiles $i | grep '\.so$') ; do
|
|
|
|
cp "$j" "$REFUGE/"
|
|
|
|
done
|
|
|
|
IA32_PKGS="$IA32_PKGS $i:i386"
|
|
|
|
done
|
|
|
|
apt-get remove $INCOMPATIBLE_LIBS
|
|
|
|
apt-get install --no-install-recommends $IA32_PKGS
|
|
|
|
mkdir -p /usr/lib/x86_64-linux-gnu/
|
|
|
|
mv "$REFUGE"/* /usr/lib/x86_64-linux-gnu/
|
|
|
|
fi
|
|
|
|
|
2017-03-15 16:17:22 -07:00
|
|
|
time make CC="$CC" -j4 -C test/zdtm
|
|
|
|
|
|
|
|
[ -f "$CCACHE_LOGFILE" ] && cat $CCACHE_LOGFILE
|
2016-07-06 05:01:59 +03:00
|
|
|
|
2017-10-04 09:43:04 +03:00
|
|
|
# umask has to be called before a first criu run, so that .gcda (coverage data)
|
|
|
|
# files are created with read-write permissions for all.
|
|
|
|
umask 0000
|
2016-07-06 05:01:59 +03:00
|
|
|
./criu/criu check
|
|
|
|
./criu/criu check --all || echo $?
|
|
|
|
./criu/criu cpuinfo dump
|
|
|
|
./criu/criu cpuinfo check
|
|
|
|
|
|
|
|
export SKIP_PREP=1
|
2017-05-17 12:32:41 -07:00
|
|
|
# The 3.19 kernel (from Ubuntu 14.04) has a bug. When /proc/PID/pagemap
|
|
|
|
# is read for a few VMAs in one read call, incorrect data is returned.
|
2019-08-13 12:29:08 +02:00
|
|
|
# See https://github.com/checkpoint-restore/criu/issues/207
|
2017-05-17 12:32:41 -07:00
|
|
|
# Kernel 4.4 (from Ubuntu 14.04.5 update) fixes this.
|
|
|
|
uname -r | grep -q ^3\.19 && export CRIU_PMC_OFF=1
|
2016-07-06 05:01:59 +03:00
|
|
|
|
2016-08-31 22:50:00 +03:00
|
|
|
chmod 0777 test/
|
|
|
|
chmod 0777 test/zdtm/static
|
|
|
|
chmod 0777 test/zdtm/transition
|
|
|
|
|
2020-06-10 20:25:36 +00:00
|
|
|
# We run streaming tests separately to improve test completion times,
|
|
|
|
# hence the exit 0.
|
|
|
|
if [ "${STREAM_TEST}" = "1" ]; then
|
|
|
|
./scripts/install-criu-image-streamer.sh
|
|
|
|
test_stream
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-06-02 00:03:04 +03:00
|
|
|
./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS
|
2017-05-31 12:51:41 +03:00
|
|
|
|
|
|
|
KERN_MAJ=`uname -r | cut -d. -f1`
|
|
|
|
KERN_MIN=`uname -r | cut -d. -f2`
|
2019-02-05 20:54:39 +02:00
|
|
|
if [ $KERN_MAJ -ge "4" ] && [ $KERN_MIN -ge "18" ]; then
|
2018-04-16 19:58:57 +03:00
|
|
|
LAZY_EXCLUDE="-x cmdlinenv00 -x maps007"
|
2017-05-31 12:51:41 +03:00
|
|
|
else
|
|
|
|
LAZY_EXCLUDE="-x maps007 -x fork -x fork2 -x uffd-events -x cgroupns
|
|
|
|
-x socket_listen -x socket_listen6 -x cmdlinenv00
|
2018-10-02 15:20:29 +03:00
|
|
|
-x socket_close_data01 -x file_read -x lazy-thp -x futex"
|
2017-05-31 12:51:41 +03:00
|
|
|
fi
|
2017-10-08 16:19:40 +03:00
|
|
|
LAZY_EXCLUDE="$LAZY_EXCLUDE -x maps04"
|
|
|
|
|
2019-11-17 16:05:47 +02:00
|
|
|
# Starting with 5.4 kernel requires SYS_CAP_PTRACE to use uffd events; as such
|
|
|
|
# we cannot run lazy-pages tests in uns
|
|
|
|
LAZY_FLAVORS=""
|
|
|
|
if [ $KERN_MAJ -ge "5" ] && [ $KERN_MIN -ge "4" ]; then
|
|
|
|
LAZY_FLAVORS = "-f h,ns"
|
|
|
|
fi
|
|
|
|
|
2017-10-08 16:19:40 +03:00
|
|
|
LAZY_TESTS=.*\(maps0\|uffd-events\|lazy-thp\|futex\|fork\).*
|
2019-11-17 16:05:47 +02:00
|
|
|
LAZY_OPTS="-p 2 -T $LAZY_TESTS $LAZY_EXCLUDE $LAZY_FLAVORS $ZDTM_OPTS"
|
2017-10-08 16:19:40 +03:00
|
|
|
|
2019-11-17 16:04:16 +02:00
|
|
|
./test/zdtm.py run $LAZY_OPTS --lazy-pages
|
|
|
|
./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages
|
|
|
|
./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls
|
2016-07-06 05:01:59 +03:00
|
|
|
|
|
|
|
bash ./test/jenkins/criu-fault.sh
|
|
|
|
bash ./test/jenkins/criu-fcg.sh
|
|
|
|
bash ./test/jenkins/criu-inhfd.sh
|
|
|
|
|
2018-06-02 00:03:04 +03:00
|
|
|
if [ -z "$SKIP_EXT_DEV_TEST" ]; then
|
|
|
|
make -C test/others/mnt-ext-dev/ run
|
|
|
|
fi
|
2016-09-28 01:12:19 +03:00
|
|
|
#make -C test/others/exec/ run
|
2018-03-02 00:49:12 +03:00
|
|
|
make -C test/others/make/ run CC="$CC"
|
2018-03-29 10:02:29 +03:00
|
|
|
make -C test/others/shell-job/ run
|
2018-05-31 09:00:05 +00:00
|
|
|
make -C test/others/rpc/ run
|
2016-07-06 05:01:59 +03:00
|
|
|
|
|
|
|
./test/zdtm.py run -t zdtm/static/env00 --sibling
|
|
|
|
|
|
|
|
./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --dedup
|
2016-09-02 00:12:00 +03:00
|
|
|
./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --noauto-dedup
|
2016-07-06 05:01:59 +03:00
|
|
|
./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --page-server
|
2016-09-02 00:12:00 +03:00
|
|
|
./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --page-server --dedup
|
2016-07-06 05:01:59 +03:00
|
|
|
|
|
|
|
./test/zdtm.py run -t zdtm/static/socket-tcp-local --norst
|
|
|
|
|
|
|
|
ip net add test
|
|
|
|
./test/zdtm.py run -t zdtm/static/env00 -f h --join-ns
|
2016-06-03 05:33:00 +03:00
|
|
|
|
2016-11-08 07:38:38 +03:00
|
|
|
# RPC testing
|
|
|
|
./test/zdtm.py run -t zdtm/static/env00 --rpc # Basic
|
2017-05-17 08:07:13 +03:00
|
|
|
./test/zdtm.py run -t zdtm/static/env00 --rpc --pre 2 --page-server
|
2016-11-08 07:38:38 +03:00
|
|
|
./test/zdtm.py run -t zdtm/static/ptrace_sig -f h --rpc # Error handling (crfail test)
|
|
|
|
|
2017-05-04 23:27:47 +03:00
|
|
|
./test/zdtm.py run --empty-ns -T zdtm/static/socket-tcp*-local --iter 2
|
|
|
|
|
2018-06-02 00:02:56 +03:00
|
|
|
./test/zdtm.py run -t zdtm/static/env00 -k always
|
|
|
|
./test/crit-recode.py
|
|
|
|
|
2019-09-16 06:49:07 +00:00
|
|
|
# libcriu testing
|
|
|
|
make -C test/others/libcriu run
|
|
|
|
|
2020-05-06 08:04:45 +00:00
|
|
|
# external namespace testing
|
|
|
|
make -C test/others/ns_ext run
|
|
|
|
|
2018-03-29 10:02:29 +03:00
|
|
|
make -C test/others/shell-job
|