Push test results for health dashboard

This commit is contained in:
Sergio R. Caprile committed 2025-09-01 14:52:37 -03:00
1 parent bf4dd15317
commit 3baabebb34
4 files changed
+99 -17

No files matched your search

+30 -6
View File
@@ -59,11 +59,17 @@ jobs:
env: env:
CC: ${{ matrix.cc }} CC: ${{ matrix.cc }}
SSL: ${{ matrix.ssl }} SSL: ${{ matrix.ssl }}
TFLAGS: -DMQTT_LOCALHOST TFLAGS: -DMQTT_LOCALHOST -DNO_ABORT
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: { fetch-depth: 2 } with: { fetch-depth: 2 }
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then ./test/setup_ga_network.sh ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} IPV6=0 - uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then ./test/setup_ga_network.sh ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} IPV6=0 > log
- run: test/health.awk < log > json
- run: scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ssl }}_$(date +"%Y%m%d").json"
mip89: mip89:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@@ -156,9 +162,15 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: { fetch-depth: 2 } with: { fetch-depth: 2 }
- run: brew install mbedtls wolfssl mosquitto # jq openssl already pre-installed - uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
- run: brew install mbedtls wolfssl mosquitto gawk # jq openssl already pre-installed
- run: /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /Users/runner/work/mongoose/mongoose/test/mosquitto.conf.macos & - run: /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /Users/runner/work/mongoose/mongoose/test/mosquitto.conf.macos &
- run: make -C test test ASAN_OPTIONS= MBEDTLS=$(echo $(brew --cellar)/mbedtls*/*) OPENSSL=$(echo $(brew --cellar)/openssl*/*) WOLFSSL=$(echo $(brew --cellar)/wolfssl*/*) - run: make -C test test ASAN_OPTIONS= MBEDTLS=$(echo $(brew --cellar)/mbedtls*/*) OPENSSL=$(echo $(brew --cellar)/openssl*/*) WOLFSSL=$(echo $(brew --cellar)/wolfssl*/*) > log
- run: test/health.awk < log > json
- run: scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/macos_test_cc_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json"
windows: windows:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@@ -178,7 +190,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: { fetch-depth: 2 } with: { fetch-depth: 2 }
- run: ./test/setup_mqtt_server.sh && make -C test ${{ matrix.target }} - uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
- run: ./test/setup_mqtt_server.sh && make -C test ${{ matrix.target }} > log
- run: test/health.awk < log > json
- run: scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/windows_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json"
arm: arm:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@@ -209,9 +227,15 @@ jobs:
name: tutorials ${{ matrix.ssl }} name: tutorials ${{ matrix.ssl }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
- run: sudo apt -y install libpcap-dev - run: sudo apt -y install libpcap-dev
- run: make -C test tutorials CFLAGS_EXTRA="${{ matrix.ssl }}" - run: make -C test tutorials CFLAGS_EXTRA="${{ matrix.ssl }}" > log
- run: test/health.awk < log > json
- run: scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/tutorials_${{ matrix.ssl }}_$(date +"%Y%m%d").json"
- run: make -C test clean_tutorials - run: make -C test clean_tutorials
tutorials_win: tutorials_win:
runs-on: windows-latest runs-on: windows-latest
strategy: strategy:
+3 -1
View File
@@ -1,4 +1,6 @@
#!/usr/bin/awk -f #!/usr/bin/env -S gawk -f
# gawk used to avoid "towc" errors seen on MacOS. env used to circumvent brew installing it wherever they like
BEGIN { BEGIN {
FS="\t" FS="\t"
print "{" print "{"
+35 -9
View File
@@ -82,7 +82,12 @@ static const char *s_ca_cert =
static char *host_ip; static char *host_ip;
static int s_num_tests = 0; static int s_num_tests = 0;
static bool s_error = false;
#ifdef NO_ABORT
static int s_abort = 0;
#define ABORT() ++s_abort, s_error = true
#else
#ifdef NO_SLEEP_ABORT #ifdef NO_SLEEP_ABORT
#define ABORT() abort() #define ABORT() abort()
#else #else
@@ -90,6 +95,7 @@ static int s_num_tests = 0;
sleep(2); /* 2s, GH print reason */ \ sleep(2); /* 2s, GH print reason */ \
abort(); abort();
#endif #endif
#endif
#define ASSERT(expr) \ #define ASSERT(expr) \
do { \ do { \
@@ -101,6 +107,7 @@ static int s_num_tests = 0;
} \ } \
} while (0) } while (0)
static struct mg_http_message gethm(const char *buf) { static struct mg_http_message gethm(const char *buf) {
struct mg_http_message hm; struct mg_http_message hm;
memset(&hm, 0, sizeof(hm)); memset(&hm, 0, sizeof(hm));
@@ -531,22 +538,41 @@ int main(void) {
usleep(10000); // 10 ms usleep(10000); // 10 ms
} }
#define DASHBOARD(x) printf("HEALTH_DASHBOARD\t\"%s\": %s,\n", x, s_error ? "false":"true");
// RUN TESTS // RUN TESTS
usleep(500000); // 500 ms usleep(500000); // 500 ms
s_error = false;
test_http_client(&mgr); test_http_client(&mgr);
usleep(500000); // 500 ms DASHBOARD("http_client");
test_http_server(&mgr);
usleep(500000); // 500 ms
test_tls(&mgr);
usleep(500000); // 500 ms
test_mqtt_connsubpub(&mgr);
usleep(500000); // 500 ms
printf("SUCCESS. Total tests: %d\n", s_num_tests); usleep(500000); // 500 ms
s_error = false;
test_http_server(&mgr);
DASHBOARD("http_server");
usleep(500000); // 500 ms
s_error = false;
test_tls(&mgr);
DASHBOARD("tls");
usleep(500000); // 500 ms
s_error = false;
test_mqtt_connsubpub(&mgr);
DASHBOARD("mqtt");
// Clear // Clear
s_error = false;
mg_mgr_free(&mgr); mg_mgr_free(&mgr);
ASSERT(mgr.conns == NULL); // Deconstruction OK ASSERT(mgr.conns == NULL); // Deconstruction OK
close(fd); close(fd);
return 0; printf("HEALTH_DASHBOARD\t\"cleanup\": %s\n", s_error ? "false":"true");
// last entry with no comma
#ifdef NO_ABORT
if (s_abort != 0) return EXIT_FAILURE;
#endif
printf("SUCCESS. Total tests: %d\n", s_num_tests);
return EXIT_SUCCESS;
} }
+31 -1
View File
@@ -6,9 +6,14 @@
#include "driver_mock.c" #include "driver_mock.c"
static int s_num_tests = 0; static int s_num_tests = 0;
static bool s_error = false;
static int s_sent_fragment = 0; static int s_sent_fragment = 0;
static int s_seg_sent = 0; static int s_seg_sent = 0;
#ifdef NO_ABORT
static int s_abort = 0;
#define ABORT() ++s_abort, s_error = true
#else
#ifdef NO_SLEEP_ABORT #ifdef NO_SLEEP_ABORT
#define ABORT() abort() #define ABORT() abort()
#else #else
@@ -16,6 +21,7 @@ static int s_seg_sent = 0;
sleep(2); /* 2s, GH print reason */ \ sleep(2); /* 2s, GH print reason */ \
abort(); abort();
#endif #endif
#endif
#define ASSERT(expr) \ #define ASSERT(expr) \
do { \ do { \
@@ -27,6 +33,7 @@ static int s_seg_sent = 0;
} \ } \
} while (0) } while (0)
static void test_csum(void) { static void test_csum(void) {
uint8_t ip[20] = {0x45, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x28, 0x11, uint8_t ip[20] = {0x45, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x28, 0x11,
0x94, 0xcf, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01}; 0x94, 0xcf, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01};
@@ -811,12 +818,35 @@ static void test_tcp(void) {
test_tcp_retransmit(); test_tcp_retransmit();
} }
#define DASHBOARD(x) printf("HEALTH_DASHBOARD\t\"%s\": %s,\n", x, s_error ? "false":"true");
int main(void) { int main(void) {
s_error = false;
test_csum(); test_csum();
DASHBOARD("checksum");
s_error = false;
test_statechange(); test_statechange();
DASHBOARD("statechange");
s_error = false;
test_poll(); test_poll();
DASHBOARD("poll");
s_error = false;
test_tcp(); test_tcp();
DASHBOARD("tcp");
s_error = false;
test_fragmentation(); test_fragmentation();
printf("HEALTH_DASHBOARD\t\"ipfrag\": %s\n", s_error ? "false":"true");
// last entry with no comma
#ifdef NO_ABORT
if (s_abort != 0) return EXIT_FAILURE;
#endif
printf("SUCCESS. Total tests: %d\n", s_num_tests); printf("SUCCESS. Total tests: %d\n", s_num_tests);
return 0; return EXIT_SUCCESS;
} }