Skip to content

Commit a563448

Browse files
committed
Added DHCP + HTTPS-over-TLS13 m33mu test, up m33mu
1 parent 689f2a6 commit a563448

2 files changed

Lines changed: 136 additions & 1 deletion

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: STM32H563 m33mu (HTTPS TLS 1.3)
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
stm32h563_m33mu_https_tls13:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 25
13+
container:
14+
image: ghcr.io/danielinux/m33mu-ci:1.6
15+
options: --privileged
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install host tools
21+
run: |
22+
set -euo pipefail
23+
apt-get update
24+
apt-get install -y sudo dnsmasq iproute2 curl git tcpdump
25+
26+
- name: Fetch wolfSSL
27+
run: |
28+
set -euo pipefail
29+
if [ ! -d ../wolfssl ]; then
30+
git clone --depth 1 --branch master https://github.com/wolfSSL/wolfssl.git ../wolfssl
31+
fi
32+
33+
- name: Build STM32H563 HTTPS (TZEN off)
34+
run: |
35+
set -euo pipefail
36+
make -C src/port/stm32h563 clean TZEN=0 ENABLE_HTTPS=1 CC=arm-none-eabi-gcc OBJCOPY=arm-none-eabi-objcopy
37+
make -C src/port/stm32h563 TZEN=0 ENABLE_HTTPS=1 CC=arm-none-eabi-gcc OBJCOPY=arm-none-eabi-objcopy
38+
strings src/port/stm32h563/app.bin | grep -q "Initializing HTTPS server"
39+
40+
- name: Run m33mu + DHCP + HTTPS test
41+
timeout-minutes: 15
42+
run: |
43+
set -euo pipefail
44+
45+
cleanup() {
46+
set +e
47+
if [ -f /tmp/m33mu.pid ]; then
48+
sudo kill "$(cat /tmp/m33mu.pid)" 2>/dev/null || true
49+
fi
50+
if [ -f /tmp/tcpdump.pid ]; then
51+
sudo kill "$(cat /tmp/tcpdump.pid)" 2>/dev/null || true
52+
fi
53+
sudo pkill -x m33mu 2>/dev/null || true
54+
if [ -f /tmp/dnsmasq.pid ]; then
55+
sudo kill "$(cat /tmp/dnsmasq.pid)" 2>/dev/null || true
56+
fi
57+
sudo ip link del tap0 2>/dev/null || true
58+
}
59+
trap cleanup EXIT
60+
61+
sudo ip tuntap add dev tap0 mode tap
62+
sudo ip addr add 192.168.12.1/24 dev tap0
63+
sudo ip link set tap0 up
64+
65+
cat > /tmp/dnsmasq.conf <<'CONF'
66+
interface=tap0
67+
bind-interfaces
68+
dhcp-range=192.168.12.50,192.168.12.100,255.255.255.0,12h
69+
dhcp-leasefile=/tmp/dnsmasq.leases
70+
log-dhcp
71+
CONF
72+
sudo dnsmasq --conf-file=/tmp/dnsmasq.conf --pid-file=/tmp/dnsmasq.pid
73+
74+
sudo tcpdump -i tap0 -nn -U -w /tmp/https-test.pcap > /tmp/tcpdump.log 2>&1 &
75+
echo $! > /tmp/tcpdump.pid
76+
77+
sudo m33mu src/port/stm32h563/app.bin \
78+
--cpu stm32h563 --tap:tap0 --uart-stdout --timeout 180 --quit-on-faults \
79+
2>&1 | tee /tmp/m33mu.log &
80+
sleep 1
81+
m33mu_pid="$(pgrep -n -x m33mu || true)"
82+
if [ -n "${m33mu_pid}" ]; then
83+
echo "${m33mu_pid}" > /tmp/m33mu.pid
84+
fi
85+
86+
ip=""
87+
for _ in $(seq 1 90); do
88+
if [ -s /tmp/dnsmasq.leases ]; then
89+
ip="$(tail -n1 /tmp/dnsmasq.leases | cut -d' ' -f3)"
90+
fi
91+
if [ -n "${ip}" ]; then
92+
break
93+
fi
94+
sleep 1
95+
done
96+
if [ -z "${ip}" ]; then
97+
echo "No DHCP lease acquired."
98+
echo "m33mu log:"
99+
tail -n 200 /tmp/m33mu.log || true
100+
exit 1
101+
fi
102+
echo "Leased IP: ${ip}"
103+
104+
ok=0
105+
for _ in $(seq 1 60); do
106+
if ! pgrep -x m33mu >/dev/null 2>&1; then
107+
echo "m33mu exited before HTTPS check."
108+
tail -n 200 /tmp/m33mu.log || true
109+
exit 1
110+
fi
111+
if curl --silent --show-error --fail --insecure --tlsv1.3 \
112+
--connect-timeout 10 --max-time 20 \
113+
"https://${ip}/" | tee /tmp/curl.log | grep -q "wolfIP"; then
114+
ok=1
115+
break
116+
fi
117+
sleep 0.5
118+
done
119+
if [ "${ok}" -ne 1 ]; then
120+
echo "HTTPS test failed."
121+
echo "m33mu log:"
122+
tail -n 200 /tmp/m33mu.log || true
123+
echo "curl log:"
124+
tail -n 200 /tmp/curl.log || true
125+
echo "tcpdump log:"
126+
tail -n 50 /tmp/tcpdump.log || true
127+
exit 1
128+
fi
129+
echo "HTTPS test succeeded."
130+
if [ -f /tmp/m33mu.pid ]; then
131+
sudo kill "$(cat /tmp/m33mu.pid)" 2>/dev/null || true
132+
fi
133+
if [ -f /tmp/tcpdump.pid ]; then
134+
sudo kill "$(cat /tmp/tcpdump.pid)" 2>/dev/null || true
135+
fi

.github/workflows/stm32h563-m33mu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 20
1313
container:
14-
image: ghcr.io/danielinux/m33mu-ci:1.5
14+
image: ghcr.io/danielinux/m33mu-ci:1.6
1515
options: --privileged
1616

1717
steps:

0 commit comments

Comments
 (0)