annotate src/lib/test-lib.c @ 22553:7db517071db5

lib: Add multiplex stream support This allows having multiple channels of data in single stream.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Tue, 22 Aug 2017 10:14:22 +0300
parents 691b5466edb3
children 708b4dda62dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21390
2e2563132d5f Updated copyright notices to include the year 2017.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents: 21319
diff changeset
1 /* Copyright (c) 2007-2017 Dovecot authors, see the included COPYING file */
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3 #include "test-lib.h"
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 int main(void)
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 {
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 static void (*test_functions[])(void) = {
9425
810e36796e3d liblib unit tests are now split to separate files.
Timo Sirainen <tss@iki.fi>
parents: 9258
diff changeset
8 test_aqueue,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9 test_array,
18098
1663b76430e1 Added support for base32 encode/decode.
Stephan Bosch <stephan@rename-it.nl>
parents: 18069
diff changeset
10 test_base32,
9425
810e36796e3d liblib unit tests are now split to separate files.
Timo Sirainen <tss@iki.fi>
parents: 9258
diff changeset
11 test_base64,
17449
bc4f09a5cb11 lib: unit tests for lib/bits
Phil Carmody <phil@dovecot.fi>
parents: 17444
diff changeset
12 test_bits,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 test_bsearch_insert_pos,
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14 test_buffer,
22398
1b4e7b89b161 lib: import byte swapping & endian converting functions
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
parents: 22271
diff changeset
15 test_byteorder,
10639
dcfcedb32ea2 crc32*() didn't return a standard CRC32 value.
Timo Sirainen <tss@iki.fi>
parents: 10582
diff changeset
16 test_crc32,
17641
1778c2e77cfa lib: test-data-stack - too important a library not to be thrashed hard
Phil Carmody <phil@dovecot.fi>
parents: 17551
diff changeset
17 test_data_stack,
18854
6d965c726810 lib: test-failures - tests get/set handlers and the various log levels
Phil Carmody <phil@dovecot.fi>
parents: 18501
diff changeset
18 test_failures,
22271
5c7987bec546 lib: Add unit test for file_create_locked()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 22139
diff changeset
19 test_file_create_locked,
17979
07c709075598 lib: Added unit tests for guid_128_*()
Timo Sirainen <tss@iki.fi>
parents: 17727
diff changeset
20 test_guid,
17444
ff8402fe378e lib: Added some kind of a unit test for hash table.
Timo Sirainen <tss@iki.fi>
parents: 17330
diff changeset
21 test_hash,
12308
22689f4ceecb liblib: Added API for easily building hash strings based on given format string and input.
Timo Sirainen <tss@iki.fi>
parents: 12301
diff changeset
22 test_hash_format,
17330
2e7ac48c6072 liblib: Added unit test for hash methods to make sure they don't do read access beyond buffer.
Timo Sirainen <tss@iki.fi>
parents: 17130
diff changeset
23 test_hash_method,
9634
7fc9e93fe745 Added binary_to_hex_append().
Timo Sirainen <tss@iki.fi>
parents: 9484
diff changeset
24 test_hex_binary,
22138
54260e47d2e1 lib: Add i_realloc_type() for i_realloc() that checks for overflows
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21390
diff changeset
25 test_imem,
19025
5423ae859f15 lib: Try fixing ec6e672a6e32 (ioloop timeout fixing)
Timo Sirainen <tss@iki.fi>
parents: 19022
diff changeset
26 test_ioloop,
14586
21d67121985a Adds ISO8601/RFC3339 date format parsing and construction support.
Stephan Bosch <stephan@rename-it.nl>
parents: 14133
diff changeset
27 test_iso8601_date,
19838
e387bbec2bda lib: Added unit test to iostream-temp.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 19735
diff changeset
28 test_iostream_temp,
17508
01061ac25fe1 lib: If two istreams share one parent, i_stream_get_data() may have returned corrupted data to another.
Timo Sirainen <tss@iki.fi>
parents: 17449
diff changeset
29 test_istream,
14845
39b1b519c033 Added istream-base64-decoder.
Timo Sirainen <tss@iki.fi>
parents: 14586
diff changeset
30 test_istream_base64_decoder,
12420
bb6fc4e13bc9 Added unit test for istream-base64-encoder.
Timo Sirainen <tss@iki.fi>
parents: 12308
diff changeset
31 test_istream_base64_encoder,
19636
994625f360af lib: When closing istream-chain, make sure parent stream is seeked to correct offset.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 19552
diff changeset
32 test_istream_chain,
10186
49599bbfc900 Added unit tests for istream-seekable istream-concat.
Timo Sirainen <tss@iki.fi>
parents: 9786
diff changeset
33 test_istream_concat,
9785
bba7c46359ac Renamed test-istream.c to test-istream-crlf.c
Timo Sirainen <tss@iki.fi>
parents: 9772
diff changeset
34 test_istream_crlf,
18865
99827acc1888 lib: Added i_stream_create_failure_at() to inject EIO at given offset in istream.
Timo Sirainen <tss@iki.fi>
parents: 18854
diff changeset
35 test_istream_failure_at,
22553
7db517071db5 lib: Add multiplex stream support
Aki Tuomi <aki.tuomi@dovecot.fi>
parents: 22431
diff changeset
36 test_istream_multiplex,
10186
49599bbfc900 Added unit tests for istream-seekable istream-concat.
Timo Sirainen <tss@iki.fi>
parents: 9786
diff changeset
37 test_istream_seekable,
9786
57ae66e0fd38 Added unit test for istream-tee.
Timo Sirainen <tss@iki.fi>
parents: 9785
diff changeset
38 test_istream_tee,
18481
21a2ce6f8f37 lib: Added istream-unix for reading fd sockets via istream.
Timo Sirainen <tss@iki.fi>
parents: 18399
diff changeset
39 test_istream_unix,
15435
86572582647e JSON parser supports now nested objects and parsing from non-blocking input stream.
Timo Sirainen <tss@iki.fi>
parents: 14861
diff changeset
40 test_json_parser,
18399
6bde7868cffd lib: Added json-tree API for parsing JSON input into a tree structure.
Timo Sirainen <tss@iki.fi>
parents: 18137
diff changeset
41 test_json_tree,
10262
07e0e2b4abe1 Added DLLIST2_*() functions for doubly linked list with head and tail.
Timo Sirainen <tss@iki.fi>
parents: 10186
diff changeset
42 test_llist,
20582
3e02c55136a6 lib: Added log throttling API.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 20252
diff changeset
43 test_log_throttle,
21319
a3bbf15ea8d7 lib: Add MALLOC_MULTIPLY() and MALLOC_ADD()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21299
diff changeset
44 test_malloc_overflow,
22139
df6a5fba9405 lib: Add test-mempool unit test.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 22138
diff changeset
45 test_mempool,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
46 test_mempool_alloconly,
18501
334bb95f27d4 lib: Renamed test-network to test-net
Timo Sirainen <tss@iki.fi>
parents: 18481
diff changeset
47 test_net,
14861
b45d968adff8 liblib: Added "number packing" API.
Timo Sirainen <tss@iki.fi>
parents: 14845
diff changeset
48 test_numpack,
20252
2cacbc8e95c5 lib: Add PKCS#5 pbkdf1 and 2
Aki Tuomi <aki.tuomi@dovecot.fi>
parents: 19838
diff changeset
49 test_pkcs5_pbkdf2,
22431
691b5466edb3 lib: Created basic test suite for ostream-buffer.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents: 22398
diff changeset
50 test_ostream_buffer,
19735
a3872143befd lib: Add ostream-escaped filter
Aki Tuomi <aki.tuomi@dovecot.fi>
parents: 19636
diff changeset
51 test_ostream_escaped,
18866
1c7288c054b1 lib: Added o_stream_create_failure_at() to inject EIO at given offset in ostream
Timo Sirainen <tss@iki.fi>
parents: 18865
diff changeset
52 test_ostream_failure_at,
12301
17957b5082cd ostream-file: Fixed potential crash in write_at() and also fixed attempted optimization.
Timo Sirainen <tss@iki.fi>
parents: 10639
diff changeset
53 test_ostream_file,
22553
7db517071db5 lib: Add multiplex stream support
Aki Tuomi <aki.tuomi@dovecot.fi>
parents: 22431
diff changeset
54 test_ostream_multiplex,
7db517071db5 lib: Add multiplex stream support
Aki Tuomi <aki.tuomi@dovecot.fi>
parents: 22431
diff changeset
55 test_multiplex,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56 test_primes,
17527
2c0b4244b935 lib: test printf_format_fix()
Phil Carmody <phil@dovecot.fi>
parents: 17508
diff changeset
57 test_printf_format_fix,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
58 test_priorityq,
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
59 test_seq_range_array,
15790
c762a9af72c1 buffer: Always keep +1 byte available for str_c()'s NUL.
Timo Sirainen <tss@iki.fi>
parents: 15574
diff changeset
60 test_str,
9484
5a6fe52a0cfc Added str_append_tabunescaped(). str_tabescape*() now escapes also CR. Added unit tests.
Timo Sirainen <tss@iki.fi>
parents: 9425
diff changeset
61 test_strescape,
10457
c2386c4594d5 Added p_strarray_dup().
Timo Sirainen <tss@iki.fi>
parents: 10262
diff changeset
62 test_strfuncs,
17551
6c1e44033e60 lib: test-lib - add unit tests for str_to_*() helpers
Phil Carmody <phil@dovecot.fi>
parents: 17527
diff changeset
63 test_strnum,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
64 test_str_find,
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 test_str_sanitize,
18069
4c956747c36f lib: Added str-table API for keeping reference counted strings in a hash table.
Timo Sirainen <tss@iki.fi>
parents: 17979
diff changeset
66 test_str_table,
9772
1bcd692d6312 Added unit tests for timeval_*().
Timo Sirainen <tss@iki.fi>
parents: 9634
diff changeset
67 test_time_util,
19147
9add45266550 lib: Added a simple timing.h API for tracking min/max/avg for events.
Timo Sirainen <tss@iki.fi>
parents: 19025
diff changeset
68 test_timing,
15574
7be4709aab5e uni_utf8_*(): Treat overlong UTF8 sequences as invalid.
Timo Sirainen <tss@iki.fi>
parents: 14133
diff changeset
69 test_unichar,
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 test_utc_mktime,
10526
e1b725d02c30 var_expand(): Added support for built-in host, pid and env:* variables.
Timo Sirainen <tss@iki.fi>
parents: 10457
diff changeset
71 test_var_expand,
17727
d1d4beff99f7 lib: Added unit tests for wildcard_match()
Timo Sirainen <tss@iki.fi>
parents: 17672
diff changeset
72 test_wildcard_match,
9425
810e36796e3d liblib unit tests are now split to separate files.
Timo Sirainen <tss@iki.fi>
parents: 9258
diff changeset
73 NULL
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 };
21299
5be9ee567034 lib-test: Change test_fatal_func_t to take unsigned int stage as parameter.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 20582
diff changeset
75 static enum fatal_test_state (*fatal_functions[])(unsigned int) = {
18113
9141a16aff4e lib: test-array - fatal tests
Phil Carmody <phil@dovecot.fi>
parents: 18098
diff changeset
76 fatal_array,
17672
8e990ad4db0e lib: test-data-stack - add some fatal tests.
Phil Carmody <phil@dovecot.fi>
parents: 17671
diff changeset
77 fatal_data_stack,
21319
a3bbf15ea8d7 lib: Add MALLOC_MULTIPLY() and MALLOC_ADD()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21299
diff changeset
78 fatal_malloc_overflow,
17670
16761cdb2537 lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents: 17641
diff changeset
79 fatal_mempool,
22139
df6a5fba9405 lib: Add test-mempool unit test.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 22138
diff changeset
80 fatal_mempool_alloconly,
17671
84ead9b26d59 lib: test fatal cases for printf_format_fix
Phil Carmody <phil@dovecot.fi>
parents: 17670
diff changeset
81 fatal_printf_format_fix,
17670
16761cdb2537 lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents: 17641
diff changeset
82 NULL
16761cdb2537 lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents: 17641
diff changeset
83 };
16761cdb2537 lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents: 17641
diff changeset
84 return test_run_with_fatals(test_functions, fatal_functions);
9258
665ea7a8d26e Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85 }