Commit graph

10915 commits

Author SHA1 Message Date
Evan Hunt
6aaaea3e61 convert symtab_test
(cherry picked from commit 5f377136be)
(cherry picked from commit 7b2288483f)
2018-11-15 17:45:46 -08:00
Evan Hunt
7ba2676176 convert queue_test
(cherry picked from commit b3db0266cb)
(cherry picked from commit b59107e687)
2018-11-15 17:45:46 -08:00
Evan Hunt
cf3bc94608 convert file_test
(cherry picked from commit 8161be27db)
(cherry picked from commit 3b95658020)
2018-11-15 17:45:46 -08:00
Evan Hunt
ff466ef5aa convert lex_test
(cherry picked from commit 4133fd86f1)
(cherry picked from commit 0e08dc2e2b)
2018-11-15 17:45:46 -08:00
Evan Hunt
2ac235d08c convert errno_test
(cherry picked from commit 049a3a7c0e)
(cherry picked from commit df41c2668f)
2018-11-15 17:45:45 -08:00
Evan Hunt
c5e86b2f3d convert safe_test
(cherry picked from commit c1c8d8846f)
(cherry picked from commit 5f3ba36436)
2018-11-15 17:45:45 -08:00
Evan Hunt
e975371c4d convert radix_test
(cherry picked from commit 718ca3166c)
(cherry picked from commit 5640841732)
2018-11-15 17:45:45 -08:00
Evan Hunt
726f335c37 convert heap_test
(cherry picked from commit cc6ab2416b)
(cherry picked from commit 57d78a76e5)
2018-11-15 17:45:45 -08:00
Evan Hunt
65640c6743 convert parse_test
(cherry picked from commit a7c308df9c)
(cherry picked from commit f29a9d5bc5)
2018-11-15 17:45:45 -08:00
Evan Hunt
802b551d42 convert counter_test
(cherry picked from commit 52b86f0abe)
(cherry picked from commit 856add745a)
2018-11-15 17:45:45 -08:00
Evan Hunt
2f4c3cf019 convert buffer_test
(cherry picked from commit 02a5db7631)
(cherry picked from commit 3095574c1c)
2018-11-15 17:45:45 -08:00
Evan Hunt
b85a5b0dcd convert aes_test
(cherry picked from commit dc88db015b)
(cherry picked from commit c679b85424)
2018-11-15 17:45:45 -08:00
Evan Hunt
2b0e2bc920 set freed pointers to NULL 2018-11-15 17:45:44 -08:00
Evan Hunt
dd29de6f19 convert resconf_test; remove ATF from lib/irs/tests
(cherry picked from commit cec8c52cbe)
(cherry picked from commit 1d76da4943)
2018-11-15 17:45:44 -08:00
Evan Hunt
0b6ecdf509 convert parser_test; remove ATF from lib/isccfg/tests
(cherry picked from commit 7ec945bd41)
(cherry picked from commit 66fa5b9af6)
2018-11-15 17:45:44 -08:00
Evan Hunt
fbd563baea convert config_test; remove ATF from lib/lwres/tests 2018-11-15 17:45:44 -08:00
Evan Hunt
f533ab528d improvements to test setup and teardown
- assert if {isc,dns,ns}_test_begin() is called when a prior test is running
- add dns_test_init() and dns_test_final(), which can be run before and
  after all tests. this ensures openssl doesn't have to be reinitialized.
2018-11-15 17:44:13 -08:00
Evan Hunt
099883e2b1 remove .NOTPARALLEL so unit tests can build faster
(cherry picked from commit b434b0a4b6)
(cherry picked from commit 03c7a096c6)
2018-11-16 01:05:35 +00:00
Evan Hunt
a9a626e440 add cmocka support to remaining unit test makefiles
- also cleaned up some existing test code

