mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-01 05:52:32 +07:00
Merge pull request #3262 from cesanta/tests
Push test results for health dashboard
This commit is contained in:
@@ -59,11 +59,17 @@ jobs:
|
||||
env:
|
||||
CC: ${{ matrix.cc }}
|
||||
SSL: ${{ matrix.ssl }}
|
||||
TFLAGS: -DMQTT_LOCALHOST
|
||||
TFLAGS: -DMQTT_LOCALHOST -DNO_ABORT
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -156,9 +162,15 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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: 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:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -178,7 +190,13 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -209,9 +227,15 @@ jobs:
|
||||
name: tutorials ${{ matrix.ssl }}
|
||||
steps:
|
||||
- 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: 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
|
||||
|
||||
tutorials_win:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
|
||||
+3
-1
@@ -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 {
|
||||
FS="\t"
|
||||
print "{"
|
||||
|
||||
+35
-9
@@ -82,7 +82,12 @@ static const char *s_ca_cert =
|
||||
static char *host_ip;
|
||||
|
||||
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
|
||||
#define ABORT() abort()
|
||||
#else
|
||||
@@ -90,6 +95,7 @@ static int s_num_tests = 0;
|
||||
sleep(2); /* 2s, GH print reason */ \
|
||||
abort();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ASSERT(expr) \
|
||||
do { \
|
||||
@@ -101,6 +107,7 @@ static int s_num_tests = 0;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
static struct mg_http_message gethm(const char *buf) {
|
||||
struct mg_http_message hm;
|
||||
memset(&hm, 0, sizeof(hm));
|
||||
@@ -531,22 +538,41 @@ int main(void) {
|
||||
usleep(10000); // 10 ms
|
||||
}
|
||||
|
||||
#define DASHBOARD(x) printf("HEALTH_DASHBOARD\t\"%s\": %s,\n", x, s_error ? "false":"true");
|
||||
|
||||
// RUN TESTS
|
||||
usleep(500000); // 500 ms
|
||||
s_error = false;
|
||||
test_http_client(&mgr);
|
||||
usleep(500000); // 500 ms
|
||||
test_http_server(&mgr);
|
||||
usleep(500000); // 500 ms
|
||||
test_tls(&mgr);
|
||||
usleep(500000); // 500 ms
|
||||
test_mqtt_connsubpub(&mgr);
|
||||
usleep(500000); // 500 ms
|
||||
DASHBOARD("http_client");
|
||||
|
||||
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
|
||||
s_error = false;
|
||||
mg_mgr_free(&mgr);
|
||||
ASSERT(mgr.conns == NULL); // Deconstruction OK
|
||||
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
@@ -6,9 +6,14 @@
|
||||
#include "driver_mock.c"
|
||||
|
||||
static int s_num_tests = 0;
|
||||
static bool s_error = false;
|
||||
static int s_sent_fragment = 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
|
||||
#define ABORT() abort()
|
||||
#else
|
||||
@@ -16,6 +21,7 @@ static int s_seg_sent = 0;
|
||||
sleep(2); /* 2s, GH print reason */ \
|
||||
abort();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ASSERT(expr) \
|
||||
do { \
|
||||
@@ -27,6 +33,7 @@ static int s_seg_sent = 0;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
static void test_csum(void) {
|
||||
uint8_t ip[20] = {0x45, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x28, 0x11,
|
||||
0x94, 0xcf, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01};
|
||||
@@ -811,12 +818,35 @@ static void test_tcp(void) {
|
||||
test_tcp_retransmit();
|
||||
}
|
||||
|
||||
|
||||
#define DASHBOARD(x) printf("HEALTH_DASHBOARD\t\"%s\": %s,\n", x, s_error ? "false":"true");
|
||||
|
||||
int main(void) {
|
||||
s_error = false;
|
||||
test_csum();
|
||||
DASHBOARD("checksum");
|
||||
|
||||
s_error = false;
|
||||
test_statechange();
|
||||
DASHBOARD("statechange");
|
||||
|
||||
s_error = false;
|
||||
test_poll();
|
||||
DASHBOARD("poll");
|
||||
|
||||
s_error = false;
|
||||
test_tcp();
|
||||
DASHBOARD("tcp");
|
||||
|
||||
s_error = false;
|
||||
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);
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user