Merge pull request #3595 from cesanta/tests

Misc fixes and tbd
This commit is contained in:
Sergio R. Caprile
2026-06-09 16:52:55 -03:00
committed by GitHub
5 changed files with 36 additions and 4 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ jobs:
- uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then source ./test/setup_ga_network.sh ; export IPV6=0; sed -i -e "s/127.0.0.1/$HOST_IP/" test/mosquitto.conf; ./test/setup_mqtt_server.sh; else export IPV6=1 ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} > log
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then source ./test/setup_ga_network.sh ; export IPV6=0; sed -i -e "s/127.0.0.1//" test/mosquitto.conf; cat test/mosquitto.conf; ./test/setup_mqtt_server.sh; else export IPV6=1 ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} > log
- if: success() || failure()
run: |
cat log
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
- uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then source ./test/setup_ga_network.sh ; export IPV6=0; sed -i -e "s/127.0.0.1/$HOST_IP/" test/mosquitto.conf; ./test/setup_mqtt_server.sh; else export IPV6=1 ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} > log
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then source ./test/setup_ga_network.sh ; export IPV6=0; sed -i -e "s/127.0.0.1//" test/mosquitto.conf; cat test/mosquitto.conf; ./test/setup_mqtt_server.sh; else export IPV6=1 ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} > log
- if: success() || failure()
run: |
cat log
+23 -1
View File
@@ -70,7 +70,7 @@ static const char *s_ca_cert =
#endif // MQTT_HOST
#endif
static char *host_ip;
static char *host_ip, *host_ip6;
static int s_num_tests = 0;
static bool s_error = false;
@@ -359,6 +359,27 @@ static void test_mqtt_connsubpub(struct mg_mgr *mgr) {
ASSERT(data.passed);
mg_mgr_poll(mgr, 0);
free(data.url);
#if 0
#if defined(MQTT_HOST) && MG_ENABLE_IPV6
if (host_ip6 == NULL) {
printf("\nMQTT_HOST defined but no HOST_IPV6 provided, skipping MQTT IPV6 tests\n");
return;
}
printf("HOST_IPV6: %s\n", host_ip6);
data.url = mg_mprintf("mqtt://[%s]:1883", host_ip6);
#endif
data.passed = false;
s_conn = mg_mqtt_connect(mgr, data.url, &opts, mqtt_fn, &data);
ASSERT(s_conn != NULL);
for (int i = 0; i < 1000 && s_conn != NULL && !s_conn->is_closing; i++) {
mg_mgr_poll(mgr, 0);
usleep(10000); // 10 ms. Slow down poll loop to ensure packets transit
}
ASSERT(data.passed);
mg_mgr_poll(mgr, 0);
free(data.url);
#endif
}
#ifndef NO_HTTPSERVER_TEST
@@ -457,6 +478,7 @@ static void test_tls(struct mg_mgr *mgr) {
bool mip_x_test(struct mg_mgr *mgr) {
host_ip = getenv("HOST_IP");
host_ip6 = getenv("HOST_IPV6");
#define DASHBOARD(x) printf("HEALTH_DASHBOARD\t\"%s\": %s,\n", x, s_error ? "false":"true");
+10 -1
View File
@@ -4,7 +4,8 @@ BRIDGE_BROADCAST=192.168.32.255
BRIDGE_IP=192.168.32.1
BRIDGE_NETWORK=192.168.32.0/24
BRIDGE_MASK=255.255.255.0
# Host network is 'eth0'
BRIDGE_IPV6=fe80::01ff:fe02:0301
# Host outside network interface is 'eth0'
TAP=tap0
# see our network configuration
@@ -24,6 +25,7 @@ echo
echo "Network configuration script: TAP"
sudo ip link add $BRIDGE type bridge # Create brige
sudo ifconfig $BRIDGE $BRIDGE_IP netmask $BRIDGE_MASK up
sudo ip -6 addr add $BRIDGE_IPV6/64 dev $BRIDGE
echo
echo "Create $TAP attached to $BRIDGE"
@@ -46,6 +48,10 @@ sudo iptables -t nat -A POSTROUTING -s $BRIDGE_NETWORK ! -d $BRIDGE_NETWORK -j M
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
echo
HOST_IFC=$BRIDGE
export HOST_IFC
echo "Host inside network interface is $BRIDGE"
# Setup DHCP server
echo "Network configuration script: DHCP server"
echo "Serving from $BRIDGE_IP"
@@ -58,6 +64,9 @@ sudo cp test/dhcpd.conf /etc/dhcp/dhcpd.conf
sudo chmod a+w /var/lib/dhcp/*
sudo dhcpd mg_bridge0 &
echo
HOST_IPV6=$BRIDGE_IPV6
export HOST_IPV6
echo "Listening at $BRIDGE_IPV6"
# Do we have connectivity ?
echo "Check connectivity:"
+1
View File
@@ -10,4 +10,5 @@ sudo ss -tpln | grep 883
# so we need to restart it with the actual config
sudo systemctl restart mosquitto
sudo ss -tpln | grep 883
echo "/var/log/mosquitto/ contents:"
sudo cat /var/log/mosquitto/*