(cherry picked from commit 2afd18a2ce)
(cherry picked from commit cd5855378e)
2018-11-16 01:05:35 +00:00
Mark Andrews
f14f70833f uninitalize memory read on error path
(cherry picked from commit 4eadebe2b2)
2018-11-15 00:16:35 +00:00
Mark Andrews
3aafdbf160 errors initalizing badcaches were not caught or cleaned up on error paths
(cherry picked from commit 93776c4c81)
2018-11-15 00:16:31 +00:00
Mark Andrews
e409b8c698 free tmpzonename and restart_master
(cherry picked from commit 50714a9b35)
2018-11-14 11:42:44 -08:00
Mark Andrews
ccf915f7e4 don't use 'typename' as it is reserved in C++ 2018-11-14 11:13:21 -08:00
Mark Andrews
03f2cc49e3 remove lib/isc/tests/result_test as it is now cmocka
(cherry picked from commit 9024cf0c15)
2018-11-13 07:50:51 +11:00
Mark Andrews
ffc56a4bf3 link in lib/isccc/tests/Kyuafile
(cherry picked from commit 9a59352b4c)
2018-11-13 07:50:30 +11:00
Mark Andrews
58812a4641 define CMOCKA_CFLAGS and CMOCKA_LIBS
(cherry picked from commit 1e8cdc20f3)
2018-11-12 18:42:58 +11:00
Evan Hunt
181c5442b9 convert result tests to use CMocka instead of ATF
(cherry picked from commit 471110933a)
2018-11-12 15:38:50 +11:00
Mark Andrews
af5a051e4d check result tables are complete
(cherry picked from commit 4f04a79250)
2018-11-12 15:32:58 +11:00
Ondřej Surý
22c0f129ae Add support for cmocka assert testing by overriding REQUIRE/INSIST/... macros when UNIT_TESTING is defined
(cherry picked from commit 52731c000d)
2018-11-12 12:56:15 +11:00
Ondřej Surý
b0745fb156 Integrate cmocka unit testing framework to kyua
(cherry picked from commit 07910f0153)
2018-11-12 12:53:15 +11:00
Ondřej Surý
9000f73ba3 Properly use ATOMIC_*_LOCK_FREE preprocessor constants
The ATOMIC_*_LOCK_FREE can evalutate either 0, 1, or 2 which indicate the
lock-free property of the corresponding atomic types (both signed and unsigned).

	Value	Explanation
	-----	--------------------------------------
	  0	The atomic type is never lock-free
	  1	The atomic type is sometimes lock-free
	  2	The atomic type is always lock-free
	-----	--------------------------------------

(cherry picked from commit a5e7901eb9)
2018-11-09 05:00:32 +07:00
Ondřej Surý
ba263b5b7e isc_stdtime_t is always 32-bit now, so remove the always true macro STDTIME_ON_32BITS
(cherry picked from commit 6f5fe11f5a)
2018-11-09 03:04:22 +07:00
Ondřej Surý
52784fc3cc Disable runtime detection of md5 and sha1 support for Utimaco HSM.
Utimaco HSM requires user to be logged in before executing DigestUpdate, thus
breaking dst_lib_init2 that ran isc_md5_check and isc_sha1_check before sending
PIN to the HSM.  Therefore isc_*_check needs to be disabled when Utimaco HSM is
being used as PKCS#11 library.
2018-11-09 00:07:55 +07:00
Ondřej Surý
2079e44fb9 Define PK11_UTIMACO_FLAVOR and add detection code to configure.ac 2018-11-09 00:07:44 +07:00
Ondřej Surý
c5b54803cd Remove dummy ISLOCKED macro
(cherry picked from commit 68ca987792)
(cherry picked from commit 5ad72603a8)
2018-11-08 22:42:52 +07:00
Ondřej Surý
2f8b28efad Hint the compiler with ISC_UNREACHABLE(); that code after INSIST(0); cannot be reached
(cherry picked from commit 23fff6c569)
(cherry picked from commit 4568669807)
2018-11-08 22:42:52 +07:00
Ondřej Surý
baa5811623 Modify the dbversion_test.c to detect disabled assertions
(cherry picked from commit b992b5b811)
(cherry picked from commit ce6ef5b50e)
2018-11-08 22:03:33 +07:00
Ondřej Surý
6aa63d9349 Add extra return failure after INSIST(0) in default branch
(cherry picked from commit 29c45200e7)
(cherry picked from commit 2a26189256)
2018-11-08 22:03:33 +07:00
Ondřej Surý
d894b2da79 Use larger buffers on snprintf buffer overflow false positives
(cherry picked from commit 4eaf927571)
(cherry picked from commit 65536fb10b)
2018-11-08 22:03:33 +07:00
Ondřej Surý
c576cb2ff6 Don't assert on failed getrlimit call to allow called to handle this gracefully as it already does, just abort where we need to know the numbers
(cherry picked from commit e2e138a801)
(cherry picked from commit 1e6329038b)
2018-11-08 22:03:31 +07:00
Ondřej Surý
f1224b4af1 When ISC assertions are disabled, still execute the condition to prevent unused variable warnings/errors from the compiler
(cherry picked from commit a831e0f72d)
(cherry picked from commit 3d834566f1)
2018-11-08 22:03:00 +07:00
Ondřej Surý
12a266211e Turn (int & flag) into (int & flag) != 0 when implicitly typed to bool
(cherry picked from commit b2b43fd235)
(cherry picked from commit fcd1569e2b)
2018-11-08 22:02:58 +07:00
Ondřej Surý
9d15323e24 Add small tweaks to the code to fix compilation when ISC assertions are disabled
While implementing the new unit testing framework cmocka, it was found that the
BIND 9 code doesn't compile when assertions are disabled or replaced with any
function (such as mock_assert() from cmocka unit testing framework) that's not
directly recognized as assertion by the compiler.

