aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util.c
AgeCommit message (Collapse)Author
2017-08-24apply ahf's test_assert_null.cocciNick Mathewson
2017-08-24Fix operator usage in src/test/*.cAlexander Færøy
This patch fixes the operator usage in src/test/*.c to use the symbolic operators instead of the normal C comparison operators. This patch was generated using: ./scripts/coccinelle/test-operator-cleanup src/test/*.[ch]
2017-08-08Merge branch 'maint-0.3.1'Nick Mathewson
2017-08-08Merge remote-tracking branch 'ahf/bugs/22286' into maint-0.3.1Nick Mathewson
2017-07-31Now that "base -1" is a bug, tell our unit tests to expect bug warningsNick Mathewson
Bugfix on accb734c5fc45481231b837; bug not in any released Tor.
2017-06-20Add a unit test for decompressing concatenated inputs.Nick Mathewson
2017-05-19fix a coverity resource leak warningNick Mathewson
2017-05-18Add support for %include funcionality on torrc #1922Daniel Pinto
config_get_lines is now split into two functions: - config_get_lines which is the same as before we had %include - config_get_lines_include which actually processes %include
2017-05-17Check that tor_compress_state_size() returns a value larger than zero.Alexander Færøy
See: https://bugs.torproject.org/22286
2017-05-16Ensure that each compression backend returns a provider version identifier.Alexander Færøy
2017-05-02Merge branch 'compress_none_v2_squashed'Nick Mathewson
2017-05-02Add unit tests for the NO_METHOD compressorNick Mathewson
These required some special-casing, since some of the assumption about real compression algorithms don't actually hold for the identity transform. Specifically, we had assumed: - compression functions typically change the lengths of their inputs. - decompression functions can detect truncated inputs - compression functions have detectable headers None of those is true for the identity transformation.
2017-05-01Rename x-lzma to x-tor-lzmaNick Mathewson
We shouldn't call it lzma, because we are imposing a limit on the memory needed for decoding.
2017-04-27Document and test nul-terminating behavior of tor_uncompress()Nick Mathewson
We added this as a safety feature, but there are a few places in the code that actually depend on it.
2017-04-27whitespace fixNick Mathewson
2017-04-27Re-enable the partial-input test for zstd.Nick Mathewson
There were two issues here: first, zstd didn't exhibit the right behavior unless it got a very large input. That's fine. The second issue was a genuine bug, fixed by 39cfaba9e26d1ca0a.
2017-04-27Have a separate entry point for each compresion testNick Mathewson
2017-04-27Refactor compression tests into a single test.Alexander Færøy
This patch refactors our compression tests such that deflate, gzip, lzma, and zstd are all tested using the same code. Additionally we use run-time checks to see if the given compression method is supported instead of using HAVE_LZMA and HAVE_ZSTD. See: https://bugs.torproject.org/22085
2017-04-25Combine all *compress/*uncompress backend function into oneNick Mathewson
Since we have a streaming API for each compression backend, we don't need a non-streaming API for each: we can build a common non-streaming API at the front-end.
2017-04-25Add function to check if a given compression method is supported.Alexander Færøy
This patch adds support for checking if a given `compress_method_t` is supported by the currently running Tor instance using `tor_compress_supports_method()`. See: https://bugs.torproject.org/21662
2017-04-25Add Zstandard support.Alexander Færøy
See: https://bugs.torproject.org/21662
2017-04-25Add LZMA support.Alexander Færøy
See: https://bugs.torproject.org/21662
2017-04-17Refactor the streaming compression code.Alexander Færøy
This patch refactors our streaming compression code to allow us to extend it with non-zlib/non-gzip based compression schemas. See https://bugs.torproject.org/21663
2017-04-17Rename `tor_gzip_{compress,uncompress}` to `tor_{compress,uncompress}`.Alexander Færøy
To allow us to use the API name `tor_compress` and `tor_uncompress` as the main entry-point for all compression/uncompression and not just gzip and zlib. See https://bugs.torproject.org/21663
2017-04-17Fix whitespace in test_util_gzip() around `OP_*``.Alexander Færøy
See https://bugs.torproject.org/21663
2017-04-17Use tt_int_op() over tt_assert() and do explicit NULL checks in ↵Alexander Færøy
test_util_gzip(). This patch changes some of the tt_assert() usage in test_util_gzip() to use tt_int_op() to get better error messages upon failure. Additionally we move to use explicit NULL checks. See https://bugs.torproject.org/21663
2017-03-17Split strings at newline in tor_get_lines_from_handle().Alexander Færøy
This patch fixes a regression described in bug #21757 that first appeared after commit 6e78ede73f which was an attempt to fix bug #21654. When switching from buffered I/O to direct file descriptor I/O our output strings from get_string_from_pipe() might contain newline characters (\n). In this patch we modify tor_get_lines_from_handle() to ensure that the function splits the newly read string at the newline character and thus might return multiple lines from a single call to get_string_from_pipe(). Additionally, we add a test case to test_util_string_from_pipe() to ensure that get_string_from_pipe() correctly returns multiple lines in a single call. See: https://bugs.torproject.org/21757 See: https://bugs.torproject.org/21654
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-09Remove fgets() compatbility function and related tests.Alexander Færøy
This patch removes the `tor_fgets()` wrapper around `fgets(3)` since it is no longer needed. The function was created due to inconsistency between the returned values of `fgets(3)` on different versions of Unix when using `fgets(3)` on non-blocking file descriptors, but with the recent changes in bug #21654 we switch from unbuffered to direct I/O on non-blocking file descriptors in our utility module. We continue to use `fgets(3)` directly in the geoip and dirserv module since this usage is considered safe. This patch also removes the test-case that was created to detect differences in the implementation of `fgets(3)` as well as the changes file since these changes was not included in any releases yet. See: https://bugs.torproject.org/21654
2017-03-09Add test case for get_string_from_pipe().Alexander Færøy
This patch adds a test case for the get_string_from_pipe() function found in the utility module. See: See: https://bugs.torproject.org/21654
2017-03-01Reset `buf` after each succesful test to avoid artifacts.Alexander Færøy
This patch resets `buf` in test_util_fgets_eagain() after each succesful ivocation to avoid stray artifacts left in the buffer by erroneous tor_fgets() calls.
2017-03-01Use tor_fgets() instead of fgets().Alexander Færøy
This patch changes our use of fgets() to tor_fgets() for more consistent error handling across different versions of the C library.
2017-02-27Merge branch 'disable_memory_sentinels_squashed'Nick Mathewson
2017-02-27Code to disable memory sentinels for fuzzingNick Mathewson
This feature makes it possible to turn off memory sentinels (like those used for safety in buffers.c and memarea.c) when fuzzing, so that we can catch bugs that they would otherwise prevent.
2017-02-14Merge branch 'bug20894_029_v3'Nick Mathewson
2017-02-14Don't atoi off the end of a buffer chunk.Nick Mathewson
Fixes bug 20894; bugfix on 0.2.0.16-alpha. We already applied a workaround for this as 20834, so no need to freak out (unless you didn't apply 20384 yet).
2017-02-08test: Add missing socket errno in test_util.cDavid Goulet
According to 21116, it seems to be needed for Wheezy Raspbian build. Also, manpage of socket(2) does confirm that this errno value should be catched as well in case of no support from the OS of IPv4 or/and IPv6. Fixes #21116 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-12-23Fix unreachable heap corruption in base64_decode()Hans Jerry Illikainen
Give size_mul_check() external linkage and use it in base64_decode() to avoid a potential integer wrap. Closes #19222
2016-12-16Merge branch 'prop271_030_v1_squashed'Nick Mathewson
2016-12-07Merge branch 'maint-0.2.9'Nick Mathewson
2016-12-07Increase tolerances in util/monotonic_time testsNick Mathewson
This is an attempt to fix #19974.
2016-11-30Teach parse_iso_time about the spaceless variant.Nick Mathewson
(We previously added support for generating the spaceless 2016-11-14T19:58:12 variant, but not for actually parsing it.)
2016-11-03Refactor tests for tor_htonll and tor_ntohllovercaffeinated
Following kind feedback from dgoulet: add tests for min (0) and max (UINT64_MAX) values. Rename expected results to something more sensible than 'n'.
2016-11-03Add unit test for tor_htonll and tor_ntohllovercaffeinated
Add tests for tor_htonll and tor_ntohll - fixes bug 19563.
2016-10-14Whitespace cleaningNick Mathewson
2016-10-14Make the FreeBSD ersatz_socketpair test even more skippable.Nick Mathewson
(This is safe, since only windows actually -uses- erstaz_socketpair.)
2016-10-13ersatz socketpair tests: work around freebsd jails.Nick Mathewson
2016-10-11torrc parsing b0rks on carriage-returnpaolo.ingls@gmail.com
(Specifically, carriage return after a quoted value in a config line. Fixes bug 19167; bugfix on 0.2.0.16-alpha when we introduced support for quoted values. Unit tests, changes file, and this parenthetical by nickm.)
2016-09-22Coverity warning fix: let coverity tell we're closing socketsNick Mathewson
Our use of the (mockable) tor_close_socket() in the util/socket_.. tests confused coverity, which could no longer tell that we were actually closing the sockets.
2016-09-11Whoops. Cant call sockaddr_in a "sin", since sin() is a thing.Nick Mathewson