diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build-and-run.yml | 56 | ||||
-rw-r--r-- | .github/workflows/run-tests-32bit.yml | 162 | ||||
-rw-r--r-- | .github/workflows/run-tests-bigendian.yml | 169 | ||||
-rw-r--r-- | .github/workflows/run-tests.yml | 177 |
4 files changed, 530 insertions, 34 deletions
diff --git a/.github/workflows/build-and-run.yml b/.github/workflows/build-and-run.yml index fb6dd798..3dfebd86 100644 --- a/.github/workflows/build-and-run.yml +++ b/.github/workflows/build-and-run.yml @@ -14,9 +14,6 @@ jobs: fail-fast: false matrix: include: - - distro: ubuntu-20.04 - pkg-distro: ubuntu20.04 - cpack-type: Ubuntu20 - distro: ubuntu-22.04 pkg-distro: ubuntu22.04 cpack-type: Ubuntu22 @@ -34,7 +31,7 @@ jobs: sudo apt update && NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install git build-essential cmake gcc linux-headers-`uname -r` - libpcre3-dev libssl-dev liblua5.1-0-dev kmod + libpcre2-dev libssl-dev liblua5.1-0-dev kmod - name: Check out repository code uses: actions/checkout@v3 with: @@ -88,9 +85,9 @@ jobs: "debian:11", "debian:12", "debian:trixie", - "ubuntu:20.04", "ubuntu:22.04", - "ubuntu:24.04" + "ubuntu:24.04", + "ubuntu:devel" ] runs-on: ubuntu-24.04 container: @@ -104,9 +101,9 @@ jobs: debian:trixie) DISTRO=debian13; CPACK_TYPE=Debian13 ;; debian:12) DISTRO=debian12; CPACK_TYPE=Debian12 ;; debian:11) CPACK_TYPE=Debian11 ;; + ubuntu:devel) CPACK_TYPE=Ubuntu24 ; HEADERS_SUFFIX=generic ;; ubuntu:24.04) CPACK_TYPE=Ubuntu24 ; HEADERS_SUFFIX=generic ;; ubuntu:22.04) CPACK_TYPE=Ubuntu22 ; HEADERS_SUFFIX=generic ;; - ubuntu:20.04) CPACK_TYPE=Ubuntu20 ; HEADERS_SUFFIX=generic ;; esac; echo HEADERS_SUFFIX=$HEADERS_SUFFIX >> $GITHUB_ENV; echo DISTRO=$DISTRO >> $GITHUB_ENV; @@ -118,7 +115,7 @@ jobs: apt update && apt -y upgrade && apt -y dist-upgrade && NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt -y install git build-essential cmake gcc linux-headers-${{ env.HEADERS_SUFFIX }} - libpcre3-dev libssl-dev liblua5.1-0-dev kmod + libpcre2-dev libssl-dev liblua5.1-0-dev kmod - name: Get kernel name from headers run: > echo KERNEL_NAME=`ls -1 /usr/src/ | grep 'linux-headers.*${{ env.HEADERS_SUFFIX }}' | @@ -177,7 +174,7 @@ jobs: run: > apt update && apt -y upgrade && apt -y dist-upgrade && DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt -y install git build-essential cmake gcc - linux-headers-generic libpcre3-dev libssl-dev liblua5.1-0-dev kmod software-properties-common + linux-headers-generic libpcre2-dev libssl-dev liblua5.1-0-dev kmod software-properties-common pkexec dbus linux-base && add-apt-repository -y ppa:cappelikan/ppa && apt update && service dbus start && @@ -222,7 +219,7 @@ jobs: steps: - name: Install build tools run: > - apk update && apk add --no-cache git cmake make g++ pcre-dev libressl-dev linux-headers libucontext-dev lua5.1-dev + apk update && apk add --no-cache git cmake make g++ pcre2-dev libressl-dev linux-headers libucontext-dev lua5.1-dev - name: Check out repository code uses: actions/checkout@v3 with: @@ -248,4 +245,41 @@ jobs: run: sleep 1 - name: Check accel-ppp stat run: accel-cmd show stat -
\ No newline at end of file + + Build-in-Container-Gentoo: + runs-on: ubuntu-24.04 + container: + image: gentoo/stage3 + steps: + - name: Prepare gentoo + run: getuto && emerge --sync + - name: Install build tools + run: | + emerge -g --autounmask-write sys-kernel/gentoo-kernel-bin || (etc-update --verbose --automode -5 && emerge -g sys-kernel/gentoo-kernel-bin) + emerge -g dev-vcs/git dev-libs/libpcre2 dev-build/cmake dev-lang/lua:5.1 + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: mkdir build + run: mkdir build + - name: Disable git security warnings + run: git config --global --add safe.directory '*' + - name: cmake + working-directory: ./build + run: > + cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr + -DCMAKE_INSTALL_SYSCONFDIR=/etc + -DKDIR=/usr/src/linux + -DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. + - name: make and install + working-directory: ./build + run: make && make install + - name: Copy default config + run: cp accel-pppd/accel-ppp.conf /etc/accel-ppp.conf + - name: Start accel-ppp with default config + run: accel-pppd -d -c /etc/accel-ppp.conf + - name: Sleep for 1 sec + run: sleep 1 + - name: Check accel-ppp stat + run: accel-cmd show stat diff --git a/.github/workflows/run-tests-32bit.yml b/.github/workflows/run-tests-32bit.yml new file mode 100644 index 00000000..94d158ab --- /dev/null +++ b/.github/workflows/run-tests-32bit.yml @@ -0,0 +1,162 @@ +name: Run tests (x86_32) + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + +jobs: + Test-in-Alpine-x86-32: + #if: ${{ false }} # disable for now + runs-on: ubuntu-24.04 + name: Test in Qemu (x86_32 Alpine) + strategy: + fail-fast: false + matrix: + distro: [v3.20] + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: "accel-ppp" + - name: Install build tools for qemu and required tools + run: > + sudo apt update && + NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true + sudo -E apt -y install qemu-system-x86 qemu-utils wget openssh-client screen + - name: Prepare qemu files + run: | + ssh-keygen -t ed25519 -q -N "" -f ssh-key + qemu-img create -f raw disk.raw 5G + wget -nv https://dl-cdn.alpinelinux.org/alpine/${{ matrix.distro }}/releases/x86/netboot/vmlinuz-lts + wget -nv https://dl-cdn.alpinelinux.org/alpine/${{ matrix.distro }}/releases/x86/netboot/initramfs-lts + - name: Run http server for ssh-key + run: | + sudo ip addr add 192.0.2.1/32 dev lo # stable ip for http server + screen -dmS httpserver python3 -m http.server 8000 + - name: Run target OS first time (for setup actions) + run: > + sudo screen -dmS qemu + qemu-system-i386 -accel kvm -M q35 + -m 2048 -smp 2 -nographic + -net nic -net user,hostfwd=tcp::2222-:22 + -drive format=raw,file=disk.raw + -kernel vmlinuz-lts + -initrd initramfs-lts + -append "ip=dhcp alpine_repo=https://dl-cdn.alpinelinux.org/alpine/${{ matrix.distro }}/main + modloop=https://dl-cdn.alpinelinux.org/alpine/${{ matrix.distro }}/releases/x86/netboot/modloop-lts + ssh_key=http://192.0.2.1:8000/ssh-key.pub" + - name: Check that target OS is running + run: | + sleep 1 + sudo screen -ls + - name: Wait for ssh connection + timeout-minutes: 30 + run: > + while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key root@localhost "exit 0"; + do + echo "Trying to establish ssh connection"; + sleep 5; + done; + cat ~/.ssh/known_hosts + - name: Setup alpine to disk + run: > + ssh -i ssh-key -p2222 root@localhost "setup-alpine -c setup_alpine_conf && + sed -i '/^ROOTSSHKEY\|^DISKOPTS\|^APKREPOSOPTS=/d' setup_alpine_conf && + echo '' >> setup_alpine_conf && + echo 'DISKOPTS=\"-m sys /dev/sda\"' >> setup_alpine_conf && + echo 'ROOTSSHKEY=\"http://192.0.2.1:8000/ssh-key.pub\"' >> setup_alpine_conf && + echo 'APKREPOSOPTS=\"https://dl-cdn.alpinelinux.org/alpine/${{ matrix.distro }}/main\"' >> setup_alpine_conf && + cat setup_alpine_conf && + yes | setup-alpine -e -f setup_alpine_conf" + - name: Poweroff the VM + timeout-minutes: 30 + run: > + ssh -i ssh-key -p2222 root@localhost "poweroff" && + while sudo screen -ls; + do + echo "Waiting for poweroff"; + sleep 5; + done; + - name: Run target OS + run: > + sudo screen -dmS qemu + qemu-system-i386 -accel kvm -M q35 + -m 2048 -smp 2 -nographic + -net nic -net user,hostfwd=tcp::2222-:22 + -drive format=raw,file=disk.raw + - name: Check that target OS is running + run: | + sleep 1 + sudo screen -ls + - name: Wait for ssh connection + timeout-minutes: 30 + run: > + while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key root@localhost "exit 0"; + do + echo "Trying to establish ssh connection"; + sleep 5; + done; + cat ~/.ssh/known_hosts + - name: Display free space, current dir, kernel version and users + run: | + ssh -i ssh-key -p2222 root@localhost "df -h" + ssh -i ssh-key -p2222 root@localhost "pwd" + ssh -i ssh-key -p2222 root@localhost "uname -a" + ssh -i ssh-key -p2222 root@localhost "cat /etc/passwd" + - name: Install build tools (on target OS) + run: > + ssh -i ssh-key -p2222 root@localhost "setup-apkrepos -o && apk add --no-cache git cmake make g++ pcre2-dev openssl-dev linux-headers libucontext-dev lua5.1-dev linux-lts-dev py3-pip + ppp ppp-pppoe iproute2 dhclient && + (pip3 install pytest pytest-dependency pytest-order || pip3 install --break-system-packages pytest pytest-dependency pytest-order)" + - name: Copy source code to target OS + run: | + tar -Jcf accel-ppp.tar.xz accel-ppp + scp -i ssh-key -P2222 accel-ppp.tar.xz root@localhost: + ssh -i ssh-key -p2222 root@localhost "tar -xf accel-ppp.tar.xz" + - name: Build accel-ppp + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp && git config --global --add safe.directory '*' && + mkdir build && cd build && + cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr + -DKDIR=/usr/src/linux-headers-\`uname -r\` + -DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. && + make && make install" + - name: Run tests (not related to ipoe and vlan_mon drivers) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp/tests && + python3 -m pytest -Wall --order-dependencies -v -m \"not ipoe_driver and not vlan_mon_driver and not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: ssh -i ssh-key -p2222 -o ConnectTimeout=5 root@localhost "ps aux | grep accel- && dmesg" + - name: Insert ipoe kernel module + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp && + insmod build/drivers/ipoe/driver/ipoe.ko && + lsmod | grep ipoe" + - name: Run tests (not related to vlan_mon drivers) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp/tests && + python3 -m pytest -Wall --order-dependencies -v -m \"not vlan_mon_driver and not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: ssh -i ssh-key -p2222 -o ConnectTimeout=5 root@localhost "ps aux | grep accel- && dmesg" + - name: Insert vlan_mon kernel module + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp && + insmod build/drivers/vlan_mon/driver/vlan_mon.ko && + lsmod | grep vlan_mon" + - name: Run tests (all) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp/tests && + python3 -m pytest -Wall --order-dependencies -v -m \"not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: ssh -i ssh-key -p2222 -o ConnectTimeout=5 root@localhost "ps aux | grep accel- && dmesg" diff --git a/.github/workflows/run-tests-bigendian.yml b/.github/workflows/run-tests-bigendian.yml new file mode 100644 index 00000000..d5dce83b --- /dev/null +++ b/.github/workflows/run-tests-bigendian.yml @@ -0,0 +1,169 @@ +name: Run tests (big-endian) + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + +jobs: + + Test-in-Alpine-s390x: + #if: ${{ false }} # disable for now + runs-on: ubuntu-24.04 + name: Test in Qemu (s390x Alpine) + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: "accel-ppp" + - name: Install build tools for qemu and required tools + run: > + sudo apt update && + NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true + sudo -E apt -y install wget openssh-client screen + libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libslirp-dev ninja-build + - name: Build Qemu 9.1.2 + # Qemu 8.2 from Ubuntu24.04 has critical s390x-related bugs so Qemu9 is required + run: | + wget -nv https://github.com/qemu/qemu/archive/refs/tags/v9.1.2.tar.gz + tar -xf v9.1.2.tar.gz + cd qemu-9.1.2 + ./configure --target-list=s390x-softmmu --enable-slirp + make -j + sudo make install + - name: Prepare qemu files + run: | + ssh-keygen -t ed25519 -q -N "" -f ssh-key + qemu-img create -f raw disk.raw 5G + wget -nv https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/s390x/netboot/vmlinuz-lts + wget -nv https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/s390x/netboot/initramfs-lts + - name: Run http server for ssh-key + run: | + sudo ip addr add 192.0.2.1/32 dev lo # stable ip for http server + screen -dmS httpserver python3 -m http.server 8000 + - name: Run target OS first time (for setup actions) + run: > + sudo screen -dmS qemu + qemu-system-s390x -M s390-ccw-virtio + -m 4096 -smp 2 -nographic + -net nic -net user,hostfwd=tcp::2222-:22 + -drive format=raw,file=disk.raw + -kernel vmlinuz-lts + -initrd initramfs-lts + -append "ip=dhcp alpine_repo=https://dl-cdn.alpinelinux.org/alpine/v3.20/main + modloop=https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/s390x/netboot/modloop-lts + ssh_key=http://192.0.2.1:8000/ssh-key.pub" + - name: Check that target OS is running + run: | + sleep 1 + sudo screen -ls + - name: Wait for ssh connection + timeout-minutes: 30 + run: > + while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key root@localhost "exit 0"; + do + echo "Trying to establish ssh connection"; + sleep 5; + done; + cat ~/.ssh/known_hosts + - name: Setup alpine to disk + run: > + ssh -i ssh-key -p2222 root@localhost "setup-alpine -c setup_alpine_conf && + sed -i '/^ROOTSSHKEY\|^DISKOPTS\|^APKREPOSOPTS=/d' setup_alpine_conf && + echo '' >> setup_alpine_conf && + echo 'DISKOPTS=\"-m sys /dev/vda\"' >> setup_alpine_conf && + echo 'ROOTSSHKEY=\"http://192.0.2.1:8000/ssh-key.pub\"' >> setup_alpine_conf && + echo 'APKREPOSOPTS=\"https://dl-cdn.alpinelinux.org/alpine/v3.20/main\"' >> setup_alpine_conf && + cat setup_alpine_conf && + yes | setup-alpine -e -f setup_alpine_conf" + - name: Poweroff the VM + timeout-minutes: 30 + run: > + ssh -i ssh-key -p2222 root@localhost "poweroff" && + while sudo screen -ls; + do + echo "Waiting for poweroff"; + sleep 5; + done; + - name: Run target OS + run: > + sudo screen -dmS qemu + qemu-system-s390x -M s390-ccw-virtio + -m 4096 -smp 2 -nographic + -net nic -net user,hostfwd=tcp::2222-:22 + -drive format=raw,file=disk.raw + - name: Check that target OS is running + run: | + sleep 1 + sudo screen -ls + - name: Wait for ssh connection + timeout-minutes: 30 + run: > + while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key root@localhost "exit 0"; + do + echo "Trying to establish ssh connection"; + sleep 5; + done; + cat ~/.ssh/known_hosts + - name: Display free space, current dir, kernel version and users + run: | + ssh -i ssh-key -p2222 root@localhost "df -h" + ssh -i ssh-key -p2222 root@localhost "pwd" + ssh -i ssh-key -p2222 root@localhost "uname -a" + ssh -i ssh-key -p2222 root@localhost "cat /etc/passwd" + - name: Install build tools (on target OS) + run: > + ssh -i ssh-key -p2222 root@localhost "setup-apkrepos -o && apk add --no-cache git cmake make g++ pcre2-dev openssl-dev linux-headers libucontext-dev lua5.1-dev linux-lts-dev py3-pip + ppp ppp-pppoe iproute2 dhclient && + (pip3 install pytest pytest-dependency pytest-order || pip3 install --break-system-packages pytest pytest-dependency pytest-order)" + - name: Copy source code to target OS + run: | + tar -Jcf accel-ppp.tar.xz accel-ppp + scp -i ssh-key -P2222 accel-ppp.tar.xz root@localhost: + ssh -i ssh-key -p2222 root@localhost "tar -xf accel-ppp.tar.xz" + - name: Build accel-ppp + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp && git config --global --add safe.directory '*' && + mkdir build && cd build && + cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr + -DKDIR=/usr/src/linux-headers-\`uname -r\` + -DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. && + make && make install" + - name: Run tests (not related to ipoe and vlan_mon drivers) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp/tests && + python3 -m pytest -Wall --order-dependencies -v -m \"not ipoe_driver and not vlan_mon_driver and not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: ssh -i ssh-key -p2222 -o ConnectTimeout=5 root@localhost "ps aux | grep accel- && dmesg" + - name: Insert ipoe kernel module + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp && + insmod build/drivers/ipoe/driver/ipoe.ko && + lsmod | grep ipoe" + - name: Run tests (not related to vlan_mon drivers) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp/tests && + python3 -m pytest -Wall --order-dependencies -v -m \"not vlan_mon_driver and not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: ssh -i ssh-key -p2222 -o ConnectTimeout=5 root@localhost "ps aux | grep accel- && dmesg" + - name: Insert vlan_mon kernel module + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp && + insmod build/drivers/vlan_mon/driver/vlan_mon.ko && + lsmod | grep vlan_mon" + - name: Run tests (all) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 root@localhost "cd accel-ppp/tests && + python3 -m pytest -Wall --order-dependencies -v -m \"not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: ssh -i ssh-key -p2222 -o ConnectTimeout=5 root@localhost "ps aux | grep accel- && dmesg" diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3f8016a8..af7b5727 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -26,11 +26,6 @@ jobs: untar: false format: qcow2 - - distro: Ubuntu-20.04 - image: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img - untar: false - format: qcow2 - - distro: Debian13 image: https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-generic-amd64-daily.tar.xz untar: true @@ -56,8 +51,8 @@ jobs: run: > sudo apt update && NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install qemu-system-x86 qemu-utils cloud-image-utils cpu-checker cloud-image-utils wget openssh-client screen - - name: Check kvm support (fail is ok) - run: sudo kvm-ok || exit 0 + - name: Check kvm support + run: sudo kvm-ok - name: Prepare cloud-init image disk run: | ssh-keygen -t ed25519 -q -N "" -f ssh-key @@ -91,9 +86,9 @@ jobs: wget -nv ${{ matrix.image }} -O img/image qemu-img resize -f ${{ matrix.format }} img/`ls -1 img` +2G - name: Run target OS first time (for cloud-init actions) - run: sudo qemu-system-x86_64 -m 4096 -nographic -drive format=${{ matrix.format }},file=img/`ls -1 img` -drive format=raw,file=init.img + run: sudo qemu-system-x86_64 -enable-kvm -cpu host -m 4096 -nographic -drive format=${{ matrix.format }},file=img/`ls -1 img` -drive format=raw,file=init.img - name: Run target OS - run: sudo screen -dmS qemu qemu-system-x86_64 -net nic -net user,hostfwd=tcp::2222-:22 -m 4096 -nographic -drive format=${{ matrix.format }},file=img/`ls -1 img` + run: sudo screen -dmS qemu qemu-system-x86_64 -enable-kvm -cpu host -net nic -net user,hostfwd=tcp::2222-:22 -m 4096 -nographic -drive format=${{ matrix.format }},file=img/`ls -1 img` - name: Check that target OS is running run: | sleep 1 @@ -117,10 +112,12 @@ jobs: run: > ssh -i ssh-key -p2222 user@localhost "sudo apt -y install git build-essential cmake gcc linux-headers-\`uname -r\` - libpcre3-dev libssl-dev liblua5.1-0-dev kmod python3-pip + libpcre2-dev libssl-dev liblua5.1-0-dev kmod python3-pip libxml2-dev libxslt1-dev zlib1g-dev iproute2 ppp pppoe isc-dhcp-client timelimit && - (sudo pip3 install pytest pytest-dependency || sudo pip3 install --break-system-packages pytest pytest-dependency)" + (sudo apt -y install python3-pytest python3-pytest-dependency python3-pytest-order || + sudo pip3 install pytest pytest-dependency pytest-order || + sudo pip3 install --break-system-packages pytest pytest-dependency pytest-order)" - name: Copy source code to target OS run: | tar -Jcf accel-ppp.tar.xz accel-ppp @@ -139,7 +136,7 @@ jobs: timeout-minutes: 5 run: > ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/tests && - sudo python3 -m pytest -Wall -v -m \"not ipoe_driver and not vlan_mon_driver\"" + sudo python3 -m pytest -Wall --order-dependencies -v -m \"not ipoe_driver and not vlan_mon_driver\"" - name: Display processes and dmesg after tests if: ${{ always() }} run: > @@ -157,7 +154,7 @@ jobs: if: ${{ always() }} run: > ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/tests && - sudo python3 -m pytest -Wall -v -m \"not vlan_mon_driver\"" + sudo python3 -m pytest -Wall --order-dependencies -v -m \"not vlan_mon_driver\"" - name: Display processes and dmesg after tests if: ${{ always() }} run: > @@ -174,19 +171,149 @@ jobs: timeout-minutes: 5 run: > ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/tests && - sudo python3 -m pytest -Wall -v" + sudo python3 -m pytest -Wall --order-dependencies -v" - name: Display processes and dmesg after tests if: ${{ always() }} run: > ssh -i ssh-key -p2222 user@localhost "ps aux | grep accel- && sudo dmesg" + Test-in-Alpine: + #if: ${{ false }} # disable for now + runs-on: ubuntu-24.04 + name: Test in Qemu (Alpine) + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: "accel-ppp" + - name: Install qemu and required tools + run: > + sudo apt update && + NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install qemu-system-x86 qemu-utils cloud-image-utils cpu-checker cloud-image-utils wget openssh-client screen + - name: Check kvm support + run: sudo kvm-ok + - name: Prepare cloud-init image disk + run: | + ssh-keygen -t ed25519 -q -N "" -f ssh-key + echo "instance-id: $(uuidgen || echo i-abcdefg)" > init-meta + echo "#cloud-config" > init-data + echo "package_update: true" >> init-data + echo "package_upgrade: true" >> init-data + echo "package_reboot_if_required: false" >> init-data + echo "users:" >> init-data + echo " - default" >> init-data + echo " - name: alpine" >> init-data + echo " shell: /bin/bash" >> init-data + echo " ssh_authorized_keys:" >> init-data + echo " - "`cat ssh-key.pub` >> init-data + echo "power_state:">> init-data + echo " mode: poweroff">> init-data + cat init-data + cloud-localds init.img init-data init-meta + - name: Download and resize target OS cloud image + run: | + mkdir img + # we need to use metal image because virt image doesn't provide pppoe driver (https://gitlab.alpinelinux.org/alpine/aports/-/issues/13739) + wget -nv https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/cloud/nocloud_alpine-3.20.3-x86_64-bios-cloudinit-metal-r0.qcow2 -O img/image + qemu-img resize -f qcow2 img/`ls -1 img` +2G + - name: Run target OS first time (for cloud-init actions) + run: sudo qemu-system-x86_64 -enable-kvm -cpu host -m 4096 -nographic -drive format=qcow2,file=img/`ls -1 img` -drive format=raw,file=init.img + - name: Run target OS + run: sudo screen -dmS qemu qemu-system-x86_64 -enable-kvm -cpu host -net nic -net user,hostfwd=tcp::2222-:22 -m 4096 -nographic -drive format=qcow2,file=img/`ls -1 img` + - name: Check that target OS is running + run: | + sleep 1 + sudo screen -ls + - name: Wait for ssh connection + timeout-minutes: 30 + run: > + while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key alpine@localhost "exit 0"; + do + echo "Trying to establish ssh connection"; + sleep 5; + done; + cat ~/.ssh/known_hosts + - name: Display free space, current dir, kernel version and test doas + run: | + ssh -i ssh-key -p2222 alpine@localhost "df -h" + ssh -i ssh-key -p2222 alpine@localhost "pwd" + ssh -i ssh-key -p2222 alpine@localhost "uname -a" + ssh -i ssh-key -p2222 alpine@localhost "doas cat /etc/passwd" + - name: Install build tools (on target OS) + run: > + ssh -i ssh-key -p2222 alpine@localhost "doas apk add --no-cache git cmake make g++ pcre2-dev libressl-dev linux-headers libucontext-dev lua5.1-dev linux-lts-dev py3-pip + ppp ppp-pppoe && + (doas pip3 install pytest pytest-dependency pytest-order || doas pip3 install --break-system-packages pytest pytest-dependency pytest-order)" + - name: Copy source code to target OS + run: | + tar -Jcf accel-ppp.tar.xz accel-ppp + scp -i ssh-key -P2222 accel-ppp.tar.xz alpine@localhost: + ssh -i ssh-key -p2222 alpine@localhost "tar -xf accel-ppp.tar.xz" + - name: Build accel-ppp + run: > + ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp && + mkdir build && cd build && + cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr + -DKDIR=/usr/src/linux-headers-\`uname -r\` + -DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. && + make && doas make install" + + - name: Run tests (not related to ipoe and vlan_mon drivers) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp/tests && + doas python3 -m pytest -Wall --order-dependencies -v -m \"not ipoe_driver and not vlan_mon_driver and not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: > + ssh -i ssh-key -p2222 alpine@localhost "ps aux | grep accel- && + doas dmesg" + + - name: Insert ipoe kernel module + run: > + ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp && + doas insmod build/drivers/ipoe/driver/ipoe.ko && + lsmod | grep ipoe " + + - name: Run tests (not related to vlan_mon drivers) + timeout-minutes: 5 + if: ${{ always() }} + run: > + ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp/tests && + doas python3 -m pytest -Wall --order-dependencies -v -m \"not vlan_mon_driver and not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: > + ssh -i ssh-key -p2222 alpine@localhost "ps aux | grep accel- && + doas dmesg" + + - name: Insert vlan_mon kernel module + run: > + ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp && + doas insmod build/drivers/vlan_mon/driver/vlan_mon.ko && + lsmod | grep vlan_mon" + + - name: Run tests (all) + timeout-minutes: 5 + run: > + ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp/tests && + doas python3 -m pytest -Wall --order-dependencies -v -m \"not chap_secrets\"" + - name: Display processes and dmesg after tests + if: ${{ always() }} + run: > + ssh -i ssh-key -p2222 alpine@localhost "ps aux | grep accel- && + doas dmesg" + + Test-in-GH: #if: ${{ false }} # disable for now strategy: fail-fast: false matrix: - distro: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"] + distro: ["ubuntu-24.04", "ubuntu-22.04"] runs-on: ${{ matrix.distro }} steps: @@ -195,12 +322,14 @@ jobs: sudo apt update && NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install git build-essential cmake gcc linux-headers-`uname -r` - libpcre3-dev libssl-dev liblua5.1-0-dev kmod python3-pip + libpcre2-dev libssl-dev liblua5.1-0-dev kmod python3-pip iproute2 ppp pppoe isc-dhcp-client - name: Install testing tools (using pip) run: > - sudo pip3 install pytest pytest-dependency || sudo pip3 install --break-system-packages pytest pytest-dependency + sudo apt -y install python3-pytest python3-pytest-dependency python3-pytest-order || + sudo pip3 install pytest pytest-dependency pytest-order || + sudo pip3 install --break-system-packages pytest pytest-dependency pytest-order - name: Check out repository code uses: actions/checkout@v4 @@ -232,14 +361,14 @@ jobs: - name: Run tests timeout-minutes: 5 working-directory: ./tests - run: sudo python3 -m pytest -Wall -v + run: sudo python3 -m pytest -Wall --order-dependencies -v Test-in-GH-Coverage: #if: ${{ false }} # disable for now strategy: fail-fast: false matrix: - distro: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"] + distro: ["ubuntu-24.04", "ubuntu-22.04"] runs-on: ${{ matrix.distro }} steps: @@ -248,12 +377,14 @@ jobs: sudo apt update && NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install git build-essential cmake gcc linux-headers-`uname -r` - libpcre3-dev libssl-dev liblua5.1-0-dev kmod python3-pip + libpcre2-dev libssl-dev liblua5.1-0-dev kmod python3-pip iproute2 ppp pppoe isc-dhcp-client - - name: Install testing tools (using pip) + - name: Install testing tools run: > - sudo pip3 install pytest pytest-dependency gcovr || sudo pip3 install --break-system-packages pytest pytest-dependency gcovr + sudo apt -y install python3-pytest python3-pytest-dependency python3-pytest-order gcovr || + sudo pip3 install pytest pytest-dependency pytest-order gcovr || + sudo pip3 install --break-system-packages pytest pytest-dependency pytest-order gcovr - name: Check out repository code uses: actions/checkout@v4 @@ -286,7 +417,7 @@ jobs: - name: Run tests (for coverage report) (fail is ok) timeout-minutes: 5 working-directory: ./tests - run: sudo python3 -m pytest -Wall -v || exit 0 + run: sudo python3 -m pytest -Wall --order-dependencies -v || exit 0 - name: Generate coverage reports (default(txt), csv, html) run: | |