This made the compiler to complain about blocks of code that was recognized as
unreachable before, but now it isn't.

The changes in this commit include:

* assigns default values to couple of local variables,
* moves some return statements around INSIST assertions,
* adds __builtin_unreachable(); annotations after some INSIST assertions,
* fixes one broken assertion (= instead of ==)

(cherry picked from commit fbd2e47f51)
(cherry picked from commit b222783ae9)
2018-11-08 22:00:49 +07:00
Evan Hunt
6690b9e5a3 silence warning from missing print.h
(cherry picked from commit a0de6707c0)
2018-10-30 08:09:44 -07:00
Michał Kępień
00bc5bf6bd Fix isc_buffer_copyregion() for auto-reallocated buffers
While isc_buffer_copyregion() calls isc_buffer_reserve() to ensure the
target buffer will have enough available space to append the contents of
the source region to it, the variables used for subsequently checking
available space are not updated accordingly after that call.  This
prevents isc_buffer_copyregion() from working as expected for
auto-reallocated buffers: ISC_R_NOSPACE will be returned if enough space
is not already available in the target buffer before it is reallocated.
Fix by calling isc_buffer_used() and isc_buffer_availablelength()
directly instead of assigning their return values to local variables.

(cherry picked from commit e1f0aed034)
2018-10-30 13:34:49 +01:00
Michał Kępień
b549996d58 Add unit tests for isc_buffer_copyregion()
Add some basic checks for isc_buffer_copyregion() to ensure it behaves
as expected for both fixed-size buffers and buffers which can be
automatically reallocated.  Adjust the list of headers included by
lib/isc/tests/buffer_test.c so that it matches what that test program
really uses.

(cherry picked from commit 15440d8027)
2018-10-30 13:34:48 +01:00
Mark Andrews
e646307f91 compare_nxt compared records with identical next fields case insensitively
(cherry picked from commit cf83016682)
2018-10-30 15:10:55 +11:00
Mark Andrews
375df38a4a move declaration of pending
(cherry picked from commit bc53e5e5d4)
2018-10-30 11:55:12 +11:00
Mark Andrews
67816c747d document eol
(cherry picked from commit 97a680e5ce)
2018-10-30 11:18:06 +11:00
Mark Andrews
9b0a277490 Record types which support a empty rdata field were not handling the empty rdata field case.
(cherry picked from commit 2ff57d8a39)
2018-10-30 11:17:59 +11:00