summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2018-04-13Merge branch 'token_bucket_refactor_squashed'Nick Mathewson
2018-04-13Disable load_geoip_file() tests on windowsNick Mathewson
See bug #25787 for discussion; we should have a better fix here.
2018-04-13Increase tolerances for imprecise time.Nick Mathewson
2018-04-13Accept small hops backward in the monotonic timer.Nick Mathewson
2018-04-13Add a new token-bucket backend abstraction, with testsNick Mathewson
This differs from our previous token bucket abstraction in a few ways: 1) It is an abstraction, and not a collection of fields. 2) It is meant to be used with monotonic timestamps, which should produce better results than calling gettimeofday over and over.
2018-04-13Expose a function that computes stamp units from msec.Nick Mathewson
(It turns out we can't just expose STAMP_TICKS_PER_SECOND, since Apple doesn't have that.)
2018-04-12Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-12Attempt to fix 32-bit clang builds, which broke with 31508a0abccfee1cdNick Mathewson
When size_t is 32 bits, the unit tests can't fit anything more than 4GB-1 into a size_t. Additionally, tt_int_op() uses "long" -- we need tt_u64_op() to safely test uint64_t values for equality. Bug caused by tests for #24782 fix; not in any released Tor.
2018-04-12Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-12Use less memory for MaxMemInQueues for machines with more than 8 GB of RAM.Alexander Færøy
This patch changes the algorithm of compute_real_max_mem_in_queues() to use 0.4 * RAM iff the system has more than or equal to 8 GB of RAM, but will continue to use the old value of 0.75 * RAM if the system have less than * GB of RAM available. This patch also adds tests for compute_real_max_mem_in_queues(). See: https://bugs.torproject.org/24782
2018-04-10Merge remote-tracking branch 'isis-github/bug25425_squashed2'Nick Mathewson
2018-04-10Merge remote-tracking branch 'isis-github/bug25409'Nick Mathewson
2018-04-10Remove TestingEnableTbEmptyEventNick Mathewson
This option was used for shadow testing previously, but is no longer used for anything. It interferes with refactoring our token buckets.
2018-04-09tests: Make tt_finished() macro for tests without tt_*_op() calls.Isis Lovecruft
2018-04-09test: Add testing module and some unittests for bridges.c.Isis Lovecruft
This roughly doubles our test coverage of the bridges.c module. * ADD new testing module, .../src/test/test_bridges.c. * CHANGE a few function declarations from `static` to `STATIC`. * CHANGE one function in transports.c, transport_get_by_name(), to be mockable. * CLOSES #25425: https://bugs.torproject.org/25425
2018-04-06Merge branch 'isolate_libevent_2_squashed'Nick Mathewson
2018-04-05Remove needless event2/thread.h include from test_compat_libevent.cNick Mathewson
2018-04-05Remove redundant event2/event.h usage from test_scheduler.cNick Mathewson
This module doesn't actually need to mock the libevent mainloop at all: it can just use the regular mainloop that the test environment sets up. Part of ticket 23750.
2018-04-05Move responsibility for threadpool reply-handler events to workqueueNick Mathewson
This change makes cpuworker and test_workqueue no longer need to include event2/event.h. Now workqueue.c needs to include it, but that is at least somewhat logical here.
2018-04-05Wrap the function we use to run the event loop.Nick Mathewson
Doing this lets us remove the event2/event.h header from a few more modules, particularly in the tests. Part of work on 23750.
2018-04-05Add wrappers for event_base_loopexit and event_base_loopbreak.Nick Mathewson
2018-04-05Merge remote-tracking branch 'public/split_relay_crypto'Nick Mathewson
2018-04-04Remove PortForwarding optionsNeel Chauhan
Signed-off-by: Isis Lovecruft <isis@torproject.org>
2018-04-02tests: Run all existing protover tests in both languages.Isis Lovecruft
There's now no difference in these tests w.r.t. the C or Rust: both fail miserably (well, Rust fails with nice descriptive errors, and C gives you a traceback, because, well, C).
2018-04-02tests: Make inline comments in test_protover.c more accurate.Isis Lovecruft
The DoS potential is slightly higher in C now due to some differences to the Rust code, see the C_RUST_DIFFERS tags in src/rust/protover/tests/protover.rs. Also, the comment about "failing at the splitting stage" in Rust wasn't true, since when we split, we ignore empty chunks (e.g. "1--1" parses into "(1,None),(None,1)" and "None" can't be parsed into an integer). Finally, the comment about "Rust seems to experience an internal error" is only true in debug mode, where u32s are bounds-checked at runtime. In release mode, code expressing the equivalent of this test will error with `Err(ProtoverError::Unparseable)` because 4294967295 is too large.
2018-04-02protover: Change protover_all_supported() to return only unsupported.Isis Lovecruft
Previously, if "Link=1-5" was supported, and you asked protover_all_supported() (or protover::all_supported() in Rust) if it supported "Link=3-999", the C version would return "Link=3-999" and the Rust would return "Link=6-999". These both behave the same now, i.e. both return "Link=6-999".
2018-04-02tests: Run all existing protover tests in both languages.Isis Lovecruft
There's now no difference in these tests w.r.t. the C or Rust: both fail miserably (well, Rust fails with nice descriptive errors, and C gives you a traceback, because, well, C).
2018-04-02tests: Make inline comments in test_protover.c more accurate.Isis Lovecruft
The DoS potential is slightly higher in C now due to some differences to the Rust code, see the C_RUST_DIFFERS tags in src/rust/protover/tests/protover.rs. Also, the comment about "failing at the splitting stage" in Rust wasn't true, since when we split, we ignore empty chunks (e.g. "1--1" parses into "(1,None),(None,1)" and "None" can't be parsed into an integer). Finally, the comment about "Rust seems to experience an internal error" is only true in debug mode, where u32s are bounds-checked at runtime. In release mode, code expressing the equivalent of this test will error with `Err(ProtoverError::Unparseable)` because 4294967295 is too large.
2018-04-02protover: Change protover_all_supported() to return only unsupported.Isis Lovecruft
Previously, if "Link=1-5" was supported, and you asked protover_all_supported() (or protover::all_supported() in Rust) if it supported "Link=3-999", the C version would return "Link=3-999" and the Rust would return "Link=6-999". These both behave the same now, i.e. both return "Link=6-999".
2018-04-02Remove event2/event.h include from compat_libevent.hNick Mathewson
Only one module was depending on this include (test_helpers.c), and it was doing so incorrectly.
2018-04-01misc tiny fixesRoger Dingledine
2018-03-28Merge branch 'maint-0.3.3'Nick Mathewson
2018-03-28Merge remote-tracking branch 'dgoulet/bug24767_033_03' into maint-0.3.3Nick Mathewson
2018-03-28Merge branch 'maint-0.3.3'Nick Mathewson
2018-03-28Rename string_is_valid_hostname -> string_is_valid_nonrfc_hostnameNick Mathewson
Per discussion on 25055.
2018-03-28Don't explode on NULL or empty stringrl1987
2018-03-28Allow alphanumeric TLDs in test for nowrl1987
2018-03-28Validate hostnames with punycode TLDs correctlyrl1987
2018-03-28Test TLD validationrl1987
2018-03-28Also test bracket-less IPv6 string validationrl1987
2018-03-28Fix bracketed IPv6 string validationrl1987
2018-03-28Do not consider IP strings valid DNS names. Fixes #25055rl1987
2018-03-28Allow IPv6 address strings to be used as hostnames in SOCKS5 requestsrl1987
2018-03-27test: Add unittest for the OR connection failure cacheGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-03-27Merge branch 'maint-0.3.3'Nick Mathewson
2018-03-26Merge branch 'bug24658-rm-curve25519-header' into bug24658-mergeNick Mathewson
2018-03-26Fix a unit test which was broken by the previous commitNick Mathewson
This test was expecting Tor to find and use routerinfos, but hadn't cleared the UseMicrodescriptors flag. Part of the fix for 25213.
2018-03-24Basic unit tests for relay_crypto.cNick Mathewson
These tests handle incoming and outgoing cells on a three-hop circuit, and make sure that the crypto works end-to-end. They don't yet test spec conformance, leaky-pipe, or various error cases.
2018-03-23test: more data on geoip load failure.Nick Mathewson
2018-03-23Merge branch 'maint-0.3.3'Nick Mathewson