Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \file */
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
Increase the number of available file descriptors
notify_test and query_test run out of descriptors on some platforms.
% ./notify_test
[==========] Running 1 test(s).
[ RUN ] notify_start
netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
0 libisc-9.19.9-dev.dylib 0x00000001045c5080 default_callback + 72
1 libisc-9.19.9-dev.dylib 0x00000001045c4ffc isc_assertion_failed + 56
2 libisc-9.19.9-dev.dylib 0x00000001045b8bcc start_tcp_child + 304
3 libisc-9.19.9-dev.dylib 0x00000001045b8710 isc_nm_listentcp + 636
4 libisc-9.19.9-dev.dylib 0x00000001045b3e0c isc_nm_listenstreamdns + 344
5 libns-9.19.9-dev.dylib 0x0000000104b90630 ns_interface_listentcp + 152
6 libns-9.19.9-dev.dylib 0x0000000104b8f65c interface_setup + 488
7 libns-9.19.9-dev.dylib 0x0000000104b8de98 do_scan + 2028
8 libns-9.19.9-dev.dylib 0x0000000104b8d640 ns_interfacemgr_scan + 212
9 notify_test 0x000000010418ddd0 scan_interfaces + 44
10 libisc-9.19.9-dev.dylib 0x00000001045d5fd8 isc__job_cb + 116
11 libuv.1.dylib 0x000000010545afe4 uv__run_idle + 152
12 libuv.1.dylib 0x0000000105455cd0 uv_run + 204
13 libisc-9.19.9-dev.dylib 0x00000001045e1120 loop_run + 460
14 libisc-9.19.9-dev.dylib 0x00000001045df824 loop_thread + 44
15 libisc-9.19.9-dev.dylib 0x00000001045df6dc isc_loopmgr_run + 456
16 notify_test 0x000000010418b900 run_test_notify_start + 88
17 libcmocka.0.dylib 0x00000001054968c0 cmocka_run_one_test_or_fixture + 448
18 libcmocka.0.dylib 0x0000000105494ca4 _cmocka_run_group_tests + 848
19 notify_test 0x000000010418be60 main + 120
20 libdyld.dylib 0x0000000181509430 start + 4
Abort
% ./query_test
[==========] Running 4 test(s).
[ RUN ] ns__query_sfcache
netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
0 libisc-9.19.9-dev.dylib 0x000000010294d080 default_callback + 72
1 libisc-9.19.9-dev.dylib 0x000000010294cffc isc_assertion_failed + 56
2 libisc-9.19.9-dev.dylib 0x0000000102940bcc start_tcp_child + 304
3 libisc-9.19.9-dev.dylib 0x0000000102940710 isc_nm_listentcp + 636
4 libisc-9.19.9-dev.dylib 0x000000010293be0c isc_nm_listenstreamdns + 344
5 libns-9.19.9-dev.dylib 0x00000001026cc630 ns_interface_listentcp + 152
6 libns-9.19.9-dev.dylib 0x00000001026cb65c interface_setup + 488
7 libns-9.19.9-dev.dylib 0x00000001026c9e98 do_scan + 2028
8 libns-9.19.9-dev.dylib 0x00000001026c9640 ns_interfacemgr_scan + 212
9 query_test 0x00000001026a1018 scan_interfaces + 44
10 libisc-9.19.9-dev.dylib 0x000000010295dfd8 isc__job_cb + 116
11 libuv.1.dylib 0x0000000103996fe4 uv__run_idle + 152
12 libuv.1.dylib 0x0000000103991cd0 uv_run + 204
13 libisc-9.19.9-dev.dylib 0x0000000102969120 loop_run + 460
14 libisc-9.19.9-dev.dylib 0x0000000102967824 loop_thread + 44
15 libisc-9.19.9-dev.dylib 0x00000001029676dc isc_loopmgr_run + 456
16 query_test 0x000000010269cf34 run_test_ns__query_sfcache + 88
17 libcmocka.0.dylib 0x00000001028068c0 cmocka_run_one_test_or_fixture + 448
18 libcmocka.0.dylib 0x0000000102804ca4 _cmocka_run_group_tests + 848
19 query_test 0x000000010269eab8 main + 116
20 libdyld.dylib 0x0000000181509430 start + 4
Abort
%
expected_creads can exceed the number of file descriptors on some
platforms.
% ./udp_test
[==========] Running 18 test(s).
[ RUN ] mock_listenudp_uv_udp_open
[ OK ] mock_listenudp_uv_udp_open
[ RUN ] mock_listenudp_uv_udp_bind
[ OK ] mock_listenudp_uv_udp_bind
[ RUN ] mock_listenudp_uv_udp_recv_start
[ OK ] mock_listenudp_uv_udp_recv_start
[ RUN ] mock_udpconnect_uv_udp_open
[ OK ] mock_udpconnect_uv_udp_open
[ RUN ] mock_udpconnect_uv_udp_bind
[ OK ] mock_udpconnect_uv_udp_bind
[ RUN ] mock_udpconnect_uv_udp_connect
[ OK ] mock_udpconnect_uv_udp_connect
[ RUN ] mock_udpconnect_uv_recv_buffer_size
[ OK ] mock_udpconnect_uv_recv_buffer_size
[ RUN ] mock_udpconnect_uv_send_buffer_size
[ OK ] mock_udpconnect_uv_send_buffer_size
[ RUN ] udp_noop
[ OK ] udp_noop
[ RUN ] udp_noresponse
[ OK ] udp_noresponse
[ RUN ] udp_shutdown_connect
[ OK ] udp_shutdown_connect
[ RUN ] udp_shutdown_read
[ OK ] udp_shutdown_read
[ RUN ] udp_cancel_read
[ OK ] udp_cancel_read
[ RUN ] udp_timeout_recovery
[ OK ] udp_timeout_recovery
[ RUN ] udp_double_read
[ OK ] udp_double_read
[ RUN ] udp_recv_one
[ OK ] udp_recv_one
[ RUN ] udp_recv_two
[ OK ] udp_recv_two
[ RUN ] udp_recv_send
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
%
2023-01-04 16:59:47 +11:00
|
|
|
#include <sys/resource.h>
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include <isc/buffer.h>
|
|
|
|
#include <isc/hash.h>
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
#include <isc/loop.h>
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
#include <isc/managers.h>
|
|
|
|
#include <isc/mem.h>
|
|
|
|
#include <isc/os.h>
|
|
|
|
#include <isc/string.h>
|
|
|
|
#include <isc/timer.h>
|
|
|
|
#include <isc/util.h>
|
|
|
|
|
2022-05-03 11:37:31 +02:00
|
|
|
#include <tests/isc.h>
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
|
Fix the streaming read callback shutdown logic
When shutting down TCP sockets, the read callback calling logic was
flawed, it would call either one less callback or one extra. Fix the
logic in the way:
1. When isc_nm_read() has been called but isc_nm_read_stop() hasn't on
the handle, the read callback will be called with ISC_R_CANCELED to
cancel active reading from the socket/handle.
2. When isc_nm_read() has been called and isc_nm_read_stop() has been
called on the on the handle, the read callback will be called with
ISC_R_SHUTTINGDOWN to signal that the dormant (not-reading) socket
is being shut down.
3. The .reading and .recv_read flags are little bit tricky. The
.reading flag indicates if the outer layer is reading the data (that
would be uv_tcp_t for TCP and isc_nmsocket_t (TCP) for TLSStream),
the .recv_read flag indicates whether somebody is interested in the
data read from the socket.
Usually, you would expect that the .reading should be false when
.recv_read is false, but it gets even more tricky with TLSStream as
the TLS protocol might need to read from the socket even when sending
data.
Fix the usage of the .recv_read and .reading flags in the TLSStream
to their true meaning - which mostly consist of using .recv_read
everywhere and then wrapping isc_nm_read() and isc_nm_read_stop()
with the .reading flag.
4. The TLS failed read helper has been modified to resemble the TCP code
as much as possible, clearing and re-setting the .recv_read flag in
the TCP timeout code has been fixed and .recv_read is now cleared
when isc_nm_read_stop() has been called on the streaming socket.
5. The use of Network Manager in the named_controlconf, isccc_ccmsg, and
isc_httpd units have been greatly simplified due to the improved design.
6. More unit tests for TCP and TLS testing the shutdown conditions have
been added.
Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
2023-04-13 17:27:50 +02:00
|
|
|
unsigned int workers = 0;
|
2022-10-07 16:13:32 +11:00
|
|
|
bool debug = false;
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
|
Increase the number of available file descriptors
notify_test and query_test run out of descriptors on some platforms.
% ./notify_test
[==========] Running 1 test(s).
[ RUN ] notify_start
netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
0 libisc-9.19.9-dev.dylib 0x00000001045c5080 default_callback + 72
1 libisc-9.19.9-dev.dylib 0x00000001045c4ffc isc_assertion_failed + 56
2 libisc-9.19.9-dev.dylib 0x00000001045b8bcc start_tcp_child + 304
3 libisc-9.19.9-dev.dylib 0x00000001045b8710 isc_nm_listentcp + 636
4 libisc-9.19.9-dev.dylib 0x00000001045b3e0c isc_nm_listenstreamdns + 344
5 libns-9.19.9-dev.dylib 0x0000000104b90630 ns_interface_listentcp + 152
6 libns-9.19.9-dev.dylib 0x0000000104b8f65c interface_setup + 488
7 libns-9.19.9-dev.dylib 0x0000000104b8de98 do_scan + 2028
8 libns-9.19.9-dev.dylib 0x0000000104b8d640 ns_interfacemgr_scan + 212
9 notify_test 0x000000010418ddd0 scan_interfaces + 44
10 libisc-9.19.9-dev.dylib 0x00000001045d5fd8 isc__job_cb + 116
11 libuv.1.dylib 0x000000010545afe4 uv__run_idle + 152
12 libuv.1.dylib 0x0000000105455cd0 uv_run + 204
13 libisc-9.19.9-dev.dylib 0x00000001045e1120 loop_run + 460
14 libisc-9.19.9-dev.dylib 0x00000001045df824 loop_thread + 44
15 libisc-9.19.9-dev.dylib 0x00000001045df6dc isc_loopmgr_run + 456
16 notify_test 0x000000010418b900 run_test_notify_start + 88
17 libcmocka.0.dylib 0x00000001054968c0 cmocka_run_one_test_or_fixture + 448
18 libcmocka.0.dylib 0x0000000105494ca4 _cmocka_run_group_tests + 848
19 notify_test 0x000000010418be60 main + 120
20 libdyld.dylib 0x0000000181509430 start + 4
Abort
% ./query_test
[==========] Running 4 test(s).
[ RUN ] ns__query_sfcache
netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
0 libisc-9.19.9-dev.dylib 0x000000010294d080 default_callback + 72
1 libisc-9.19.9-dev.dylib 0x000000010294cffc isc_assertion_failed + 56
2 libisc-9.19.9-dev.dylib 0x0000000102940bcc start_tcp_child + 304
3 libisc-9.19.9-dev.dylib 0x0000000102940710 isc_nm_listentcp + 636
4 libisc-9.19.9-dev.dylib 0x000000010293be0c isc_nm_listenstreamdns + 344
5 libns-9.19.9-dev.dylib 0x00000001026cc630 ns_interface_listentcp + 152
6 libns-9.19.9-dev.dylib 0x00000001026cb65c interface_setup + 488
7 libns-9.19.9-dev.dylib 0x00000001026c9e98 do_scan + 2028
8 libns-9.19.9-dev.dylib 0x00000001026c9640 ns_interfacemgr_scan + 212
9 query_test 0x00000001026a1018 scan_interfaces + 44
10 libisc-9.19.9-dev.dylib 0x000000010295dfd8 isc__job_cb + 116
11 libuv.1.dylib 0x0000000103996fe4 uv__run_idle + 152
12 libuv.1.dylib 0x0000000103991cd0 uv_run + 204
13 libisc-9.19.9-dev.dylib 0x0000000102969120 loop_run + 460
14 libisc-9.19.9-dev.dylib 0x0000000102967824 loop_thread + 44
15 libisc-9.19.9-dev.dylib 0x00000001029676dc isc_loopmgr_run + 456
16 query_test 0x000000010269cf34 run_test_ns__query_sfcache + 88
17 libcmocka.0.dylib 0x00000001028068c0 cmocka_run_one_test_or_fixture + 448
18 libcmocka.0.dylib 0x0000000102804ca4 _cmocka_run_group_tests + 848
19 query_test 0x000000010269eab8 main + 116
20 libdyld.dylib 0x0000000181509430 start + 4
Abort
%
expected_creads can exceed the number of file descriptors on some
platforms.
% ./udp_test
[==========] Running 18 test(s).
[ RUN ] mock_listenudp_uv_udp_open
[ OK ] mock_listenudp_uv_udp_open
[ RUN ] mock_listenudp_uv_udp_bind
[ OK ] mock_listenudp_uv_udp_bind
[ RUN ] mock_listenudp_uv_udp_recv_start
[ OK ] mock_listenudp_uv_udp_recv_start
[ RUN ] mock_udpconnect_uv_udp_open
[ OK ] mock_udpconnect_uv_udp_open
[ RUN ] mock_udpconnect_uv_udp_bind
[ OK ] mock_udpconnect_uv_udp_bind
[ RUN ] mock_udpconnect_uv_udp_connect
[ OK ] mock_udpconnect_uv_udp_connect
[ RUN ] mock_udpconnect_uv_recv_buffer_size
[ OK ] mock_udpconnect_uv_recv_buffer_size
[ RUN ] mock_udpconnect_uv_send_buffer_size
[ OK ] mock_udpconnect_uv_send_buffer_size
[ RUN ] udp_noop
[ OK ] udp_noop
[ RUN ] udp_noresponse
[ OK ] udp_noresponse
[ RUN ] udp_shutdown_connect
[ OK ] udp_shutdown_connect
[ RUN ] udp_shutdown_read
[ OK ] udp_shutdown_read
[ RUN ] udp_cancel_read
[ OK ] udp_cancel_read
[ RUN ] udp_timeout_recovery
[ OK ] udp_timeout_recovery
[ RUN ] udp_double_read
[ OK ] udp_double_read
[ RUN ] udp_recv_one
[ OK ] udp_recv_one
[ RUN ] udp_recv_two
[ OK ] udp_recv_two
[ RUN ] udp_recv_send
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
%
2023-01-04 16:59:47 +11:00
|
|
|
static void
|
|
|
|
adjustnofile(void) {
|
|
|
|
struct rlimit rl;
|
|
|
|
|
|
|
|
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
|
|
|
|
if (rl.rlim_cur != rl.rlim_max) {
|
|
|
|
rl.rlim_cur = rl.rlim_max;
|
|
|
|
setrlimit(RLIMIT_NOFILE, &rl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-30 09:14:21 +02:00
|
|
|
int
|
|
|
|
setup_workers(void **state ISC_ATTR_UNUSED) {
|
|
|
|
char *env_workers = getenv("ISC_TASK_WORKERS");
|
|
|
|
if (env_workers != NULL) {
|
|
|
|
workers = atoi(env_workers);
|
|
|
|
} else {
|
|
|
|
workers = isc_os_ncpus();
|
|
|
|
|
|
|
|
/* We always need at least two loops for some of the tests */
|
|
|
|
if (workers < 2) {
|
|
|
|
workers = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
INSIST(workers != 0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
int
|
2023-01-10 10:20:44 +01:00
|
|
|
setup_mctx(void **state ISC_ATTR_UNUSED) {
|
2025-07-24 08:06:04 +02:00
|
|
|
isc_mem_debugon(ISC_MEM_DEBUGRECORD);
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2023-01-10 10:20:44 +01:00
|
|
|
teardown_mctx(void **state ISC_ATTR_UNUSED) {
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2023-01-10 10:20:44 +01:00
|
|
|
setup_loopmgr(void **state ISC_ATTR_UNUSED) {
|
2025-07-15 12:56:04 +02:00
|
|
|
REQUIRE(isc_g_mctx != NULL);
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
|
2023-03-30 09:14:21 +02:00
|
|
|
setup_workers(state);
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
|
2025-07-15 12:56:04 +02:00
|
|
|
isc_loopmgr_create(isc_g_mctx, workers);
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2023-01-10 10:20:44 +01:00
|
|
|
teardown_loopmgr(void **state ISC_ATTR_UNUSED) {
|
2025-07-14 10:50:21 +02:00
|
|
|
isc_loopmgr_destroy();
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 13:03:22 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-26 13:03:45 +02:00
|
|
|
int
|
2023-01-10 10:20:44 +01:00
|
|
|
setup_netmgr(void **state ISC_ATTR_UNUSED) {
|
Increase the number of available file descriptors
notify_test and query_test run out of descriptors on some platforms.
% ./notify_test
[==========] Running 1 test(s).
[ RUN ] notify_start
netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
0 libisc-9.19.9-dev.dylib 0x00000001045c5080 default_callback + 72
1 libisc-9.19.9-dev.dylib 0x00000001045c4ffc isc_assertion_failed + 56
2 libisc-9.19.9-dev.dylib 0x00000001045b8bcc start_tcp_child + 304
3 libisc-9.19.9-dev.dylib 0x00000001045b8710 isc_nm_listentcp + 636
4 libisc-9.19.9-dev.dylib 0x00000001045b3e0c isc_nm_listenstreamdns + 344
5 libns-9.19.9-dev.dylib 0x0000000104b90630 ns_interface_listentcp + 152
6 libns-9.19.9-dev.dylib 0x0000000104b8f65c interface_setup + 488
7 libns-9.19.9-dev.dylib 0x0000000104b8de98 do_scan + 2028
8 libns-9.19.9-dev.dylib 0x0000000104b8d640 ns_interfacemgr_scan + 212
9 notify_test 0x000000010418ddd0 scan_interfaces + 44
10 libisc-9.19.9-dev.dylib 0x00000001045d5fd8 isc__job_cb + 116
11 libuv.1.dylib 0x000000010545afe4 uv__run_idle + 152
12 libuv.1.dylib 0x0000000105455cd0 uv_run + 204
13 libisc-9.19.9-dev.dylib 0x00000001045e1120 loop_run + 460
14 libisc-9.19.9-dev.dylib 0x00000001045df824 loop_thread + 44
15 libisc-9.19.9-dev.dylib 0x00000001045df6dc isc_loopmgr_run + 456
16 notify_test 0x000000010418b900 run_test_notify_start + 88
17 libcmocka.0.dylib 0x00000001054968c0 cmocka_run_one_test_or_fixture + 448
18 libcmocka.0.dylib 0x0000000105494ca4 _cmocka_run_group_tests + 848
19 notify_test 0x000000010418be60 main + 120
20 libdyld.dylib 0x0000000181509430 start + 4
Abort
% ./query_test
[==========] Running 4 test(s).
[ RUN ] ns__query_sfcache
netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
0 libisc-9.19.9-dev.dylib 0x000000010294d080 default_callback + 72
1 libisc-9.19.9-dev.dylib 0x000000010294cffc isc_assertion_failed + 56
2 libisc-9.19.9-dev.dylib 0x0000000102940bcc start_tcp_child + 304
3 libisc-9.19.9-dev.dylib 0x0000000102940710 isc_nm_listentcp + 636
4 libisc-9.19.9-dev.dylib 0x000000010293be0c isc_nm_listenstreamdns + 344
5 libns-9.19.9-dev.dylib 0x00000001026cc630 ns_interface_listentcp + 152
6 libns-9.19.9-dev.dylib 0x00000001026cb65c interface_setup + 488
7 libns-9.19.9-dev.dylib 0x00000001026c9e98 do_scan + 2028
8 libns-9.19.9-dev.dylib 0x00000001026c9640 ns_interfacemgr_scan + 212
9 query_test 0x00000001026a1018 scan_interfaces + 44
10 libisc-9.19.9-dev.dylib 0x000000010295dfd8 isc__job_cb + 116
11 libuv.1.dylib 0x0000000103996fe4 uv__run_idle + 152
12 libuv.1.dylib 0x0000000103991cd0 uv_run + 204
13 libisc-9.19.9-dev.dylib 0x0000000102969120 loop_run + 460
14 libisc-9.19.9-dev.dylib 0x0000000102967824 loop_thread + 44
15 libisc-9.19.9-dev.dylib 0x00000001029676dc isc_loopmgr_run + 456
16 query_test 0x000000010269cf34 run_test_ns__query_sfcache + 88
17 libcmocka.0.dylib 0x00000001028068c0 cmocka_run_one_test_or_fixture + 448
18 libcmocka.0.dylib 0x0000000102804ca4 _cmocka_run_group_tests + 848
19 query_test 0x000000010269eab8 main + 116
20 libdyld.dylib 0x0000000181509430 start + 4
Abort
%
expected_creads can exceed the number of file descriptors on some
platforms.
% ./udp_test
[==========] Running 18 test(s).
[ RUN ] mock_listenudp_uv_udp_open
[ OK ] mock_listenudp_uv_udp_open
[ RUN ] mock_listenudp_uv_udp_bind
[ OK ] mock_listenudp_uv_udp_bind
[ RUN ] mock_listenudp_uv_udp_recv_start
[ OK ] mock_listenudp_uv_udp_recv_start
[ RUN ] mock_udpconnect_uv_udp_open
[ OK ] mock_udpconnect_uv_udp_open
[ RUN ] mock_udpconnect_uv_udp_bind
[ OK ] mock_udpconnect_uv_udp_bind
[ RUN ] mock_udpconnect_uv_udp_connect
[ OK ] mock_udpconnect_uv_udp_connect
[ RUN ] mock_udpconnect_uv_recv_buffer_size
[ OK ] mock_udpconnect_uv_recv_buffer_size
[ RUN ] mock_udpconnect_uv_send_buffer_size
[ OK ] mock_udpconnect_uv_send_buffer_size
[ RUN ] udp_noop
[ OK ] udp_noop
[ RUN ] udp_noresponse
[ OK ] udp_noresponse
[ RUN ] udp_shutdown_connect
[ OK ] udp_shutdown_connect
[ RUN ] udp_shutdown_read
[ OK ] udp_shutdown_read
[ RUN ] udp_cancel_read
[ OK ] udp_cancel_read
[ RUN ] udp_timeout_recovery
[ OK ] udp_timeout_recovery
[ RUN ] udp_double_read
[ OK ] udp_double_read
[ RUN ] udp_recv_one
[ OK ] udp_recv_one
[ RUN ] udp_recv_two
[ OK ] udp_recv_two
[ RUN ] udp_recv_send
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
udp__connect_cb(0x0, too many open files, 0x0)
%
2023-01-04 16:59:47 +11:00
|
|
|
adjustnofile();
|
|
|
|
|
2025-07-15 12:56:04 +02:00
|
|
|
isc_netmgr_create(isc_g_mctx);
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2023-01-10 10:20:44 +01:00
|
|
|
teardown_netmgr(void **state ISC_ATTR_UNUSED) {
|
2025-07-14 17:12:35 +02:00
|
|
|
isc_netmgr_destroy();
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
|
2022-07-26 13:03:45 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
setup_managers(void **state) {
|
|
|
|
setup_loopmgr(state);
|
|
|
|
setup_netmgr(state);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
teardown_managers(void **state) {
|
|
|
|
teardown_netmgr(state);
|
|
|
|
teardown_loopmgr(state);
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 10:56:42 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|