Skip to content

Commit 6df80e6

Browse files
adrianreberavagin
authored andcommitted
Travis: use Vagrant to run VMs
This adds the minimal configuration to run Fedora 31 based VMs on Travis. This can be used to test cgroupv2 based tests, tests with vdso=off and probably much more which requires booting a newer kernel. As an example this builds CRIU on Fedora 31 and reconfigures it to boot without VDSO support and runs one single test. Signed-off-by: Adrian Reber <areber@redhat.com>
1 parent 2a67c26 commit 6df80e6

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
- TR_ARCH=x86_64
1313
- TR_ARCH=x86_64 CLANG=1
1414
- TR_ARCH=openj9-test
15+
- TR_ARCH=vagrant-fedora-no-vdso
1516
jobs:
1617
include:
1718
- os: linux

scripts/travis/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,13 @@ podman-test:
6464
openj9-test: restart-docker
6565
./openj9-test.sh
6666

67+
setup-vagrant:
68+
./vagrant.sh setup
69+
70+
vagrant-fedora-no-vdso: setup-vagrant
71+
./vagrant.sh fedora-no-vdso
72+
73+
.PHONY: setup-vagrant vagrant-fedora-no-vdso
74+
6775
%:
6876
$(MAKE) -C ../build $@$(target-suffix)

scripts/travis/vagrant.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# This script is used to run vagrant based tests on Travis.
4+
# This script is started via sudo from .travis.yml
5+
6+
set -e
7+
set -x
8+
9+
VAGRANT_VERSION=2.2.7
10+
FEDORA_VERSION=31
11+
FEDORA_BOX_VERSION=31.20191023.0
12+
13+
setup() {
14+
apt-get -qq update
15+
# Load the kvm modules for vagrant to use qemu
16+
modprobe kvm kvm_intel
17+
18+
# Tar up the git checkout to have vagrant rsync it to the VM
19+
tar cf criu.tar ../../../criu
20+
wget https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_$(uname -m).deb -O /tmp/vagrant.deb && \
21+
dpkg -i /tmp/vagrant.deb
22+
23+
apt-get -qq install -y libvirt-bin libvirt-dev qemu-utils qemu
24+
systemctl restart libvirt-bin
25+
vagrant plugin install vagrant-libvirt
26+
vagrant init fedora/${FEDORA_VERSION}-cloud-base --box-version ${FEDORA_BOX_VERSION}
27+
# The default libvirt Vagrant VM uses 512MB.
28+
# Travis VMs should have around 7.5GB.
29+
# Increasing it to 4GB should work.
30+
sed -i Vagrantfile -e 's,^end$, config.vm.provider :libvirt do |libvirt|'"\n"' libvirt.memory = 4096;end'"\n"'end,g'
31+
vagrant up --provider=libvirt
32+
mkdir -p /root/.ssh
33+
vagrant ssh-config >> /root/.ssh/config
34+
ssh default sudo dnf install -y gcc git gnutls-devel nftables-devel libaio-devel \
35+
libasan libcap-devel libnet-devel libnl3-devel make protobuf-c-devel \
36+
protobuf-devel python3-flake8 python3-future python3-protobuf \
37+
python3-junit_xml rubygem-asciidoctor iptables libselinux-devel
38+
# Disable sssd to avoid zdtm test failures in pty04 due to sssd socket
39+
ssh default sudo systemctl mask sssd
40+
ssh default cat /proc/cmdline
41+
}
42+
43+
fedora-no-vdso() {
44+
ssh default sudo grubby --update-kernel ALL --args="vdso=0"
45+
vagrant reload
46+
ssh default cat /proc/cmdline
47+
ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4'
48+
# Excluding the VDSO test as we are running without VDSO
49+
# Excluding two cgroup tests which seem to fail because of cgroup2
50+
ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a -x zdtm/static/cgroup04 -x zdtm/static/cgroup_ifpriomap -x zdtm/static/vdso01 --keep-going'
51+
}
52+
53+
$1

0 commit comments

Comments
 (0)