summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
AgeCommit message (Collapse)Author
2016-01-11Make the touch_file unit test work around FS/system time sync issuesNick Mathewson
Sometimes you can call time() and then touch a file, and have the second come out a little before the first. See #18025 for way more information than you necessarily wanted.
2016-01-07Fix #18012 harder.Nick Mathewson
2016-01-07Try to fix windows test build (#18012)Nick Mathewson
2016-01-03Unit tests for getpw* functionsNick Mathewson
2016-01-03clean up the "skip this util test on windows" logic.Nick Mathewson
2016-01-03Add a test for touch_fileNick Mathewson
2015-11-19Merge remote-tracking branch 'teor/bug17632-no-ipv4-no-localhost-squashed'Nick Mathewson
2015-11-19Fixup #17638: ignore EINVAL from FreeBSD jails without ::1teor (Tim Wilson-Brown)
In my testing, an IPv6-only FreeBSD jail without ::1 returned EINVAL from tor_ersatz_socketpair. Let's not fail the unit test because of this - it would only ever use tor_socketpair() anyway.
2015-11-19Make tor_ersatz_socketpair work on IPv6-only systemsteor (Tim Wilson-Brown)
(But it won't work on some systems without IPv4/IPv6 localhost (some BSD jails) by design, to avoid creating sockets on routable IP addresses. However, those systems likely have the AF_UNIX socketpair, which tor prefers.) Fixes bug #17638; bugfix on a very early tor version, earlier than 22dba27d8dd5 (23 Nov 2004) / svn:r2943. Patch by "teor".
2015-11-19Fix unit tests on systems without IPv4 or localhost addressesteor (Tim Wilson-Brown)
Make unit tests pass on IPv6-only systems, and systems without localhost addresses (like some FreeBSD jails). Fixes: * get_if_addrs_ifaddrs: systems without localhost * get_if_addrs_ioctl: only works on IPv4 systems * socket: check IPv4 and IPv6, skip on EPROTONOSUPPORT * socketpair_ersatz: uses IPv4, skip on EPROTONOSUPPORT Fixes bug #17632; bugfix on unit tests in 0.2.7.3-rc. c464a367728d was a partial fix for this issue in #17255; it was released in unit tests in 0.2.7.4-rc. Patch by "teor".
2015-11-19Really Really Fixup 86eba14ac549: Windows support, error return valuesteor (Tim Wilson-Brown)
2015-11-18Really Fixup 86eba14ac549: error return values are negativeteor (Tim Wilson-Brown)
2015-11-18Fixup 86eba14ac549: add errno.h for EPROTONOSUPPORTteor (Tim Wilson-Brown)
2015-11-18Fix unit tests on systems without IPv4 or localhost addressesteor (Tim Wilson-Brown)
Make unit tests pass on IPv6-only systems, and systems without localhost addresses (like some FreeBSD jails). Fixes: * get_if_addrs_ifaddrs: systems without localhost * get_if_addrs_ioctl: only works on IPv4 systems * socket: check IPv4 and IPv6, skip on EPROTONOSUPPORT * socketpair_ersatz: uses IPv4, skip on EPROTONOSUPPORT Fixes bug #17632; bugfix on unit tests in 0.2.7.3-rc. c464a367728d was a partial fix for this issue in #17255; it was released in unit tests in 0.2.7.4-rc. Patch by "teor".
2015-11-12Merge branch 'karsten_bug13192_026_03_teor'Nick Mathewson
2015-11-12Rename cast_double_to_int64 to clamp_double_to_int64Nick Mathewson
2015-11-12Make round_to_next_multiple_of always round upwards.Nick Mathewson
Yes, even if it has to return a non-multiple. This prevents us from ever having a bug where we try to use it for allocation, and under-allocate.
2015-08-21Fix a bunch of check-spaces complaintsSebastian Hahn
2015-08-17Bring the dimap tests up to 100%Nick Mathewson
2015-08-11Fix a 32-bit compilation warningNick Mathewson
2015-08-05Add a compat function to check how much disk space is free.Nick Mathewson
Closes ticket 16734.
2015-07-27Allow a single trailing `.` when validating FQDNs from SOCKS.Yawning Angel
URI syntax (and DNS syntax) allows for a single trailing `.` to explicitly distinguish between a relative and absolute (fully-qualified) domain name. While this is redundant in that RFC 1928 DOMAINNAME addresses are *always* fully-qualified, certain clients blindly pass the trailing `.` along in the request. Fixes bug 16674; bugfix on 0.2.6.2-alpha.
2015-06-24Work around nytimes.com's broken hostnames in our SOCKS checks.Yawning Angel
RFC 952 is approximately 30 years old, and people are failing to comply, by serving A records with '_' as part of the hostname. Since relaxing the check is a QOL improvement for our userbase, relax the check to allow such abominations as destinations, especially since there are likely to be other similarly misconfigured domains out there.
2015-06-03Remove undefined directive-in-macro in test_util_writepidteor
clang 3.7 complains that using a preprocessor directive inside a macro invocation in test_util_writepid in test_util.c is undefined. Fix on 79e85313aa61 on 0.2.7.1-alpha.
2015-05-07Merge branch 'writing_tests'Nick Mathewson
2015-05-07Write the outlines of a WritingTests.txt documentNick Mathewson
Also, add some sample tests to be examples.
2015-05-06Remove test for strclear as it no longer exists in the codebaseteor
2015-05-06Use standard float.h header and resolve undefined left shift behaviourteor
2015-05-06Add unit tests for cast_double_to_int64().teor
2015-05-06Tweak teor's and dgoulet's #13192 patches.Karsten Loesing
- Rewrite changes file. - Avoid float comparison with == and use <= instead. - Add teor's tor_llround(trunc(...)) back to silence clang warnings. - Replace tt_assert() with tt_i64_op() and friends. - Fix whitespace and a comment.
2015-05-06Test: change INT64_MAX to DBL_MAX in laplace testDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-06Test: remove edge cases that assert in laplace testDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-06Handle edge cases in the round_*_to_next_multiple_of functionsteor
Consistently check for overflow in round_*_to_next_multiple_of. Check all round_*_to_next_multiple_of functions with expected values. Check all round_*_to_next_multiple_of functions with maximal values. Related to HS stats in #13192.
2015-05-06Handle edge cases in laplace functionsteor
Avoid division by zero. Avoid taking the log of zero. Silence clang type conversion warnings using round and trunc. The existing values returned by the laplace functions do not change. Add tests for laplace edge cases. These changes pass the existing unit tests without modification. Related to HS stats in #13192.
2015-02-25Merge remote-tracking branch 'yawning/bug14922'Nick Mathewson
2015-02-23Remove lingering mempool codecypherpunks
2015-02-17Remove tor_strclear(), and replace previous calls with memwipe().Yawning Angel
2015-02-11Remove mempools and buf freelistsNick Mathewson
They have been off-by-default since 0.2.5 and nobody has complained. :) Also remove the buf_shrink() function, which hasn't done anything since we first stopped using contiguous memory to store buffers. Closes ticket 14848.
2015-01-23Split the slow unit tests into their own binaryNick Mathewson
This can run in parallel with the faster ones and the other tests.
2015-01-21Merge branch 'better_workqueue_v3_squashed'Nick Mathewson
2015-01-15unittests: use tt_i64_op() instead of tt_int_op() in laplace tests.George Kadianakis
Do this in even more places to try to fix the build.
2015-01-15unittests: use tt_i64_op() instead of tt_int_op() in laplace tests.George Kadianakis
2015-01-15unittests: Change some tt_assert()s to tt_int_op()s.George Kadianakis
2015-01-15Restrict sample values of the Laplace distribution to int64_t.George Kadianakis
This helps avoid undefined behavior from casting big double values to int64_t. Fixes #14090.
2015-01-14Basic unit test for condition variables.Nick Mathewson
2015-01-14Move thread tests into their own moduleNick Mathewson
2015-01-08fix new mingw64 compilation warningsNick Mathewson
2015-01-07Merge branch 'bug9286_v3_squashed'Nick Mathewson
2015-01-07Stop accepting milliseconds in various directory contextsNick Mathewson
Have clients and authorities both have new behavior, since the fix for bug 11243 has gone in. But make clients still accept accept old bogus HSDir descriptors, to avoid fingerprinting trickery. Fixes bug 9286.
2015-01-06Merge remote-tracking branch 'public/feature11791'Nick Mathewson