From 5bf953cb4adda266d6171f2a836d970247851fb6 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 30 Jun 2026 14:28:45 -0300 Subject: [PATCH] add C89 and bigendian tests for L2, be for MIP --- .github/workflows/nightly.yml | 45 +++++++++++++++++++++++--- .github/workflows/on_demand.yml | 56 ++++++++++++++++++++++++++++++++- test/Makefile | 22 +++++++++++-- test/mip_test.c | 4 +-- 4 files changed, 118 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cfd0d168..2dca94bf 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -51,6 +51,7 @@ jobs: cat log test/health.awk < log > json scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/linux_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json" + mip: runs-on: ubuntu-latest strategy: @@ -85,14 +86,26 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - max-parallel: 1 # no parallel runs, to minimize MQTT errors matrix: target: [mip_vc98] - name: mip89 ${{ matrix.target }} + ipv6: [0, 1] + name: MIP C89 ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} steps: - uses: actions/checkout@v5 with: { fetch-depth: 2 } - - run: make -C test ${{ matrix.target }} IPV6=1 + - run: make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + mipbe: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [mip_s390] + ipv6: [0, 1] + name: MIP be ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} l2: runs-on: ubuntu-latest @@ -102,7 +115,7 @@ jobs: cc: [gcc, clang, g++, clang++] target: [eth_test, ppp_test] ipv6: [0, 1] - name: ${{ matrix.target }} CC=${{ matrix.cc }} IPV6=${{ matrix.ipv6 }} + name: L2 ${{ matrix.target }} CC=${{ matrix.cc }} IPV6=${{ matrix.ipv6 }} steps: - uses: actions/checkout@v5 with: { fetch-depth: 2 } @@ -115,6 +128,30 @@ jobs: cat log test/health.awk < log > json scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ipv6 }}_$(date +"%Y%m%d").json" + l289: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [eth_vc98, ppp_vc98] + ipv6: [0, 1] + name: L2 C89 ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + l2be: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [eth_s390, ppp_s390] + ipv6: [0, 1] + name: L2 be ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} s390: runs-on: ubuntu-latest diff --git a/.github/workflows/on_demand.yml b/.github/workflows/on_demand.yml index f0003ac0..4fc23528 100644 --- a/.github/workflows/on_demand.yml +++ b/.github/workflows/on_demand.yml @@ -4,6 +4,31 @@ on: env: IPV6: 0 jobs: + mip89: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [mip_vc98] + ipv6: [0, 1] + name: MIP C89 ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + mipbe: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [mip_s390] + ipv6: [0, 1] + name: MIP be ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + l2: runs-on: ubuntu-latest strategy: @@ -12,7 +37,7 @@ jobs: cc: [gcc, clang, g++, clang++] target: [eth_test, ppp_test] ipv6: [0, 1] - name: ${{ matrix.target }} CC=${{ matrix.cc }} IPV6=${{ matrix.ipv6 }} + name: L2 ${{ matrix.target }} CC=${{ matrix.cc }} IPV6=${{ matrix.ipv6 }} steps: - uses: actions/checkout@v5 with: { fetch-depth: 2 } @@ -20,6 +45,35 @@ jobs: with: ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }} - run: make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} CC=${{ matrix.cc }} > log + - if: success() || failure() + run: | + cat log + test/health.awk < log > json + scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ipv6 }}_$(date +"%Y%m%d").json" + l289: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [eth_vc98, ppp_vc98] + ipv6: [0, 1] + name: L2 C89 ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + l2be: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [eth_s390, ppp_s390] + ipv6: [0, 1] + name: L2 be ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} + steps: + - uses: actions/checkout@v5 + with: { fetch-depth: 2 } + - run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test ${{ matrix.target }} IPV6=${{ matrix.ipv6 }} # macos: diff --git a/test/Makefile b/test/Makefile index fbefbd06..f5d73a38 100644 --- a/test/Makefile +++ b/test/Makefile @@ -29,7 +29,7 @@ COMMON_CFLAGS ?= $(C_WARN) $(WARN) $(INCS) $(DEFS) -DMG_ENABLE_IPV6=$(IPV6) $(TF CFLAGS ?= $(OPTS) $(ASAN) $(COMMON_CFLAGS) VALGRIND_CFLAGS ?= $(OPTS) $(COMMON_CFLAGS) VALGRIND_RUN ?= valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --show-leak-kinds=all --leak-resolution=high --track-origins=yes --error-exitcode=1 --exit-on-first-error=yes --fair-sched=yes -.PHONY: clean_tutorials tutorials mip_test eth_test ppp_test test valgrind +.PHONY: tutorials mip_test eth_test ppp_test eth_vc98 ppp_vc98 eth_s390 ppp_s390 test valgrind ifeq "$(findstring ++,$(CC))" "" # $(CC) does not end with ++, i.e. we're using C. Apply C flags @@ -81,7 +81,7 @@ endif all: $(MAKE) -C ../tutorials/http/http-server -tall: mg_prefix unamalgamated test valgrind fuzz fuzz_tls vc98 vc17 vc22 mingw mingw++ arm armhf riscv s390 tutorials tutorials_win tutorials_embedded mip_test eth_test ppp_test mip_vc98 +tall: mg_prefix unamalgamated test valgrind fuzz fuzz_tls vc98 vc17 vc22 mingw mingw++ arm armhf riscv s390 tutorials tutorials_win tutorials_embedded mip_test eth_test ppp_test mip_vc98 eth_vc98 ppp_vc98 eth_s390 ppp_s390 mip_test: mip_test.c mongoose.c mongoose.h packed_fs.c Makefile $(CC) mip_test.c packed_fs.c $(CFLAGS) $(LDFLAGS) -o $@ @@ -112,6 +112,14 @@ mip_vc98: mip_test.c mongoose.c mongoose.h packed_fs.c Makefile $(DOCKER) mdashnet/vc98 wine cl mip_test.c packed_fs.c $(VCFLAGS) $(DEFS) $(TFLAGS) /Fe$@.exe $(DOCKER) -e WINEPREFIX=/tmp/wineprefix mdashnet/vc98 wine $@.exe +eth_vc98: eth_test.c mongoose.c mongoose.h Makefile + $(DOCKER) mdashnet/vc98 wine cl eth_test.c $(VCFLAGS) $(DEFS) $(TFLAGS) /Fe$@.exe + $(DOCKER) -e WINEPREFIX=/tmp/wineprefix mdashnet/vc98 wine $@.exe + +ppp_vc98: ppp_test.c driver_mock.c mongoose.c mongoose.h Makefile + $(DOCKER) mdashnet/vc98 wine cl ppp_test.c $(VCFLAGS) $(DEFS) $(TFLAGS) /Fe$@.exe + $(DOCKER) -e WINEPREFIX=/tmp/wineprefix mdashnet/vc98 wine $@.exe + packed_fs.c: Makefile data/ssi.h fuzz.c data/a.txt data/ca.pem certs/ca.crt certs/server.crt certs/server.key $(CC) $(CFLAGS) pack.c -o pack $(RUN) ./pack Makefile data/ssi.h fuzz.c data/a.txt data/range.txt data/ca.pem certs/ca.crt certs/server.crt certs/server.key certs/client.key certs/client.crt > $@ @@ -205,6 +213,16 @@ mip_s390: CC = $(DOCKER) mdashnet/s390 cc mip_s390: RUN = $(DOCKER) --init mdashnet/s390 mip_s390: mip_test +eth_s390: ASAN= +eth_s390: CC = $(DOCKER) mdashnet/s390 cc +eth_s390: RUN = $(DOCKER) --init mdashnet/s390 +eth_s390: eth_test + +ppp_s390: ASAN= +ppp_s390: CC = $(DOCKER) mdashnet/s390 cc +ppp_s390: RUN = $(DOCKER) --init mdashnet/s390 +ppp_s390: ppp_test + mip_port_s390: ASAN= mip_port_s390: IPV6=0 # This test requires curl, not present in this image diff --git a/test/mip_test.c b/test/mip_test.c index 270703a8..908e4b8f 100644 --- a/test/mip_test.c +++ b/test/mip_test.c @@ -158,7 +158,7 @@ static void frag_send_fn(struct mg_connection *c, int ev, void *ev_data) { } } else if (ev == MG_EV_WRITE) { // Checking TCP segment sizes (ev_data points to the TCP payload length) - ASSERT(*(int *) ev_data == s_seg_sizes[s_seg_sent++]); + ASSERT(*(long *) ev_data == s_seg_sizes[s_seg_sent++]); } (void) c, (void) ev_data; } @@ -298,7 +298,7 @@ static void init_tests(struct mg_mgr *mgr, struct eth *e, struct ipp *ipp, mif->ip = mg_htonl(0x1000000); mif->gw = mg_htonl(0x1000000); mif->gw_ready = true; - mif->mask = 255; // use router, to avoid firing an ARP request + mif->mask = mg_htonl(0xff000000); // use router, avoid firing ARP request mif->state = MG_TCPIP_STATE_READY; // so mg_send() works and DHCP stops } mg_tcpip_init(mgr, mif);