Skip to content

improve pipline & add more tests #8

improve pipline & add more tests

improve pipline & add more tests #8

Workflow file for this run

name: Run module
on:
push:
pull_request:
schedule:
- cron: '0 12 * * 0'
jobs:
run:
runs-on: ubuntu-22.04
steps:
### DEPENDENCIES ###
# Hard turn-off interactive mode
- run: echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
# Install dependencies
- run: sudo apt update
- run: sudo apt -y install bison busybox-static coreutils cpio elfutils file flex gcc gcc-multilib git iproute2 jq kbd kmod libcap-dev libelf-dev libunwind-dev libvirt-clients libzstd-dev linux-headers-generic linux-tools-common linux-tools-generic make pahole pkg-config python3-dev python3-pip python3-requests qemu-kvm rsync udev zstd curl
### END DEPENDENCIES ###
# Install virtme-ng
- run: pip install virtme-ng
# Checkout git repository
- uses: actions/checkout@v4
# Get the latest linux kernel
- run: git clone --single-branch -b master --depth 1 https://github.com/torvalds/linux.git
# Print the latest commit of the checked out linux kernel
- run: cd linux && git log -1 --pretty=format:"%h %ad %s" --date=short
# Build kernel
- run: cd linux && vng -v --build
# Generate kernel headers
- run: cd linux && make headers
# Print CPU model before running the tests (this can be useful for
# debugging purposes)
- run: grep 'model name' /proc/cpuinfo | head -1
# Setup KVM support
- name: "KVM support"
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# Run VM & test that module loads & unloads
- run: cd linux && vng -v -- 'cd .. && ls && make KSRC=linux && insmod mod-webserver.ko && rmmod mod-webserver.ko && echo OK' | grep OK
# Run VM & test that webserver is NOT working if we didn't enable it
- run: cd linux && vng -v -- 'cd .. && ls && make KSRC=linux && insmod mod-webserver.ko && (curl 127.0.0.1:2000 || echo OK)' | grep OK
# Run VM & test that webserver is working if we enable it
- run: cd linux && vng -v -- 'cd .. && ls && make KSRC=linux && insmod mod-webserver.ko && echo 1 > /sys/kernel/webserver/net/data/status && curl 127.0.0.1:2000' | grep PONG
# Run VM & test that webserver is able to work on custom port
- run: cd linux && vng -v -- 'cd .. && ls && make KSRC=linux && insmod mod-webserver.ko port=3000 && echo 1 > /sys/kernel/webserver/net/data/status && curl 127.0.0.1:3000' | grep PONG