Mercurial > dovecot > core-2.2
annotate src/lib/test-lib.c @ 18866:1c7288c054b1
lib: Added o_stream_create_failure_at() to inject EIO at given offset in ostream
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 16 Jun 2015 16:22:18 +0300 |
parents | 99827acc1888 |
children | ec6e672a6e32 |
rev | line source |
---|---|
18137 | 1 /* Copyright (c) 2007-2015 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, |
10639
dcfcedb32ea2
crc32*() didn't return a standard CRC32 value.
Timo Sirainen <tss@iki.fi>
parents:
10582
diff
changeset
|
15 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
|
16 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
|
17 test_failures, |
17979
07c709075598
lib: Added unit tests for guid_128_*()
Timo Sirainen <tss@iki.fi>
parents:
17727
diff
changeset
|
18 test_guid, |
17444
ff8402fe378e
lib: Added some kind of a unit test for hash table.
Timo Sirainen <tss@iki.fi>
parents:
17330
diff
changeset
|
19 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
|
20 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
|
21 test_hash_method, |
9634 | 22 test_hex_binary, |
14586
21d67121985a
Adds ISO8601/RFC3339 date format parsing and construction support.
Stephan Bosch <stephan@rename-it.nl>
parents:
14133
diff
changeset
|
23 test_iso8601_date, |
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
|
24 test_istream, |
14845 | 25 test_istream_base64_decoder, |
12420
bb6fc4e13bc9
Added unit test for istream-base64-encoder.
Timo Sirainen <tss@iki.fi>
parents:
12308
diff
changeset
|
26 test_istream_base64_encoder, |
10186
49599bbfc900
Added unit tests for istream-seekable istream-concat.
Timo Sirainen <tss@iki.fi>
parents:
9786
diff
changeset
|
27 test_istream_concat, |
9785
bba7c46359ac
Renamed test-istream.c to test-istream-crlf.c
Timo Sirainen <tss@iki.fi>
parents:
9772
diff
changeset
|
28 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
|
29 test_istream_failure_at, |
10186
49599bbfc900
Added unit tests for istream-seekable istream-concat.
Timo Sirainen <tss@iki.fi>
parents:
9786
diff
changeset
|
30 test_istream_seekable, |
9786
57ae66e0fd38
Added unit test for istream-tee.
Timo Sirainen <tss@iki.fi>
parents:
9785
diff
changeset
|
31 test_istream_tee, |
18481
21a2ce6f8f37
lib: Added istream-unix for reading fd sockets via istream.
Timo Sirainen <tss@iki.fi>
parents:
18399
diff
changeset
|
32 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
|
33 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
|
34 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
|
35 test_llist, |
9258
665ea7a8d26e
Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
36 test_mempool_alloconly, |
18501
334bb95f27d4
lib: Renamed test-network to test-net
Timo Sirainen <tss@iki.fi>
parents:
18481
diff
changeset
|
37 test_net, |
14861
b45d968adff8
liblib: Added "number packing" API.
Timo Sirainen <tss@iki.fi>
parents:
14845
diff
changeset
|
38 test_numpack, |
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
|
39 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
|
40 test_ostream_file, |
9258
665ea7a8d26e
Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
41 test_primes, |
17527
2c0b4244b935
lib: test printf_format_fix()
Phil Carmody <phil@dovecot.fi>
parents:
17508
diff
changeset
|
42 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
|
43 test_priorityq, |
665ea7a8d26e
Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
44 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
|
45 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
|
46 test_strescape, |
10457 | 47 test_strfuncs, |
17551
6c1e44033e60
lib: test-lib - add unit tests for str_to_*() helpers
Phil Carmody <phil@dovecot.fi>
parents:
17527
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 test_str_table, |
9772
1bcd692d6312
Added unit tests for timeval_*().
Timo Sirainen <tss@iki.fi>
parents:
9634
diff
changeset
|
52 test_time_util, |
15574
7be4709aab5e
uni_utf8_*(): Treat overlong UTF8 sequences as invalid.
Timo Sirainen <tss@iki.fi>
parents:
14133
diff
changeset
|
53 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
|
54 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
|
55 test_var_expand, |
17727
d1d4beff99f7
lib: Added unit tests for wildcard_match()
Timo Sirainen <tss@iki.fi>
parents:
17672
diff
changeset
|
56 test_wildcard_match, |
9425
810e36796e3d
liblib unit tests are now split to separate files.
Timo Sirainen <tss@iki.fi>
parents:
9258
diff
changeset
|
57 NULL |
9258
665ea7a8d26e
Tests are now run on "make check". Added initial tests for lib-index.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
58 }; |
17670
16761cdb2537
lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents:
17641
diff
changeset
|
59 static enum fatal_test_state (*fatal_functions[])(int) = { |
18113
9141a16aff4e
lib: test-array - fatal tests
Phil Carmody <phil@dovecot.fi>
parents:
18098
diff
changeset
|
60 fatal_array, |
17672
8e990ad4db0e
lib: test-data-stack - add some fatal tests.
Phil Carmody <phil@dovecot.fi>
parents:
17671
diff
changeset
|
61 fatal_data_stack, |
17670
16761cdb2537
lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents:
17641
diff
changeset
|
62 fatal_mempool, |
17671
84ead9b26d59
lib: test fatal cases for printf_format_fix
Phil Carmody <phil@dovecot.fi>
parents:
17670
diff
changeset
|
63 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
|
64 NULL |
16761cdb2537
lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents:
17641
diff
changeset
|
65 }; |
16761cdb2537
lib: test-lib - add a real fatal test for mempool-alloconly
Phil Carmody <phil@dovecot.fi>
parents:
17641
diff
changeset
|
66 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
|
67 } |