summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2017-03-16Merge branch 'storagedir_squashed'Nick Mathewson
2017-03-16Define a "storagedir" abstraction to hold numerous similar filesNick Mathewson
We could use one of these for holding "junk" descriptors and unparseable things -- but we'll _need_ it for having cached consensuses and diffs between them.
2017-03-16Merge branch 'prop140_21643_diff_only_squashed'Nick Mathewson
2017-03-16Avoid all needless memory copies when computing consensus diffs.Nick Mathewson
Previously, we operated on smartlists of NUL-terminated strings, which required us to copy both inputs to produce the NUL-terminated strings. Then we copied parts of _those_ inputs to produce an output smartlist of NUL-terminated strings. And finally, we concatenated everything into a final resulting string. This implementation, instead, uses a pointer-and-extent pattern to represent each line as a pointer into the original inputs and a length. These line objects are then added by reference into the output. No actual bytes are copied from the original strings until we finally concatenate the final result together. Bookkeeping structures and newly allocated strings (like ed commands) are allocated inside a memarea, to avoid needless mallocs or complicated should-I-free-this-or-not bookkeeping. In my measurements, this improves CPU performance by something like 18%. The memory savings should be much, much higher.
2017-03-16Add fuzzers for consensus diff backend codeNick Mathewson
This takes two fuzzers: one which generates a diff and makes sure it works, and one which applies a diff. So far, they won't crash, but there's a bug in my string-manipulation code someplace that I'm having to work around, related to the case where you have a blank line at the end of a file, or where you diff a file with itself.
2017-03-16Fix an abstraction violation.Nick Mathewson
Don't alias the insides of smartlist_t; that way lies madness.
2017-03-16prop140: Use sha3-256, not sha2-256Nick Mathewson
This is a protocol update from recent prop140 changes. Also, per #21673, we need to check the entire document, including signatures.
2017-03-16Add a couple more cases to reach 100% coverage.Nick Mathewson
2017-03-16Cover two more failing cases with unit testsNick Mathewson
2017-03-16Tweak&test log messages on apply_diffNick Mathewson
2017-03-16Check for expected warnings in apply_ed_diffNick Mathewson
2017-03-16test operator cleanupNick Mathewson
2017-03-16Enforce correct log messages on diff generation failure testsNick Mathewson
2017-03-16Test two more base64cmp cases.Nick Mathewson
2017-03-16Use "STATIC" to export consdiff fns for testingNick Mathewson
Previously test_consdiff.c just did #include "consdiff.c", which is not great style, and messes up coverage testing.
2017-03-16Consensus diff backend from Daniel Martí GSOC project.Daniel Martí
(This commit was extracted by nickm based on the final outcome of the project, taking only the changes in the files touched by this commit from the consdiff_rebased branch. The directory-system changes are going to get worked on separately.)
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-13Fix some compilation warnings in {test_,}hs_descriptor.cNick Mathewson
Nothing big: just some const char[]s that should have been static, and some integer truncation warnings. Warnings not in any released Tor.
2017-03-13Merge remote-tracking branch 'asn/bug21334_v3'Nick Mathewson
2017-03-13prop224: Rename padding size def to something less confusing.George Kadianakis
People felt it could refer to the descriptor header section instead of the plaintext of the superencrypted section.
2017-03-13prop224: Add unittests for decode_superencrypted().George Kadianakis
2017-03-13prop224: Fix the HS descriptor unittests.George Kadianakis
- HS descriptors are now bigger than 10kb. - encrypted_data_length_is_valid() is not that strict now.
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-09Remove buffered I/O stream usage in process_handle_t.Alexander Færøy
This patch removes the buffered I/O stream usage in process_handle_t and its related utility functions. This simplifies the code and avoids racy code where we used buffered I/O on non-blocking file descriptors. See: https://bugs.torproject.org/21654
2017-03-06Merge remote-tracking branch 'ahf/bugs/20988'Nick Mathewson
2017-03-06Merge remote-tracking branch 'teor/bug19699'Nick Mathewson
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-03-01Merge branch 'maint-0.3.0'Nick Mathewson
2017-03-01Make test-network.sh always call chutney's test-network.shteor
Previously, this only worked on systems which had bash installed, due to some bash-specific code in the script. Fixes bug 19699; follow-up to 21581.
2017-03-01Remove the space before the interpreter name in test-network.shteor
Apparently some unixes don't like this. Part of #21581.
2017-03-01Remove the space before the interpreter name in test-network.shteor
Apparently some unixes don't like this. Part of #21581.
2017-02-28Merge branch 'maint-0.3.0'Nick Mathewson
2017-03-01Restore support for test-network.sh on BSD and other systems without bashteor
(But use bash if it's available.) This is a workaround until we remove bash-specific code in 19699. Fixes bug 21581; bugfix on 21562, not in any released version of tor.
2017-02-28Merge remote-tracking branch 'teor/bug21510'Nick Mathewson
2017-02-28Merge remote-tracking branch 'teor/test21470-029'Nick Mathewson
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-27Merge branch 'maint-0.3.0'Nick Mathewson
2017-02-28Use bash in src/test/test-network.shteor
This ensures we reliably call chutney's newer tools/test-network.sh when available. Fixes bug 21562; bugfix on tor-0.2.9.1-alpha.
2017-02-28Reserve a test-network.sh exit status of 2 for unknown argumentsteor
Part of 21570.
2017-02-28Add a quiet mode to test-network.shteor
Requires the equivalent chutney changes in 21571. Part of 21570.
2017-02-24Merge branch 'maint-0.3.0'Nick Mathewson
2017-02-24hs: Fix bad use of sizeof() when encoding ESTABLISH_INTRO legacy cellDavid Goulet
When encoding a legacy ESTABLISH_INTRO cell, we were using the sizeof() on a pointer instead of using the real size of the destination buffer leading to an overflow passing an enormous value to the signing digest function. Fortunately, that value was only used to make sure the destination buffer length was big enough for the key size and in this case it always was because of the overflow. Fixes #21553 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-02-24prop224: Rename auth_required HS desc field to intro_auth_required.George Kadianakis
And remove "password" type from the list of intro auths.
2017-02-19Make display of captured unit test log messages consistentteor
There was a missing space and an extra colon. Fixes bug 21510; bugfix on 0.2.9.3-alpha.
2017-02-19Reject versions that have non-numeric prefixesteor
Unit tests #21507. Part of #21470.
2017-02-19Add unit tests that ensure out of range versions are rejectedteor
Unit tests for #21278. Part of #21470.
2017-02-19Add unit tests for version parsing integer size inconsistenciesteor
Unit tests for #21450. Part of #21470.