forked from accel-ppp/accel-ppp
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (155 loc) · 6.63 KB
/
run-tests-bigendian.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Run tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- be
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 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-s390x 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/latest-stable/releases/s390x/netboot/vmlinuz-lts
wget -nv https://dl-cdn.alpinelinux.org/alpine/latest-stable/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/latest-stable/main
modloop=https://dl-cdn.alpinelinux.org/alpine/latest-stable/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.cfg &&
sed -i '/^ROOTSSHKEY\|^DISKOPTS\|^APKREPOSOPTS=/d' setup.cfg &&
echo '' >> setup.cfg &&
echo 'DISKOPTS=\"-m sys /dev/vda\"' >> setup.cfg &&
echo 'ROOTSSHKEY=\"http://192.0.2.1:8000/ssh-key.pub\"' >> setup.cfg &&
echo 'APKREPOSOPTS=\"https://dl-cdn.alpinelinux.org/alpine/latest-stable/main\"' >> setup.cfg &&
cat setup.cfg &&
yes | setup-alpine -e -f setup.cfg"
- 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++ pcre-dev openssl-dev linux-headers libucontext-dev lua5.1-dev linux-lts-dev py3-pip
ppp ppp-pppoe &&
(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 rooot@localhost "tar -xf accel-ppp.tar.xz"
- name: Build accel-ppp
run: >
ssh -i ssh-key -p2222 root@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 && 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\""
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: ssh -i ssh-key -p2222 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\""
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: ssh -i ssh-key -p2222 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"
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: ssh -i ssh-key -p2222 root@localhost "ps aux | grep accel- && dmesg"