37bf0a2059868bb31f25543e9ca11dd9c77bc198 |
|
27-Nov-2017 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: Add test_expect_fatal_string() |
440f9bf580c42860f741560cbc3789be959cf777 |
|
23-Dec-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: test_run*() - use const for test_functions[] array |
b7a60785a9ed8a1afef479ccc30bc23a9c46feef |
|
23-Dec-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: test_run_named*() - use const for tests[] array |
957d34edbe3599fbb4e7c0bcf3785bd7fd4862c4 |
|
14-Dec-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: Change test_fatal_func_t to take unsigned int stage as parameter.
It could never be -1, so this makes it clearer. It also removes annoying
casts when comparing stage to e.g. N_ELEMENTS(). |
bc15567c91fb9d3915b04013ee0cc744c7a18eab |
|
14-Dec-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: test_run_with_fatals() now takes a const array |
76d4cc8e7aea32e91a48c83dabcccb196ea8019b |
|
14-Dec-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: Introduce test_fatal_func_t as typedef and comment how it works. |
11d88fd444070c67d09fe17e4dcb6c319d8833c2 |
|
30-Sep-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-test: Added test_ostream for testing nonblocking ostreams. |
bd1e1a9720ce4617f7d97be75cffc45e905bb791 |
|
10-Aug-2016 |
Phil Carmody <phil@dovecot.fi> |
lib-test: test-exit helper to stop valgrind complaining about fork()s
fork()s that want to _exit() will cause valgrind's full memory leak
checker to complain a lot - this performs a quick cleanup first.
Before:
phil@phil:~/repos/dovecot-core$ valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all src/lib/test-lib --match unix
==19576== total heap usage: 4 allocs, 0 frees, 17,858 bytes allocated
istream unix ......................................................... : ok
0 / 1 tests failed
==19575== total heap usage: 7 allocs, 7 frees, 19,327 bytes allocated
After:
phil@phil:~/repos/dovecot-core$ valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all src/lib/test-lib --match unix
istream unix ......................................................... : ok
==4993== total heap usage: 4 allocs, 4 frees, 17,858 bytes allocated
0 / 1 tests failed
==4992== total heap usage: 7 allocs, 7 frees, 19,327 bytes allocated
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
d48ce437e36df095b4c8299d84d6eeb20c280994 |
|
08-Aug-2016 |
Phil Carmody <phil@dovecot.fi> |
lib-test: enable naming of tests, such that only a subset is run
How to use these will become clear in a subsequent patch. Even if you
don't want to name tests, the macros can reduce redundancy in the code,
as the list of test function prototypes and the list of test functions
to call become the same lists, expanded through 2 different macros.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
0e0a294cfa87a8e44f29997cac48fd5030767b2b |
|
08-Aug-2016 |
Phil Carmody <phil@dovecot.fi> |
lib-test: improve expected error handling
If we expect a specific error string, then when we see it, suppress it.
We do not suppress errors expected by count, because if we get unexpected
errors, then we do not want them suppressed, and we have no way of
distinguishing between the expected and unexpected errors.
This of course favours the use of the expected string version of the helper,
but alas that's not always usable, as you can only expect one at a time.
Additionally, if we failed to see an expected message, then when we no longer
expect to see it, reset the expected message state to not cascade further
test assertion failures.
Signed-off-by: Phil Carmody <phil@dovecot.fi>
Conflicts:
src/lib-test/test-common.c |
3c16f16e005a5d863faad157dba4a82ecb170239 |
|
21-Jun-2016 |
Baofeng Wang <baofeng.wang@dovecot.fi> |
lib-test: add test_assert_failed_strcmp to expose strings.
the macro is used to facilitate any test to show string comparision
contents when they doesn't match. |
1b3a9b9e7e51e526065a9858b806b35c81cb4b6c |
|
15-Jun-2015 |
Phil Carmody <phil@dovecot.fi> |
lib-test: test_expect_error_string() to match a single known message
This gives us very fine control over what is acceptable as an expected warning.
Alas you have to do it for each message individually.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
7d442a685dd22588aceb75e630b69e28357acaae |
|
15-Jun-2015 |
Phil Carmody <phil@dovecot.fi> |
lib-test: let tests invoke i_warning/i_error behaviour
Error-handling paths should be testable too. Permit a test case to register
that a known number of warnings/errors are to be expected, and to verify
that those warnings did occur afterwards. Too many messages will fail the
test exactly as it did in the past, they're unexpected messages. However,
too few messages will also cause the test case to fail.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
a4e0dc5b1c4ff4caccfb928e3be0542905b0ec9a |
|
30-Jul-2014 |
Phil Carmody <phil@dovecot.fi> |
lib-test: permit tests of fatal conditions
Some functions have no mechanism of reporting an error, and mustn't continue,
so fatality is the only way out. (E.g. memory allocation failures.)
This addition is for those situations. Semantics of failure tests are very
different from normal tests:
- The test function must have the following prototype:
enum fatal_test_state test_fatal_things(int index);
- The index it will be called with starts at 0, and increments each time.
- It must call test_start() at the start of its first call.
- Apart from its final call, it must call a function it expects to trap the
fatal error handler. If that fails to trap, it must return FATAL_TEST_FAILURE
- After returning FATAL_TEST_FAILURE, it will continue to be called as normal.
- When there are no more tests to perform, it must clean up, call test_end()
and return FATAL_TEST_FINISHED. It will not be called again.
- If it detects errors in this protocol, it must not i_assert(), as that will
be treated as an expected fatal, it must return FATAL_TEST_ABORT. It will
then not be called again. It must not call test_end() in this case.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
0db47f171fc79209f95703f8f928c8487df15fcf |
|
28-Jul-2014 |
Phil Carmody <phil@dovecot.fi> |
lib-test: make internal helpers static
These functions should only be called from within test_run(), as some of the
test-suite sanity checks can be subvirted if these are exposed.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
00a34f888890caf56c66ff4d15445cab58ebd8d2 |
|
02-Jul-2014 |
Phil Carmody <phil@dovecot.fi> |
lib-test: test-common - add test_out_quiet() to reduce verbosity
Like test_out() but only prints anything if success is false.
This makes it quite much like test_assert(), except that it
doesn't print the code fragment, it prints a custom string.
However, it still counts as a test in the total count, unlike
test_assert*()s.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
dad57bb15da9dc03c40b0a4ddf72749704ea4e1b |
|
27-Jun-2014 |
Phil Carmody <phil@dovecot.fi> |
lib-test: Enable looped tests to abort early on first failure
Give them the ability to query the current failure state.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
aebf030c0dc21b57ec13eb684fe70b482b8bb446 |
|
09-Jun-2014 |
Phil Carmody <phil@dovecot.fi> |
lib-test: test_assert helper for loops
If you're repeatedly testing the same expression in a loop, it's
good to know where you are in the loop. Add an additional parameter
for these cases.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4 |
|
23-Jun-2012 |
Timo Sirainen <tss@iki.fi> |
Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
The non-obvious APIs where NULL parameter was changed to "" are
master_service_init() and auth_master_user_list_init().
These checks can currently be enabled only on a patched clang:
http://llvm.org/bugs/show_bug.cgi?id=6786 |
4c542561cab50e31498841aeabec7a7e889a17d7 |
|
26-Oct-2009 |
Timo Sirainen <tss@iki.fi> |
lib-test: Added test_istream_create().
--HG--
branch : HEAD |
7379a9d8a1c10e452d3d319e23ea900a358bac44 |
|
14-Aug-2009 |
Timo Sirainen <tss@iki.fi> |
lib-test: Added test_istream_set_max_buffer_size().
--HG--
branch : HEAD |
3a14416ca1f20640156c36534a7815f005c51eab |
|
30-Jun-2009 |
Timo Sirainen <tss@iki.fi> |
unit testing: Added support for doing test_init/run/deinit in separate functions.
--HG--
branch : HEAD |
40a5aeebf6b4858b93f0ddff0bf12fba769cf903 |
|
09-May-2009 |
Timo Sirainen <tss@iki.fi> |
Tests are now run on "make check". Added initial tests for lib-index.
Moved old tests away from tests/ to libraries' individual directories.
--HG--
branch : HEAD |