This repository has been archived by the owner on Feb 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* async: add new tests (#107) * cmake: add path to windows build * mock: fix warning * dns/client: add async getaddrinfo usage (#112) * dns: refactor IP checks and add system test * use dnsc_getaddrinfo * fmt: workaround for windows compiler * sys: fix unlink and WIN32 * test: cast values to fix WIN32 warnings * trace: fix unlink and WIN32 * main: only run regular tests if GETOPT is missing * test: various fixes for WIN32 * async: fix multithreading tests (#115) * main: if GETOPT is missing run regular tests * cmake: add LINKLIBS variable * test cmake on Windows (#114) * test cmake on Windows * You have an error in your yaml syntax on line 14 * fix yaml syntax error * try to find re * try to find rem * mock: fix win32 warning * fix unlink warnings * fix warnings * fix write * fix size_t * write needs unsigned int * link to win32 libs * add qwave * execute retest.exe in build/debug * set verbose * set verbose * disable all * update flags * ci: fix compiler list and choco * LINKLIBS and flags * test: fix c11 err handling * cmake: use re config (#118) * base64: Encoding/Decoding with URL and Filename Safe Alphabet (#113) * cmake: bump minimum to 3.10 (#119) * Don't fail on compilation when there no OpenSSL on target platform (#120) * trice: fix win32 with explicit error tests (#121) * http: test http/https requests with large body * http: validate body of http requests for get method * http: add test for http conn requests * dns: test dnsc_getaddrinfo_enabled * rtp: Update tests for the changed rtp_send signature. This updates RTP tests for compatibility with this PR: baresip/re#418 * crc32: add re wrapper * sipreg: use TEST_ERR and remove static port test Tests should run without interfere with each other. Looks like on Github Actions runners share the same port range sometimes? So for tests we have to use dynamic ports. * cmake: no need to link to libz * sa: init err * cmake: add optional zlib linking * cmake/FindREM: add rem-static target name * sys: remove old sys div test (#130) * aubuf: refactor aubuf_auframe test (#70) * rtcp: use udp_send() (#132) * rtcp: use udp_send() * rtcp: add workaround for OOM test Co-authored-by: Sebastian Reimers <[email protected]> Co-authored-by: Alfred E. Heggestad <[email protected]> Co-authored-by: Dmitry Ilyin <[email protected]> Co-authored-by: Franz Auernigg <[email protected]> Co-authored-by: Andrey Semashev <[email protected]>
- Loading branch information
1 parent
fcf6251
commit 514de41
Showing
22 changed files
with
717 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,12 @@ jobs: | |
strategy: | ||
matrix: | ||
compiler: [gcc, clang] | ||
os: [ubuntu-latest, macos-latest] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
exclude: | ||
- os: macos-latest | ||
compiler: gcc | ||
- os: windows-latest | ||
compiler: clang | ||
env: | ||
CC: ${{ matrix.compiler }} | ||
|
||
|
@@ -32,6 +34,11 @@ jobs: | |
run: | | ||
echo "OPENSSL_ROOT_DIR=/usr/local/opt/openssl" >> $GITHUB_ENV | ||
- name: install packages | ||
if: ${{ runner.os == 'Windows' }} | ||
run: | | ||
choco install --no-progress openssl | ||
- uses: sreimers/[email protected] | ||
with: | ||
name: re | ||
|
@@ -45,6 +52,7 @@ jobs: | |
secret: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: make re/rem | ||
shell: bash | ||
run: | | ||
for p in re rem; do | ||
cmake -S $p -B $p/build | ||
|
@@ -69,3 +77,10 @@ jobs: | |
run: | | ||
OPENSSL_ROOT_DIR=/usr/local/opt/openssl cmake -DCMAKE_C_FLAGS="-Werror" . && make | ||
./retest -r | ||
- name: retest | ||
if: ${{ runner.os == 'Windows' }} | ||
run: | | ||
cmake -B build -DCMAKE_C_FLAGS="/WX" | ||
cmake --build build | ||
build\Debug\retest.exe -v -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/** | ||
* @file async.c Testcode for re async | ||
* | ||
* Copyright (C) 2022 Sebastian Reimers | ||
*/ | ||
#define _BSD_SOURCE 1 | ||
#define _DEFAULT_SOURCE 1 | ||
|
||
#ifndef WIN32 | ||
#include <netdb.h> | ||
#endif | ||
|
||
#include <string.h> | ||
#include <re.h> | ||
#include "test.h" | ||
|
||
#define DEBUG_MODULE "async" | ||
#define DEBUG_LEVEL 5 | ||
#include <re_dbg.h> | ||
|
||
struct test_cnt { | ||
int tests; | ||
int done; | ||
}; | ||
|
||
struct test { | ||
char domain[128]; | ||
struct sa sa; | ||
int err; | ||
int err_expected; | ||
struct test_cnt *cnt; | ||
}; | ||
|
||
static int blocking_getaddr(void *arg) | ||
{ | ||
int err; | ||
struct test *test = arg; | ||
struct addrinfo *res = NULL; | ||
struct addrinfo hints; | ||
|
||
memset(&hints, 0, sizeof(hints)); | ||
hints.ai_family = AF_INET; | ||
hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG; | ||
|
||
|
||
/* Blocking */ | ||
err = getaddrinfo(test->domain, NULL, &hints, &res); | ||
if (err) | ||
return EADDRNOTAVAIL; | ||
|
||
sa_set_sa(&test->sa, res->ai_addr); | ||
freeaddrinfo(res); | ||
|
||
return 0; | ||
} | ||
|
||
|
||
static void completed(int err, void *arg) | ||
{ | ||
struct test *test = arg; | ||
struct sa sa; | ||
|
||
if (err) | ||
goto out; | ||
|
||
err = re_thread_check(); | ||
TEST_ERR(err); | ||
|
||
sa_set_str(&sa, "127.0.0.1", 0); | ||
if (!sa_cmp(&sa, &test->sa, SA_ADDR)) | ||
err = EINVAL; | ||
|
||
TEST_ERR(err); | ||
|
||
out: | ||
test->err = err; | ||
if (++test->cnt->done >= test->cnt->tests) | ||
re_cancel(); | ||
} | ||
|
||
|
||
int test_async(void) | ||
{ | ||
int err; | ||
|
||
struct test_cnt cnt = {0, 0}; | ||
|
||
struct test testv[] = { | ||
{"localhost", {.len = 0}, -1, 0, &cnt}, | ||
{"test.notfound", {.len = 0}, -1, EADDRNOTAVAIL, &cnt} | ||
}; | ||
|
||
cnt.tests = ARRAY_SIZE(testv); | ||
|
||
err = re_thread_async_init(2); | ||
TEST_ERR(err); | ||
|
||
for (size_t i = 0; i < ARRAY_SIZE(testv); i++) { | ||
err = re_thread_async(blocking_getaddr, completed, &testv[i]); | ||
TEST_ERR(err); | ||
} | ||
|
||
err = re_main_timeout(200); | ||
TEST_ERR(err); | ||
|
||
for (size_t i = 0; i < ARRAY_SIZE(testv); i++) { | ||
TEST_EQUALS(testv[i].err_expected, testv[i].err); | ||
} | ||
|
||
out: | ||
re_thread_async_close(); | ||
return err; | ||
} |
Oops, something went wrong.