mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-03 00:59:02 +08:00
commit
134ce56f80
52
.github/workflows/test.yml
vendored
52
.github/workflows/test.yml
vendored
@ -1,5 +1,7 @@
|
||||
name: build
|
||||
on: [push, pull_request]
|
||||
env:
|
||||
IPV6: 0
|
||||
jobs:
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
@ -11,51 +13,29 @@ jobs:
|
||||
ssl: [MBEDTLS, OPENSSL]
|
||||
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
||||
env:
|
||||
IPV6: 0
|
||||
CC: ${{ matrix.cc }}
|
||||
SSL: ${{ matrix.ssl }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sudo apt-get update ; sudo apt-get install libmbedtls-dev
|
||||
- run: make ${{ matrix.target }}
|
||||
linux_qemu:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
targets:
|
||||
- target: arm
|
||||
endian: little
|
||||
toolchain: arm-linux-gnueabihf
|
||||
qemu: qemu-arm
|
||||
- target: ppc
|
||||
endian: big
|
||||
toolchain: powerpc-linux-gnu
|
||||
qemu: qemu-ppc
|
||||
- target: ppc64
|
||||
endian: big
|
||||
toolchain: powerpc64-linux-gnu
|
||||
qemu: qemu-ppc64
|
||||
name: linux-${{ matrix.targets.endian }}endian ${{ matrix.targets.target }}
|
||||
env:
|
||||
IPV6: 0
|
||||
CC: ${{ matrix.targets.toolchain }}-gcc
|
||||
ASAN:
|
||||
ASAN_OPTIONS:
|
||||
RUN: ${{ matrix.targets.qemu }} -L /usr/${{ matrix.targets.toolchain }}
|
||||
s390:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt-get dist-upgrade
|
||||
- run: sudo apt-get install --install-suggests qemu-user gcc-${{ matrix.targets.toolchain }}
|
||||
- run: make test
|
||||
#- run: make s390
|
||||
armhf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
#- run: make armhf
|
||||
linux2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sudo apt-get update ; sudo apt-get install libmbedtls-dev valgrind
|
||||
- run: make unamalgamated
|
||||
- run: make valgrind IPV6=0
|
||||
- run: make valgrind
|
||||
- run: make mg_prefix
|
||||
examples:
|
||||
runs-on: ubuntu-latest
|
||||
@ -63,14 +43,14 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sudo apt-get install libmbedtls-dev libpcap-dev
|
||||
- run: make clean examples
|
||||
- run: make clean test IPV6=0 MG_ENABLE_POLL=1
|
||||
- run: make clean test MG_ENABLE_POLL=1
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls openssl
|
||||
- run: make test upload-coverage SSL=OPENSSL IPV6=0 ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
||||
- run: make test SSL=MBEDTLS IPV6=0 ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
|
||||
- run: make test upload-coverage SSL=OPENSSL ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
||||
- run: make test SSL=MBEDTLS ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
|
||||
- run: make mip_test ASAN_OPTIONS=
|
||||
- run: make mg_prefix
|
||||
windows:
|
||||
@ -133,7 +113,7 @@ jobs:
|
||||
name: ${{ matrix.example.path }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.example.name }}
|
||||
- name: ${{ matrix.example.path }}
|
||||
run: make -C examples/${{ matrix.example.path }} build
|
||||
matrix_zephyr_examples:
|
||||
runs-on: ubuntu-latest
|
||||
@ -149,5 +129,5 @@ jobs:
|
||||
name: ${{ matrix.zephyrexample.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.zephyrexample.name }}
|
||||
- name: ${{ matrix.zephyrexample.path }}
|
||||
run: make -C examples/${{ matrix.zephyrexample.path }} zephyr build
|
||||
|
17
Makefile
17
Makefile
@ -41,7 +41,10 @@ CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include
|
||||
LDFLAGS ?= -L$(OPENSSL)/lib -lssl -lcrypto
|
||||
endif
|
||||
|
||||
all: mg_prefix unamalgamated test mip_test arm examples vc98 vc17 vc22 mingw mingw++ fuzz
|
||||
all:
|
||||
$(MAKE) -C examples/http-server
|
||||
|
||||
tall: mg_prefix unamalgamated test mip_test arm examples vc98 vc17 vc22 mingw mingw++ fuzz
|
||||
|
||||
mip_test: test/mip_test.c mongoose.c mongoose.h Makefile
|
||||
$(CC) test/mip_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@
|
||||
@ -100,6 +103,18 @@ valgrind: Makefile mongoose.h mongoose.c
|
||||
$(CC) $(SRCS) $(VALGRIND_CFLAGS) $(LDFLAGS) -g -o unit_test
|
||||
$(VALGRIND_RUN) ./unit_test
|
||||
|
||||
armhf: ASAN=
|
||||
armhf: IPV6=0
|
||||
armhf: CC = $(DOCKER) mdashnet/armhf cc
|
||||
armhf: RUN = $(DOCKER) mdashnet/armhf
|
||||
armhf: test
|
||||
|
||||
s390: ASAN=
|
||||
s390: IPV6=0
|
||||
s390: CC = $(DOCKER) mdashnet/s390 cc
|
||||
s390: RUN = $(DOCKER) mdashnet/s390
|
||||
s390: test
|
||||
|
||||
arm: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_MIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
||||
arm: mongoose.h $(SRCS)
|
||||
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test -nostartfiles --specs nosys.specs -e 0
|
||||
|
@ -41,6 +41,4 @@ monitor: build
|
||||
.PHONY: build
|
||||
|
||||
clean:
|
||||
clean: CMD = rm -rf src/build
|
||||
clean: build
|
||||
|
||||
test -d src/build && $(DOCKER) rm -rf src/build
|
||||
|
@ -404,8 +404,10 @@ typedef unsigned long nfds_t;
|
||||
#define MG_SOCKET_ERRNO WSAGetLastError()
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#ifndef alloca
|
||||
#define alloca(a) _alloca(a)
|
||||
#endif
|
||||
#endif
|
||||
#define poll(a, b, c) WSAPoll((a), (b), (c))
|
||||
#ifndef SO_EXCLUSIVEADDRUSE
|
||||
#define SO_EXCLUSIVEADDRUSE ((int) (~SO_REUSEADDR))
|
||||
|
@ -66,8 +66,10 @@ typedef unsigned long nfds_t;
|
||||
#define MG_SOCKET_ERRNO WSAGetLastError()
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#ifndef alloca
|
||||
#define alloca(a) _alloca(a)
|
||||
#endif
|
||||
#endif
|
||||
#define poll(a, b, c) WSAPoll((a), (b), (c))
|
||||
#ifndef SO_EXCLUSIVEADDRUSE
|
||||
#define SO_EXCLUSIVEADDRUSE ((int) (~SO_REUSEADDR))
|
||||
|
@ -102,7 +102,8 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
stat(argv[i], &st);
|
||||
if (strncmp(name, strip_prefix, n) == 0) name += n;
|
||||
printf(" {\"/%s\", v%d, sizeof(v%d), %lu},\n", name, i, i, st.st_mtime);
|
||||
printf(" {\"/%s\", v%d, sizeof(v%d), %lu},\n", name, i, i,
|
||||
(unsigned long) st.st_mtime);
|
||||
}
|
||||
printf("%s", " {NULL, NULL, 0, 0}\n");
|
||||
printf("%s", "};\n\n");
|
||||
|
@ -2304,7 +2304,7 @@ static void w2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
} else if (ev == MG_EV_WS_MSG) {
|
||||
struct mg_ws_message *wm = (struct mg_ws_message *) ev_data;
|
||||
MG_INFO(("Got WS, %lu", wm->data.len));
|
||||
mg_hexdump(wm->data.ptr, wm->data.len);
|
||||
//mg_hexdump(wm->data.ptr, wm->data.len);
|
||||
if (wm->data.len == 9) {
|
||||
ASSERT(mg_strcmp(wm->data, mg_str("hi there!")) == 0);
|
||||
} else if (wm->data.len == 3) {
|
||||
@ -2635,21 +2635,17 @@ int main(void) {
|
||||
test_str();
|
||||
test_globmatch();
|
||||
test_get_header_var();
|
||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) test_rewrites();
|
||||
test_rewrites();
|
||||
test_check_ip_acl();
|
||||
test_udp();
|
||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
||||
test_pipe();
|
||||
test_packed();
|
||||
}
|
||||
test_crc32();
|
||||
test_multipart();
|
||||
test_invalid_listen_addr();
|
||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
||||
test_http_chunked();
|
||||
test_http_upload();
|
||||
test_http_stream_buffer();
|
||||
}
|
||||
test_http_parse();
|
||||
test_util();
|
||||
test_dns();
|
||||
@ -2660,20 +2656,16 @@ int main(void) {
|
||||
test_base64();
|
||||
test_http_get_var();
|
||||
test_tls();
|
||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
||||
test_ws();
|
||||
test_ws_fragmentation();
|
||||
test_http_client();
|
||||
}
|
||||
if (sizeof(void *) != 4) test_http_server();
|
||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
||||
test_http_server();
|
||||
test_http_404();
|
||||
test_http_no_content_length();
|
||||
test_http_pipeline();
|
||||
test_http_range();
|
||||
}
|
||||
test_sntp();
|
||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) test_mqtt();
|
||||
test_mqtt();
|
||||
printf("SUCCESS. Total tests: %d\n", s_num_tests);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user