More Kernel CI

This commit is contained in:
Francesco Mazzoli
2023-06-16 14:14:30 +00:00
parent ac15f6bdc1
commit 009cf11359
8 changed files with 61 additions and 14 deletions

View File

@@ -603,9 +603,9 @@ func main() {
procs.StartShard(log, *repoDir, &shopts)
}
waitShuckleFor := 5 * time.Second
waitShuckleFor := 10 * time.Second
if *buildType == "valgrind" || *profile {
waitShuckleFor = 30 * time.Second
waitShuckleFor = 60 * time.Second
}
fmt.Printf("waiting for shuckle for %v...\n", waitShuckleFor)
lib.WaitForShuckle(log, fmt.Sprintf("127.0.0.1:%v", shucklePort), failureDomains*(hddBlockServices+flashBlockServices), waitShuckleFor)

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -eu -o pipefail
base_img=$(realpath ${1})
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR
@@ -15,4 +17,29 @@ export https_proxy=http://REDACTED
# build kernel module
make "KDIR=${SCRIPT_DIR}/linux-5.4.237" -j kmod
# start VM
# create vm image
./createimg.sh "$base_img"
# start VM in the background
trap "echo 'Terminating QEMU'; pkill qemu" EXIT
./startvm.sh &>vm-out &
# Wait for VM to go up by trying to copy the kernel module to it
chmod 0600 image-key
scp_attempts=0
while ! scp -P 2222 -o StrictHostKeyChecking=no -i image-key eggsfs.ko fmazzol@localhost: ; do
sleep 1
scp_attempts=$((scp_attempts + 1))
if [ $scp_attempts -ge 20 ]; then
echo "Couldn't reach qemu"
exit 1
fi
done
# Deploy eggsfs
../deploy/deploy.py --vm --upload --build-type alpine
# Insert module
ssh -p 2222 -i image-key fmazzol@localhost "sudo insmod eggsfs.ko"
ssh -p 2222 -i image-key fmazzol@localhost "eggs/eggstests -kmod -verbose -filter 'mounted|rsync|large' -drop-cached-spans-every 100ms -outgoing-packet-drop 0.1 -short -binaries-dir eggs"

15
kmod/createimg.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eu -o pipefail
base_img=$(realpath ${1})
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR
set -x
qemu-img create -f qcow2 -b $base_img ubuntu.img 100G
cloud-localds init.img image-init.yml
# remove existing key if any
ssh-keygen -R '[localhost]:2222' >/dev/null

View File

@@ -4,6 +4,7 @@ users:
- name: fmazzol
ssh-authorized-keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE93TJCd7qWh/kHzaBoCSU9VgOKSWlUls9OkiBNCjG3B francesco.mazzoli@xtxmarkets.com
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHPZYOlGn7Phs99W8B7tun81sjCpbHdhNdISzhfqI93K fmazzol@uovo
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash

8
kmod/image-key Normal file
View File

@@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBz2WDpRp+z4bPfVvAe7bp/NbIwqWx3YTXSEs4X6iPdygAAAKjjG7G44xux
uAAAAAtzc2gtZWQyNTUxOQAAACBz2WDpRp+z4bPfVvAe7bp/NbIwqWx3YTXSEs4X6iPdyg
AAAEBladoOm/8kEuWG6kOPeDfaKJxtnwK4KlC8GZbe/y7kZ3PZYOlGn7Phs99W8B7tun81
sjCpbHdhNdISzhfqI93KAAAAI2ZtYXp6b2xAbG9zcGVjbmRldjUuZWNuLmN5bG9uLmxvY2
FsAQI=
-----END OPENSSH PRIVATE KEY-----

1
kmod/image-key.pub Normal file
View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHPZYOlGn7Phs99W8B7tun81sjCpbHdhNdISzhfqI93K fmazzol@uovo

View File

@@ -3,16 +3,14 @@ set -eu -o pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
imgs_dir=${1:-"."}
qemu-system-x86_64 \
-machine accel=kvm,type=q35 \
-enable-kvm \
-cpu host \
-kernel "${SCRIPT_DIR}/linux-5.4.237/arch/x86/boot/bzImage" \
-kernel "${SCRIPT_DIR}/linux/arch/x86/boot/bzImage" \
-append "root=/dev/sda1 single console=ttyS0 systemd.unit=graphical.target" \
-hda "${imgs_dir}/ubuntu-20.04.img" \
-hdb "${imgs_dir}/init.img" \
-hda "${SCRIPT_DIR}/ubuntu.img" \
-hdb "${SCRIPT_DIR}/init.img" \
-m 64G \
-smp 50 \
-nographic \

View File

@@ -94,12 +94,9 @@ for _ in range(3):
ports.append(s.getsockname()[1])
wait_cmds(
[
# normal
run_cmd(['./go/eggstests/eggstests', '-repo-dir', script_dir, '-tmp-dir', script_dir, '-shuckle-port', str(ports[0])]),
# sanitized, packet drop
run_cmd(['./go/eggstests/eggstests', '-repo-dir', script_dir, '-tmp-dir', script_dir, '-shuckle-port', str(ports[1]), '-build-type', 'sanitized', '-outgoing-packet-drop', '0.1', '-short']),
# valgrind
run_cmd(['./go/eggstests/eggstests', '-repo-dir', script_dir, '-tmp-dir', script_dir, '-shuckle-port', str(ports[2]), '-build-type', 'valgrind', '-short']),
run_cmd(['./go/eggstests/eggstests', '-verbose', '-repo-dir', script_dir, '-tmp-dir', script_dir, '-shuckle-port', str(ports[0])]),
run_cmd(['./go/eggstests/eggstests', '-verbose', '-repo-dir', script_dir, '-tmp-dir', script_dir, '-shuckle-port', str(ports[1]), '-build-type', 'sanitized', '-outgoing-packet-drop', '0.1', '-short']),
run_cmd(['./go/eggstests/eggstests', '-verbose', '-repo-dir', script_dir, '-tmp-dir', script_dir, '-shuckle-port', str(ports[2]), '-build-type', 'valgrind']),
],
quiet=tests_quiet,
)