mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-24 02:59:01 +08:00
Move tests -> test
This commit is contained in:
parent
6197842bca
commit
cb7743fa39
@ -4,7 +4,7 @@ after_success: bash <(curl -s https://codecov.io/bash)
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- windows
|
||||
# - windows
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
7
Makefile
7
Makefile
@ -8,7 +8,8 @@ VC98 = docker run --rm -e WINEDEBUG=-all -v $(CDIR):$(CDIR) -w $(CDIR) docker.io
|
||||
VC2017 = docker run --rm -e WINEDEBUG=-all -v $(CDIR):$(CDIR) -w $(CDIR) docker.io/mdashnet/vc2017
|
||||
GCC = docker run --rm -v $(CDIR):$(CDIR) -w $(CDIR) mdashnet/cc2
|
||||
VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
|
||||
CLANG ?= /usr/local/opt/llvm\@9/bin/clang #-L/usr/local/opt/llvm\@8/lib
|
||||
CLANG ?= clang # /usr/local/opt/llvm\@9/bin/clang
|
||||
ASAN_OPTIONS ?=
|
||||
EXAMPLES := $(wildcard examples/*)
|
||||
EXAMPLE_TARGET ?= example
|
||||
.PHONY: $(EXAMPLES)
|
||||
@ -46,11 +47,11 @@ fuzz: mongoose.c mongoose.h Makefile test/fuzz.c
|
||||
$(CLANG) mongoose.c test/fuzz.c $(CFLAGS) -DMG_ENABLE_LOG=0 -fsanitize=fuzzer,signed-integer-overflow,address $(LDFLAGS) -g -o fuzzer
|
||||
$(DEBUGGER) ./fuzzer
|
||||
|
||||
# make CC=/usr/local/opt/llvm\@8/bin/clang DEBUGGER=ASAN_OPTIONS=detect_leaks=1
|
||||
# make CLANG=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
|
||||
test: CFLAGS += -DMG_ENABLE_IPV6=1 -fsanitize=address#,undefined
|
||||
test: mongoose.c mongoose.h clean Makefile test/unit_test.c
|
||||
$(CLANG) mongoose.c test/unit_test.c $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
|
||||
ASAN_OPTIONS=detect_leaks=1 $(DEBUGGER) ./unit_test
|
||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(DEBUGGER) ./unit_test
|
||||
|
||||
coverage: test
|
||||
gcov -l -n *.gcno | sed '/^$$/d' | sed 'N;s/\n/ /'
|
||||
|
@ -340,7 +340,7 @@ static void eh1(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
} else if (mg_http_match_uri(hm, "/badroot")) {
|
||||
mg_http_serve_dir(c, hm, "/BAAADDD!");
|
||||
} else {
|
||||
mg_http_serve_dir(c, hm, "./tests/data");
|
||||
mg_http_serve_dir(c, hm, "./test/data");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -395,11 +395,11 @@ static int fetch(struct mg_mgr *mgr, char *buf, const char *url,
|
||||
if (mg_url_is_ssl(url)) {
|
||||
struct mg_tls_opts opts;
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
opts.ca = "./tests/data/ca.pem";
|
||||
opts.ca = "./test/data/ca.pem";
|
||||
if (strstr(url, "127.0.0.1") != NULL) {
|
||||
// Local connection, use self-signed certificates
|
||||
opts.ca = "./tests/data/ss_ca.pem";
|
||||
opts.cert = "./tests/data/ss_client.pem";
|
||||
opts.ca = "./test/data/ss_ca.pem";
|
||||
opts.cert = "./test/data/ss_client.pem";
|
||||
}
|
||||
mg_tls_init(c, &opts);
|
||||
// c->is_hexdumping = 1;
|
||||
@ -436,7 +436,7 @@ static void test_http_server(void) {
|
||||
{
|
||||
extern char *mg_http_etag(char *, size_t, struct stat *);
|
||||
char etag[100];
|
||||
ASSERT(stat("./tests/data/a.txt", &st) == 0);
|
||||
ASSERT(stat("./test/data/a.txt", &st) == 0);
|
||||
ASSERT(mg_http_etag(etag, sizeof(etag), &st) == etag);
|
||||
ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\nIf-None-Match: %s\n\n",
|
||||
etag) == 304);
|
||||
@ -460,7 +460,7 @@ static void test_http_server(void) {
|
||||
#endif
|
||||
|
||||
{
|
||||
char *data = mg_file_read("./tests/data/ca.pem");
|
||||
char *data = mg_file_read("./test/data/ca.pem");
|
||||
ASSERT(fetch(&mgr, buf, url, "GET /ca.pem HTTP/1.0\r\n\n") == 200);
|
||||
ASSERT(cmpbody(data, buf) == 0);
|
||||
free(data);
|
||||
@ -476,8 +476,8 @@ static void test_http_server(void) {
|
||||
|
||||
static void test_tls(void) {
|
||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
||||
struct mg_tls_opts opts = {.ca = "./tests/data/ss_ca.pem",
|
||||
.cert = "./tests/data/ss_server.pem"};
|
||||
struct mg_tls_opts opts = {.ca = "./test/data/ss_ca.pem",
|
||||
.cert = "./test/data/ss_server.pem"};
|
||||
struct mg_mgr mgr;
|
||||
struct mg_connection *c;
|
||||
const char *url = "https://127.0.0.1:12347";
|
||||
@ -526,7 +526,7 @@ static void test_http_client(void) {
|
||||
ok = 0;
|
||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
||||
{
|
||||
struct mg_tls_opts opts = {.ca = "./tests/data/ca.pem"};
|
||||
struct mg_tls_opts opts = {.ca = "./test/data/ca.pem"};
|
||||
c = mg_http_connect(&mgr, "https://cesanta.com", f3, &ok);
|
||||
ASSERT(c != NULL);
|
||||
mg_tls_init(c, &opts);
|
||||
|
Loading…
Reference in New Issue
Block a user