Skip to content

Commit 411f442

Browse files
committed
Document running tests in qemu
1 parent 048ddba commit 411f442

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,65 @@ To run test suit use 'check' target, e.g in build directory run:
107107

108108
make check
109109

110+
note that sio2jail may not support newer kernel versions (#40), it may be required to
111+
use a virtual machine for running tests (see the next section).
112+
113+
Running in QEMU
114+
---------------
115+
116+
Since sio2jail may not support newest kernel versions it may be handy to use a virtual
117+
machine for development:
118+
119+
# get debian 11 QEMU image
120+
wget https://cdimage.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-amd64.qcow2
121+
122+
# reserve more space for QEMU image
123+
qemu-img resize debian-11-nocloud-amd64.qcow2 +10G
124+
125+
# start QEMU with KVM and sio2jail sources mounted with virtfs
126+
qemu-system-x86_64 \
127+
-enable-kvm \
128+
-m 4G \
129+
-nographic \
130+
-hda debian-11-nocloud-amd64.qcow2 \
131+
-virtfs local,path=$SIO2JAIL_SOURCES,security_model=mapped-xattr,mount_tag=sio2jail \
132+
-cpu max
133+
134+
# login as root (no password)
135+
136+
# resize root partition
137+
apt update
138+
apt install -y cloud-utils fdisk
139+
growpart /dev/sda 1
140+
resize2fs /dev/sda1
141+
142+
# install dependencies and utilities
143+
apt install -y \
144+
build-essential \
145+
cmake \
146+
gcc-multilib \
147+
g++-multilib \
148+
gperf \
149+
wget
150+
151+
# mount sio2jail sources
152+
mkdir /sio2jail
153+
mount -t 9p -o trans=virtio sio2jail /sio2jail -oversion=9p2000.L,posixacl,msize=104857600
154+
155+
# create a separate user with same uid and gid as your local user (check id -u)
156+
groupadd -g $GID dev
157+
useradd -u $UID -g dev -m dev -s /bin/bash
158+
159+
# compile and run tests as you would usually
160+
su dev
161+
cd /sio2jail
162+
mkdir build
163+
cd build
164+
make sio2jail
165+
make check
166+
167+
# to exit virtual machine use Ctrl+A X, see QEMU manpage for more escape sequences
168+
110169
Notes for developers
111170
--------------------
112171

0 commit comments

Comments
 (0)