Nick Mathewson
5cea500ce7
Merge branch 'bug11743_option_b'
2014-05-06 20:40:40 -04:00
Nick Mathewson
52416f8cfb
Unit test for dirvote_create_microdescriptor
2014-05-06 20:36:19 -04:00
Nick Mathewson
ed0e2ecaa7
Unit test for write_to_buf_zlib
2014-05-06 19:29:56 -04:00
Nick Mathewson
e9c1c3ff7f
Add a siphash benchmark.
2014-05-06 12:55:39 -04:00
Nick Mathewson
29b7397ebe
Fix test_config_write_to_data_subdir
...
Bugfix on aa0eb2022342798fc78b2bde89d393f37c59fe78; bugfix not on any
released Tor.
2014-05-01 13:27:20 -04:00
Nick Mathewson
b51ce90777
Merge remote-tracking branch 'public/valgrind_tests'
2014-05-01 12:29:31 -04:00
Nick Mathewson
aa0eb20223
Fix leaks in tests related to setting options->DataDirectory
...
We pre-populate that value in main(), and we weren't freeing it
before overriding it.
2014-04-29 12:48:02 -04:00
Nick Mathewson
ee9ed9d817
Fix memory leaks in test_status.c
2014-04-29 12:48:02 -04:00
Nick Mathewson
212e982d9b
Fix leaks in dir voting tests
2014-04-29 12:48:02 -04:00
Andrea Shepard
91ff10f6be
Make --disable-buf-freelists build and pass unit tests
2014-04-29 02:18:34 -07:00
Nick Mathewson
f4be34f70d
Make the python test scripts work on python3
...
The python scripts invoked by 'make check' didn't work on python3
before. That was a problem on systems where 'python' is python3.
Fixes bug 11608; bugfix on 0.2.5.2-alpha.
2014-04-27 22:54:24 -04:00
Nick Mathewson
504e2000ed
Fix leaks in test_oom.c
2014-04-26 12:17:10 -04:00
Nick Mathewson
97664cfd2a
Fix leaks in test_dir_formats
2014-04-26 12:16:12 -04:00
Nick Mathewson
b60782b6d6
Fix numerous leaks in test_pt.c
...
I didn't find a managed_proxy_free() function any place; shouldn't
there be one?
2014-04-26 11:28:39 -04:00
Nick Mathewson
b11ab0d91d
test_cntev_append_cell_stats now no longer leaks
2014-04-26 00:40:22 -04:00
Nick Mathewson
b4b07c17e3
Fix leaks in test_exit_policy_dump_to_string
2014-04-26 00:36:09 -04:00
Nick Mathewson
558becad8c
Memory leaks in test_config_addressmap
2014-04-26 00:27:21 -04:00
Nick Mathewson
ffffd860c9
Fix a leak in test_buffer_allocation_tracking
2014-04-26 00:18:15 -04:00
Nick Mathewson
1117889f4a
Fix memory leak in unittest helper function.
2014-04-26 00:13:49 -04:00
Nick Mathewson
9fbb5a44b8
Fix memory leak in test_util_asprintf
2014-04-26 00:13:27 -04:00
Nick Mathewson
dc0fcbd812
Fix memory leaks in test_cntev_append_cell_stats
2014-04-26 00:12:39 -04:00
Nick Mathewson
3fa296ce28
fix uninitialized memory reads from test_geoip_with_pt. Found with valgrind
2014-04-26 00:12:16 -04:00
Nick Mathewson
fa202c4127
Fix memory leak in test_geoip
2014-04-26 00:11:46 -04:00
Nick Mathewson
1cf02605d4
Fix memory leak in test_onion_queues
2014-04-26 00:11:17 -04:00
Nick Mathewson
c7951731ed
Fix memory leaks in test_circuit_timeout
...
Found with valgrind.
2014-04-26 00:10:04 -04:00
Nick Mathewson
167536a112
fix memory leak in dump_exit_policy_to_string tests
2014-04-25 01:59:20 -04:00
Nick Mathewson
d3c05a79f0
Merge branch 'scanbuild_fixes'
2014-04-25 01:24:39 -04:00
Nick Mathewson
67aa3685e7
Merge branch 'bug11396_v2_squashed'
...
Conflicts:
src/or/main.c
2014-04-24 10:31:38 -04:00
Nick Mathewson
aca05fc5c0
get_total_system_memory(): see how much RAM we have
2014-04-24 10:26:14 -04:00
Nick Mathewson
685d450ab3
scan-build: avoid undef behaior in tor_inet_pton
...
If we had an address of the form "1.2.3.4" and we tried to pass it to
tor_inet_pton with AF_INET6, it was possible for our 'eow' pointer to
briefly move backwards to the point before the start of the string,
before we moved it right back to the start of the string. C doesn't
allow that, and though we haven't yet hit a compiler that decided to
nuke us in response, it's best to fix.
So, be more explicit about requiring there to be a : before any IPv4
address part of the IPv6 address. We would have rejected addresses
without a : for not being IPv6 later on anyway.
2014-04-19 13:14:33 -04:00
Nick Mathewson
1800e79ca5
scan-build: Fix harmless sizeof(ptr) in test_oom.c
...
We meant to using random bytes to fill a buffer, up to 3000 at a
time. Instead we were taking them sizeof(void*) at a time.
2014-04-19 12:52:00 -04:00
Nick Mathewson
69ea4450ca
scan-build: fix a crash-on-fail possibility in test_policy.c
2014-04-18 20:33:21 -04:00
Nick Mathewson
0175fcaf7c
Fix uninitialized-ram free in unit tests
...
Fix on fb595922; bug not in any released Tor. Found with
--enable-expensive-hardening.
2014-04-17 01:03:10 -04:00
Nick Mathewson
1126ce1d86
Fix compiler warning on test_status.c
2014-04-15 15:19:41 -04:00
dana koch
3ce3984772
Uplift status.c unit test coverage with new test cases and macros.
...
A new set of unit test cases are provided, as well as introducing
an alternative paradigm and macros to support it. Primarily, each test
case is given its own namespace, in order to isolate tests from each
other. We do this by in the usual fashion, by appending module and
submodule names to our symbols. New macros assist by reducing friction
for this and other tasks, like overriding a function in the global
namespace with one in the current namespace, or declaring integer
variables to assist tracking how many times a mock has been called.
A set of tests for a small-scale module has been included in this
commit, in order to highlight how the paradigm can be used. This
suite gives 100% coverage to status.c in test execution.
2014-04-15 15:00:34 -04:00
Nick Mathewson
0820031419
Merge remote-tracking branch 'asn/bug11486'
2014-04-12 21:42:45 -04:00
George Kadianakis
1ec4d52e59
Add another unit test for parse_bridge_line().
2014-04-11 21:06:53 +03:00
Nick Mathewson
2f73525883
Fix a dumb C bug in the unit tests for 9841
...
Fixes bug 11460; bug only affects unit tests and is not in any
released version of Tor.
2014-04-09 09:20:25 -04:00
Nick Mathewson
fa6b80d6e5
Merge remote-tracking branch 'public/bug10431'
2014-04-09 08:29:21 -04:00
Nick Mathewson
b933fdcc11
Move existing policy tests from test.c to new test_policy.c
2014-04-08 14:14:12 -04:00
Nick Mathewson
d0af665758
Remove unused extern decl for a nonexistent test suite
2014-04-08 14:10:59 -04:00
Nick Mathewson
245f273aaf
Merge branch 'bug7952_final'
...
Conflicts:
src/test/include.am
src/test/test.c
2014-04-08 13:55:02 -04:00
rl1987
51e13cd1ad
Making entire exit policy available to Tor controller.
2014-04-08 13:50:02 -04:00
Nick Mathewson
fffc59b0e9
Merge remote-tracking branch 'public/bug9841_025'
2014-04-08 12:06:03 -04:00
Nick Mathewson
f0bce2dc35
Fix some harmless/untriggerable memory leaks found by coverity
2014-04-07 23:20:13 -04:00
Nick Mathewson
595303fd1e
Merge remote-tracking branch 'public/bug10363_024_squashed'
2014-04-07 23:03:04 -04:00
Nick Mathewson
9dd115d6b5
Another 10363 instance: this one in tor_memmem fallback code
2014-04-07 22:56:42 -04:00
Nick Mathewson
2ff664ee20
Merge remote-tracking branch 'public/bug10801_024'
...
Conflicts:
src/common/address.c
src/or/config.c
2014-04-05 14:50:57 -04:00
Nick Mathewson
b3469e4207
Make tor_addr_port_parse handle portless IPv6 addresses correctly.
...
(Not a bugfix on any Tor release; before 10801_024, it didn't handle
portless addresses at all.)
2014-04-05 14:41:37 -04:00
Nick Mathewson
eefa3ebc78
Add a test for default/port conflicts in tor_addr_port_parse
2014-04-05 14:18:39 -04:00
Nick Mathewson
d22ce149c8
Test for circuit_set_rend_token(.,.,NULL)
2014-04-04 12:06:54 -04:00
Nick Mathewson
da908a593f
Unit tests for connection_edge_process_resolved_cell
...
Also rename a function to be more accurate (resolve->resolved)
2014-04-02 15:38:00 -04:00
Nick Mathewson
4215c801ff
Tests for resolved_cell_parse
2014-04-02 15:38:00 -04:00
Nick Mathewson
fc9e84062b
Merge remote-tracking branch 'public/bug4645'
...
Conflicts:
src/or/dirserv.c
2014-04-01 21:49:01 -04:00
Nick Mathewson
6bef082d0a
Merge remote-tracking branch 'public/bug11232'
2014-04-01 09:39:48 -04:00
Nick Mathewson
8e94d5f22e
Check return values for tor_munmap_file() in unit tests
2014-03-31 11:40:00 -04:00
Nick Mathewson
b0bbe6b2f1
Report only the first bootstrap failure from an orconn
...
Otherwise, when we report "identity mismatch", we then later report
DONE when the connection gets closed.
Fixes bug 10431; bugfix on 0.2.1.1-alpha.
2014-03-27 15:58:43 -04:00
Nick Mathewson
9c0a1adfa2
Don't do a DNS lookup on a bridge line address
...
Fixes bug 10801; bugfix on 07bf274d
in 0.2.0.1-alpha.
2014-03-27 15:31:29 -04:00
Nick Mathewson
a83abcf5ee
Fix unittest compilation with --disable-curve25519
...
This is a fix for 9700, which we already fixed in 0.2.5.x, but which
got left in 0.2.4.x.
This is a partial backport of a0a855d586
2014-03-20 13:53:32 -04:00
Nick Mathewson
98b1aad201
Fix a use-after-free in test_circuitlist.c
...
Found by clang-3.4 analyzers.
2014-03-18 09:47:13 -04:00
Nick Mathewson
119896cd43
Fix some leaks/missed checks in the unit tests
...
Coverity spotted these.
2014-03-13 10:07:10 -04:00
Nick Mathewson
cce06b649e
Merge remote-tracking branch 'asn/bug11069_take2'
2014-03-11 11:04:47 -04:00
George Kadianakis
1c475eb018
Throw control port warning if we failed to connect to all our bridges.
2014-03-10 22:52:07 +00:00
Nick Mathewson
1365ff5b9a
Upgrade to the latest version of tinytest.
...
This brings us to tinytest commit 709a36ba63ff16d8.
The only big change tor-side is that we don't need our own test_mem_op
operation any longer.
2014-03-06 18:06:08 -05:00
Nick Mathewson
065097b81b
tinytest tt_{mem,str}_op now handle NULLs better
...
Now a NULL argument to either makes it fail, not crash.
Fies bug 9004; bugfix on 0.2.2.4-alpha.
2014-03-06 12:12:13 -05:00
Nick Mathewson
663aba07e5
Fix whitespace errors, all of them mine.
2014-03-05 14:36:32 -05:00
Nick Mathewson
f0b2dc83b6
Merge remote-tracking branch 'arma/ticket5528'
...
Conflicts:
src/or/router.c
src/test/test_dir.c
2014-03-05 12:44:40 -05:00
Nick Mathewson
ab225aaf28
Merge branch 'bug10169_025_v2'
...
Conflicts:
src/test/test.c
2014-03-04 11:03:30 -05:00
Nick Mathewson
d98f743b28
Fix compilation warnings in tor_addr_make_null patch
...
There was one "missing prototype" warning because the test function
wasn't static, and one "unused parameter" warning about the "data"
parameter.
Also, I added a couple of tests to make sure that the "make_null"
addresses really were the addresses we expected, by formatting them
as strings.
2014-03-03 10:05:02 -05:00
Kevin Murray
4deae59e1c
add test for tor_addr_make_null
...
Signed-off-by: Kevin Murray <spam@kdmurray.id.au>
2014-03-03 09:58:01 -05:00
Nick Mathewson
886d4be149
Unit tests for test_routerkeys_write_fingerprint
2014-02-28 08:53:14 -05:00
Nick Mathewson
0be9e6099b
Unit tests for pk fingerprint functions
2014-02-28 08:53:14 -05:00
dana koch
f49805b681
Restitute a successful stat call to this test case.
...
Since the first stat call is made for it to deliberately fail, and we
reference st.st_mode without st having valid data, st.st_mode can contain
garbage and cause chmod to fail with EINVAL. We rerun stat and ensure it
succeeded.
Also make use of tt_abort_perror, to properly convey failure reasons to
the user.
2014-02-17 22:55:40 +00:00
Nick Mathewson
e1deb01e5f
mingw fix: Rename a variable in the unit tests
...
Apparently, MS C is #defining "IN" on us, so we can't name a
variable IN. Delightful!
2014-02-16 12:51:35 -05:00
Nick Mathewson
35423d397f
Merge branch 'bug4900_siphash_v2'
2014-02-15 15:59:10 -05:00
Nick Mathewson
1987894626
fix a whitespace snafu
2014-02-14 23:00:04 -05:00
Nick Mathewson
fb595922b1
Tests for rend_token maps
...
This gets coverage of everything except for the cases which should be
impossible.
2014-02-13 15:24:15 -05:00
Nick Mathewson
ecd16edafe
Disallow "*/maskbits" as an address pattern.
...
Fixes bug 7484. We've had this bug back in a8eaa79e03
in
0.0.2pre14, when we first started allowing address masks.
2014-02-12 16:00:26 -05:00
Nick Mathewson
c8d41da52d
More unit tests for OOM handling.
...
This gets us up to no interesting untested new or changed lines for
the 10169 code.
2014-02-12 12:50:16 -05:00
Nick Mathewson
48877e24a8
Initial unit tests for OOM handling
2014-02-12 12:49:56 -05:00
Nick Mathewson
52d222aafb
Add tests for buffer time tracking.
2014-02-12 12:48:11 -05:00
Nick Mathewson
d379fc6e0f
Several tests for buffer allocation
2014-02-12 12:48:00 -05:00
Nick Mathewson
f425cf8338
Start writing tests for 10169.
...
Now we cover more chunk allocation functions.
2014-02-12 12:47:49 -05:00
Nick Mathewson
c1e98c8afe
Randomize the global siphash key at startup
...
This completes our conversion to using siphash for our hash functions.
2014-02-12 12:12:58 -05:00
Nick Mathewson
f51df9bb93
Tests for siphash, from reference implementation.
2014-02-12 10:58:03 -05:00
Nick Mathewson
c3720c05fa
Free leakable values in the unit tests.
...
Thanks, Coverity! (CID 1171414, 1171415, 1171416)
2014-02-11 18:10:33 -05:00
Nick Mathewson
a0577aacb4
Merge remote-tracking branch 'origin/maint-0.2.4'
2014-02-07 17:41:41 -05:00
Nick Mathewson
9bb34aa897
Survive fedora's openssl in our benchmarks
...
Apparently fedora currently has ECDH but not P224. This isn't a huge
deal, since we no longer use OpenSSL's P224 ever (see #9780 and
72c1e5acfe
). But we shouldn't have segfaulting benchmarks really.
Fixes bug 10835; bugfix on 0.2.4.8-alpha.
2014-02-07 17:36:11 -05:00
Nick Mathewson
aa3c8c1397
Use the right functions; strncpy is usually not the answer
2014-02-07 12:25:49 -05:00
Qingping Hou
57da1a5057
add test case for node_get_verbose_nickname
2014-02-06 16:13:55 -05:00
Qingping Hou
39ff3b00cf
add test for node_get_verbose_nickname_by_id
2014-02-06 16:13:55 -05:00
Qingping Hou
0fbe7f3188
remove node_describe_by_id() function
...
This function is not used anymore
2014-02-06 16:13:55 -05:00
Qingping Hou
bf66ff915a
fix longname returned in HS_DESC control events
...
According to control spec, longname should not contain any spaces and is
consists only of identy_digest + nickname
added two functions:
* node_get_verbose_nickname_by_id()
* node_describe_longname_by_id()
2014-02-06 16:13:55 -05:00
Nick Mathewson
34740a17ea
Rename sun to s_un in test_addr.c
...
Apparently the compiler on solaris 9 didn't like "sun" as an identifier.
Fix for bug 10565; bugfix on 0.2.5.1-alpha.
2014-02-06 12:36:33 -05:00
Nick Mathewson
4268cbf294
Distcheck repair: add new python testing code to "tarballs"
...
'make distcheck' now passes again.
2014-02-04 11:08:22 -05:00
Nick Mathewson
c61a472076
test_config.c: log which address should have failed
2014-02-03 16:21:32 -05:00
Nick Mathewson
24544a10c0
Clean up test_hs.c: warning fix; tor_free() usage.
...
My OSX laptop rightly gave a warning because of sticking strlen() into
an int, but once I took a closer look... it appears that the strlen()
was part of a needlessly verbose implementation for tor_strdup().
While I was there, I fixed the usage of tor_free() in test_hs.c: It
checks for NULL, and it zeros its argument. So instead of
if (foo) {
tor_free(foo);
foo = NULL;
}
we should just say
tor_free(foo);
2014-02-03 16:12:30 -05:00
rl1987
3a4b24c3ab
Removing is_internal_IP() function. Resolves ticket 4645.
2014-02-03 14:20:17 -05:00
Karsten Loesing
00ec6e6af0
More fixes to rip out all of the v2 directory code.
...
(This was a squash commit, but I forgot to squash it. Sorry! --Nick)
2014-02-03 13:34:30 -05:00
Nick Mathewson
8db8fda43f
check-spaces fixes for test_router.c
2014-02-03 13:00:15 -05:00
Nick Mathewson
fee7f25ff8
Merge remote-tracking branch 'houqp/hs_control'
2014-02-03 12:28:42 -05:00
Nick Mathewson
27d81c756b
slownacl's pure-python curve25519 lets us test ntor everywhere.
...
Improvement on f308adf838
, where we made the ntor
unit tests run everywhere... so long as a python curve25519 module
was installed. Now the unit tests don't require that module.
2014-02-03 11:34:13 -05:00
Qingping Hou
ebd99314cf
add test case for node_describe_by_id
2014-01-29 22:47:05 -05:00
Qingping Hou
0b0d4b4ebc
add test case for hidden service async events
2014-01-29 22:43:11 -05:00
Nick Mathewson
3193cbe2ba
Rip out all of the v2 directory code.
...
The remaining vestige is that we continue to publish the V2dir flag,
and that, for the controller, we continue to emit v2 directory
formats when requested.
2014-01-29 15:17:05 -05:00
Nick Mathewson
8a49fac9e0
Coverate in util.c: test that tor_parse_* rejects negative base.
2014-01-17 11:58:09 -05:00
Nick Mathewson
ab0fdbb618
Add an --accel switch to run unit tests with crypto acceleration
2014-01-17 11:58:09 -05:00
Nick Mathewson
adfcc1da4a
Merge remote-tracking branch 'origin/maint-0.2.4'
...
Conflicts:
src/or/microdesc.c
Conflict because one change was on line adjacent to line where
01206893
got fixed.
2013-12-17 13:18:00 -05:00
Nick Mathewson
3d5154550c
Merge remote-tracking branch 'public/bug10409_023' into maint-0.2.4
2013-12-17 13:15:45 -05:00
Nick Mathewson
d8cfa2ef4e
Avoid free()ing from an mmap on corrupted microdesc cache
...
The 'body' field of a microdesc_t holds a strdup()'d value if the
microdesc's saved_location field is SAVED_IN_JOURNAL or
SAVED_NOWHERE, and holds a pointer to the middle of an mmap if the
microdesc is SAVED_IN_CACHE. But we weren't setting that field
until a while after we parsed the microdescriptor, which left an
interval where microdesc_free() would try to free() the middle of
the mmap().
This patch also includes a regression test.
This is a fix for #10409 ; bugfix on 0.2.2.6-alpha.
2013-12-16 13:06:00 -05:00
Nick Mathewson
a7410c9199
Add checks to prevent memcmp(.,.,negative) in tests (CID 1064417)
2013-11-22 12:33:25 -05:00
Nick Mathewson
569dbcc615
Fix another unit test memory leak. CID1087949,CID1087950.
2013-11-22 12:27:41 -05:00
Nick Mathewson
7c76fd5a82
Fix a bunch of coverity-spotted unit test resource leaks
...
CIDs: 1130994, 1130993, 1130992, 1130991
2013-11-22 12:21:14 -05:00
Nick Mathewson
6f7eb7a0a5
Remove needless fd var from test. CID 1130989.
2013-11-22 12:16:17 -05:00
Nick Mathewson
027f4c82eb
Whitespace cleanup
2013-11-20 11:05:00 -05:00
Nick Mathewson
e7165659e0
Fix crypto/digests test
2013-11-18 13:33:29 -05:00
Nick Mathewson
a7c9d64fd6
Merge branch 'finish_prop157'
2013-11-18 13:27:06 -05:00
Nick Mathewson
4b9ec85e47
Fix whitespace
2013-11-18 11:13:40 -05:00
Nick Mathewson
fbc20294aa
Merge branch 'backtrace_squashed'
...
Conflicts:
src/common/sandbox.c
src/common/sandbox.h
src/common/util.c
src/or/main.c
src/test/include.am
src/test/test.c
2013-11-18 11:00:16 -05:00
Nick Mathewson
56e3f056e9
Tests for backtrace.c
...
These need to be a separate executable, since the point of backtrace.c
is that it can crash and write stuff.
2013-11-18 10:43:15 -05:00
Nick Mathewson
0cf234317f
Unit tests for new functions in log.c
2013-11-18 10:43:15 -05:00
Nick Mathewson
f6e07c158f
Make the dir-key-crosscert element required
...
In proposal 157, we added a cross-certification element for
directory authority certificates. We implemented it in
0.2.1.9-alpha. All Tor directory authorities now generate it.
Here, as planned, make it required, so that we can finally close
proposal 157.
The biggest change in the code is in the unit test data, where some
old hardcoded certs that we made long ago have become no longer
valid and now need to be replaced.
2013-11-14 09:37:41 -05:00
Nick Mathewson
4aa9affec2
Fix test_cmdline_args to work with old openssl
...
If openssl was old, Tor would add a warning about its version in
between saying "no torrc found, using reasonable defaults" and
"configuration was valid".
2013-11-11 15:22:08 -05:00
Nick Mathewson
940d286a74
Documentation and tests for 10060
2013-11-07 14:42:58 -05:00
Karsten Loesing
2e0fad542c
Merge branch 'morestats4' into morestats5
...
Conflicts:
doc/tor.1.txt
src/or/config.c
src/or/connection.h
src/or/control.c
src/or/control.h
src/or/or.h
src/or/relay.c
src/or/relay.h
src/test/test.c
2013-10-28 12:09:42 +01:00
Karsten Loesing
e46de82c97
squash! Pass const uint64_t pointers, document array length.
...
Don't cast uint64_t * to const uint64_t * explicitly. The cast is always
safe, so C does it for us. Doing the cast explitictly can hide bugs if
the input is secretly the wrong type.
Suggested by Nick.
2013-10-28 10:48:18 +01:00
Nick Mathewson
338bcad9e4
Make test_cmdline_args.py work with older pythons
...
I was using the assertIn() function on unit tests, which Python 2.7
introduced. But we'd like to be able to run our unit tests on Pythons
from older operating systems.
2013-10-21 14:35:01 -04:00
Nick Mathewson
d5f050111e
Fix out-of-tree "make check-local"
2013-10-11 13:42:27 -04:00
Nick Mathewson
f308adf838
When possible, run the ntor python integration tests too
2013-10-11 13:21:42 -04:00
Nick Mathewson
187398318e
When python is available, run the commandline unit tests from "make check"
2013-10-11 13:07:14 -04:00
Nick Mathewson
0546edde66
Merge branch 'bug1376'
2013-10-11 12:51:15 -04:00
Nick Mathewson
7ef9ecf6b3
Fix some whitespace; tighten the tests.
2013-10-11 12:51:07 -04:00
Nick Mathewson
3d817fa29c
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-10-10 11:18:17 -04:00
Nick Mathewson
7b1b8c3694
Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4
2013-10-10 11:18:07 -04:00
Nick Mathewson
004a9c6dd1
Fix unit test for format_helper_exit_status
...
Fix format_helper_exit_status to allow full HEX_ERRNO_SIZE answers,
*and* increase the buffer length again.
2013-10-10 11:15:35 -04:00
Jim Pannacciulli
8bc5b9f3d0
test-network.sh: tools dir in PATH, parameterization
2013-09-29 14:19:00 -04:00
Nick Mathewson
31f6806aa7
Use tt_ptr_op, not test_eq, for pointer comparisons in tests
...
Makes mingw64 a bit happier.
2013-09-23 01:57:34 -04:00
Nick Mathewson
2f2fa7683d
Fix benchmarks to run without crashing.
...
I broke this when I added separate test-mode support by having
the benchmarks get built with TEST_CFLAGS.
2013-09-18 21:43:38 -04:00
Nick Mathewson
e35c972851
Merge branch 'bug4647_squashed'
2013-09-13 12:36:55 -04:00
Nick Mathewson
bf5e1e19f7
Finish tests for command-line arguments
2013-09-13 12:36:40 -04:00
Nick Mathewson
675eb1fea7
Integration test for parsing arguments on the commandline
...
(incomplete)
2013-09-13 12:36:40 -04:00
Karsten Loesing
b43a37bc5b
Pass const uint64_t pointers, document array length.
...
Suggested by nickm.
2013-09-12 10:51:55 +02:00
Karsten Loesing
d5f0d792dd
Pass around const struct timeval * instead of struct timeval.
...
Suggested by nickm.
2013-09-12 10:10:38 +02:00
Nick Mathewson
a0a855d586
Fix unit tests with --disable-curve25519
2013-09-08 17:14:07 -04:00
Roger Dingledine
6156887adf
Merge branch 'maint-0.2.4'
...
Conflicts:
src/test/test.c
2013-09-04 23:44:39 -04:00
Roger Dingledine
bb32bfa2f2
refactor and give it unit tests
2013-09-04 23:21:45 -04:00
Kevin Butler
0f070e7858
Added test for new write_chunks_to_file behaviour in #1376 .
2013-09-04 23:25:41 +01:00
Nick Mathewson
5c9008e0b0
Fix some "ISO C90 forbids mixed declarations and code" warnings
2013-09-03 13:39:31 -04:00
Nick Mathewson
3753488011
Fix warnings in test_config_fix_my_family
2013-09-03 13:35:44 -04:00
Nick Mathewson
eb5f22eff2
Merge remote-tracking branch 'Ryman/bug4341'
2013-09-03 13:16:22 -04:00
Nick Mathewson
270b4f030a
Handle HTTP minor versions greater than 9
...
(In practice they don't exist, but so long as we're making changes for
standards compliance...)
Also add several more unit tests for good and bad URL types.
2013-09-03 11:38:15 -04:00
Kevin Butler
5327605caa
Tougher validation for parsing urls from HTTP headers. Fixes #2767 .
2013-09-03 01:14:43 +01:00
Kevin Butler
0513643317
MyFamily option will now fix fingerprints missing their leading instead of complaining. Should fix #4341 .
2013-08-31 04:49:04 +01:00
Nick Mathewson
078d6bcda5
Basic unit test for EVENT_TRANSPORT_LAUNCHED
2013-08-25 11:29:03 -04:00
Nick Mathewson
172a55d9d6
Fix a wide line in test_geoip_with_pt
2013-08-15 12:10:10 -04:00
Nick Mathewson
74262f1571
Merge branch 'bug5040_4773_rebase_3'
2013-08-15 12:04:56 -04:00
George Kadianakis
c5269a59b0
Test ExtORPort cookie initialization when file writing is broken.
2013-08-15 12:03:38 -04:00
George Kadianakis
94db455472
Test some fail conditions of ext_orport.c USERADDR/TRANSPORT parsing.
2013-08-15 12:03:38 -04:00
George Kadianakis
794447d03d
Fix some #5040 bugs found by Nick's tests.
...
- Set conn->address when we receive a USERADDR command.
- Set conn->state to a sane value when we transition from Extended
ORPort to ORPort.
2013-08-15 12:03:38 -04:00
George Kadianakis
33c3e60a37
Implement and use a generic auth. cookie initialization function.
...
Use the generic function for both the ControlPort cookie and the
ExtORPort cookie.
Also, place the global cookie variables in the heap so that we can
pass them around more easily as pointers.
Also also, fix the unit tests that broke by this change.
Conflicts:
src/or/config.h
src/or/ext_orport.c
2013-08-15 12:03:37 -04:00
Nick Mathewson
28bb673584
White-box tests for the succeeding case of ext_or_port handshake.
...
(Okay, white-box plus mocking enough other functions so they don't
crash.)
2013-08-15 12:03:37 -04:00
Nick Mathewson
636aeb1f24
Test for initializing ext_or_auth_cookie file
2013-08-15 12:03:37 -04:00
Nick Mathewson
4e868a9bc3
Unit test for the ext_orport safe_cookie handshake
2013-08-15 12:03:37 -04:00
Nick Mathewson
fd6749203e
More unit tests for handle_client_auth_nonce
...
Incidentally, this business here where I make crypto_rand mockable:
this is exactly the kind of thing that would make me never want to
include test-support stuff in production builds.
2013-08-15 12:03:37 -04:00
Nick Mathewson
4526c3e0b6
Unit test for basic ext_or_cookie authentication backend
2013-08-15 12:03:37 -04:00
Nick Mathewson
03e3881043
Tests for connection_write_ext_or_command.
2013-08-15 12:03:36 -04:00
Nick Mathewson
c342ea9879
Unit tests for ext_or_id_map.
2013-08-15 12:03:36 -04:00
Nick Mathewson
7da59721a9
Unit tests for fetch_ext_or_cmd
2013-08-15 12:03:36 -04:00
Nick Mathewson
7a12cbc03d
Split out buffers and socks tests into separate modules.
...
No other changes were made here. Keeping everything in
src/test/test.c was a legacy of back when we had all our unit tests in
one big file.
Doing this now because I'm adding an ext_or_command test.
2013-08-15 12:03:36 -04:00
George Kadianakis
6ad535e6dc
If a single client connects with multiple transports, note all transports.
2013-08-15 12:03:34 -04:00
George Kadianakis
85c556a4c2
Trivially change unittests to make them more readable.
...
Pluggable transport names are now in alphabetical order like they
appear in the bridge-ip-transports string.
2013-08-15 12:03:34 -04:00
George Kadianakis
b2c7379aec
Make check-spaces happy.
2013-08-15 12:03:34 -04:00
George Kadianakis
f8a9591d31
Fix some unittests that broke when we added bridge-ip-transports.
2013-08-15 12:03:33 -04:00
George Kadianakis
f4b36bee7e
Add a unittest for the bridge-ip-transports extra-info line.
2013-08-15 12:03:33 -04:00
George Kadianakis
0c4baa016f
Also test that server transports get written to Tor's state.
2013-08-05 21:05:39 +03:00
George Kadianakis
00a7d1af9f
test_pt_configure_proxy(): verify the internals of the managed proxy.
2013-08-05 21:05:35 +03:00
Arlo Breault
506a01bda8
Use size_t for length in replaycache_add_test_and_elapsed()
...
For consistency with the rest of buffer lengths in Tor.
See #8960
2013-08-04 09:29:22 -04:00
Nick Mathewson
9ac0a681ce
Unit test for smartlist_ints_eq
...
(This was the only wholly untested function in containers.c)
2013-08-02 13:45:25 -04:00
Nick Mathewson
362f60e2d4
Try to make the win32 ersatz_socketpair pass.
2013-08-02 11:04:30 -04:00
Nick Mathewson
bcc39c4666
Unit test for tor_{ersatz_,}socketpair.
...
This catches tor_accept as well.
2013-08-02 10:36:36 -04:00
Nick Mathewson
b8d9c84037
Simple unit test for tor_open_socket_with_extensions
2013-08-02 10:05:17 -04:00
Nick Mathewson
904a58d10f
Merge branch 'bug9288_rebased'
...
Conflicts:
src/test/test_pt.c
2013-07-31 13:51:15 -04:00
Nick Mathewson
8a0eedbbb0
Fix mixed declaration/statement warning
2013-07-31 13:36:17 -04:00
Nick Mathewson
22a074caa7
Update pt/configure_proxy until it stops segfaulting
2013-07-31 13:34:16 -04:00
George Kadianakis
aaf79eb4d3
Write unit tests for configure_proxy().
2013-07-31 13:34:16 -04:00
Nick Mathewson
5343ee1a06
Add a signal-safe decimal formatting function
2013-07-19 13:26:25 -04:00
Nick Mathewson
8f0755fa85
Whoops; check in test_circuitmux.c
2013-07-19 12:05:38 -04:00
Nick Mathewson
34ad7642c8
Regression test for destroy cell queue
...
This exercises the code that crashed and caused #9296 .
2013-07-19 10:17:00 -04:00
George Kadianakis
0ec4e5a698
Add transport information to the GeoIP database.
2013-07-18 14:59:57 -04:00
Nick Mathewson
f45e1fbd5b
Start of a unit test for options_validate.
...
I added this so I could write a unit test for ServerTransportOptions,
but it incidentally exercises the succeed-on-defaults case of
options_validate too.
2013-07-18 14:40:12 -04:00
Nick Mathewson
1e78100b25
Add a test for n_cells_in_circuit_queues
2013-07-18 11:23:45 -04:00
Nick Mathewson
ae64197195
Unit tests for cell queues.
...
This removes some INLINE markers from functions that probably didn't
need them.
2013-07-18 11:23:45 -04:00
Nick Mathewson
e6c0fb2b6d
Fix a wide line in test_pt.c
2013-07-18 08:49:52 -04:00
Nick Mathewson
d7ccb6a3b1
Merge branch 'bug8978_rebase_2'
...
Conflicts:
src/test/test_pt.c
2013-07-18 08:48:20 -04:00
Nick Mathewson
b551988ef4
Merge branch 'bug8929_rebase_2'
2013-07-18 08:45:13 -04:00
Nick Mathewson
8a01a7c35b
Improve test coverage of 8929 code
2013-07-18 08:45:03 -04:00
Nick Mathewson
31871f7d77
Fix memory leaks in test_config_parse_transport_options_line
2013-07-18 08:45:03 -04:00
George Kadianakis
1a0cf08841
Rename tor_escape_str_for_socks_arg() to something more generic.
...
Since we are going to be using that function to also escape parameters
passed to transport proxies using environment variables.
2013-07-18 08:45:03 -04:00
George Kadianakis
ea72958f25
Pass characters to be escaped to tor_escape_str_for_socks_arg().
...
This is in preparation for using tor_escape_str_for_socks_arg() to
escape server-side pluggable transport parameters.
2013-07-18 08:45:02 -04:00
George Kadianakis
6cfc2b5d73
Write unit tests for the ServerTransportOptions parsing function.
2013-07-18 08:45:02 -04:00
Nick Mathewson
e02b6b99f2
Add a basic unit test for pt_get_extra_info_descriptor_string.
2013-07-18 08:43:53 -04:00
Nick Mathewson
dd18789a9c
Add a unit test for smethod lines with arguments.
2013-07-18 08:43:52 -04:00
Nick Mathewson
4824f3ad93
Merge remote-tracking branch 'asn/bug9265'
2013-07-16 09:55:51 -04:00
Nick Mathewson
74356aaeec
Remove an unused variable in test_replaycache_scrub
2013-07-16 09:53:44 -04:00
Andrea Shepard
459d827193
Add more replaycache.c unit tests, bringing coverage to 100% for that file
2013-07-16 06:02:22 -07:00
George Kadianakis
4ccd4b5c51
Test deeper in test_pt_parsing().
...
We used to test parse_{c,s}method_line() without actually testing that
the resulting transport_t was well formed.
2013-07-16 14:07:03 +03:00
Nick Mathewson
55f5caf096
Appease "make check-spaces"
2013-07-15 17:35:56 -04:00
Nick Mathewson
9fda7e8cd1
Lightly refactor and test format_hex_number_sigsafe
...
Better tests for upper bounds, and for failing cases.
Also, change the function's interface to take a buffer length rather
than a maximum length, and then NUL-terminate: functions that don't
NUL-terminate are trouble waiting to happen.
2013-07-15 12:52:29 -04:00
Nick Mathewson
18136afbbb
HEX_ERRNO_SIZE is no longer the correct upper limit for format_hex_number_sigsafe
2013-07-15 12:40:07 -04:00
Nick Mathewson
22977b7c1d
Expose format_hex_number_..., and rename it to ..._sigsafe().
...
There are some other places in the code that will want a signal-safe
way to format numbers, so it shouldn't be static to util.c.
2013-07-15 12:26:55 -04:00
Nick Mathewson
449b2b7c58
Don't build format_helper_exit_status on win32
...
The only thing that used format_helper_exit_status on win32 was the
unit tests. This caused an error when we tried to leave a static
format_helper_exit_status lying around in a production object file.
The easiest solution is to admit that this way of dealing with process
exit status is Unix-only.
2013-07-15 12:17:23 -04:00
Linus Nordberg
d0c0f050df
Avoid compiler warning 'unused param'.
...
Fixes #9261 .
2013-07-15 15:46:36 +02:00
Nick Mathewson
ec6c155f82
Add some basic unit tests for the circuit map data structure.
...
These show off the new mocking code by mocking the circuitmux code
so that we can test the circuit map code in isolation.
2013-07-10 15:26:34 -04:00
Nick Mathewson
17e9fc09c3
Coverage support: build with --enable-coverage to have tests run with gcov
...
If you pass the --enable-coverage flag on the command line, we build
our testing binaries with appropriate options eo enable coverage
testing. We also build a "tor-cov" binary that has coverage enabled,
for integration tests.
On recent OSX versions, test coverage only works with clang, not gcc.
So we warn about that.
Also add a contrib/coverage script to actually run gcov with the
appropriate options to generate useful .gcov files. (Thanks to
automake, the .o files will not have the names that gcov expects to
find.)
Also, remove generated gcda and gcno files on clean.
2013-07-10 15:22:16 -04:00
Nick Mathewson
a3e0a87d95
Completely refactor how FILENAME_PRIVATE works
...
We previously used FILENAME_PRIVATE identifiers mostly for
identifiers exposed only to the unit tests... but also for
identifiers exposed to the benchmarker, and sometimes for
identifiers exposed to a similar module, and occasionally for no
really good reason at all.
Now, we use FILENAME_PRIVATE identifiers for identifiers shared by
Tor and the unit tests. They should be defined static when we
aren't building the unit test, and globally visible otherwise. (The
STATIC macro will keep us honest here.)
For identifiers used only by the unit tests and never by Tor at all,
on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS.
This is not the motivating use case for the split test/non-test
build system; it's just a test example to see how it works, and to
take a chance to clean up the code a little.
2013-07-10 15:20:10 -04:00
Nick Mathewson
f7d654b81e
Start work on fancy compiler tricks to expose extra stuff to our tests
...
This is mainly a matter of automake trickery: we build each static
library in two versions now: one with the TOR_UNIT_TESTS macro
defined, and one without. When TOR_UNIT_TESTS is defined, we can
enable mocking and expose more functions. When it's not defined, we
can lock the binary down more.
The alternatives would be to have alternate build modes: a "testing
configuration" for building the libraries with test support, and a
"production configuration" for building them without. I don't favor
that approach, since I think it would mean more people runnning
binaries build for testing, or more people not running unit tests.
2013-07-10 15:20:09 -04:00
Nick Mathewson
f631b73cd5
Merge remote-tracking branch 'linus/bug8530'
2013-06-29 16:02:13 -04:00
Nick Mathewson
8a96a85d66
Check more return values in the unit tests
2013-06-18 12:31:03 -04:00
Nick Mathewson
459c7c0e41
Attempt to un-confuse coverity about (false) double-free in bench_onion_ntor.
2013-06-18 11:33:15 -04:00
Nick Mathewson
9f8e672b50
Fix a couple of resource leaks in test_config.c
...
Spotted by Coverity Scan. Not in any released Tor.
2013-06-18 11:28:30 -04:00
Linus Nordberg
538ca4153a
Invoke binaries in $PATH rather than by absolute path.
...
That security measure costs more than it gives.
So, keep your PATH sane and we can run this script on more than
one system.
2013-06-18 11:48:02 +02:00
Linus Nordberg
b567efcfff
Use CHUTNEY_PATH to find Chutney.
2013-06-14 14:17:42 +02:00
Linus Nordberg
c82d7950ad
Add make target test-network running traffic tests in a Chutney network.
...
This implements ticket #8530 .
2013-06-13 16:33:56 +02:00
Marek Majkowski
16d1dd134a
Fix #9043 - simplyfy the code and use EVP_PKEY_cmp instead of pkey_eq / tor_tls_evp_pkey_eq
2013-06-12 13:02:06 -04:00
Nick Mathewson
a64d062c95
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-06-12 10:01:10 -04:00
Nick Mathewson
4f4fc63fea
Expand microdesc cache tests
...
Is it possible that *every* attempt to replace the microdesc cache on
windows 7 is going to fail because of our lack of FILE_SHARE_DELETE
while opening the file? If so, this test will catch #2077 and let us
know when it's fixed.
2013-06-12 09:30:09 -04:00
Nick Mathewson
c94f6b228b
Fix "make check-spaces"
2013-06-10 13:51:53 -04:00
Marek Majkowski
d769cd82b5
Bug #5170 - make pkey_eq testable, introduce test_tortls.c
2013-06-10 16:21:39 +01:00
Marek Majkowski
e4f51682bc
Bug #5170 - test crypto_pk_get_all_digests
2013-06-10 15:03:18 +01:00
Karsten Loesing
e39292f21d
Test functions used for TB_EMPTY and CELL_STATS events.
2013-05-31 16:12:28 +02:00
Nick Mathewson
4d7ac69f05
Fix windows compilation warning in test_config.c
...
bugfix on 78cc5833a1da038331186ddf07f4add7f8f1094b; bug not in any
released Tor.
Spotted by weasel using Jenkins.
2013-05-29 12:08:28 -04:00
Nick Mathewson
58721ac24c
Tweak 4282 unit tests for style, safety, correctness.
...
We do our filesystem wrangling relative to get_fname() results, so
that if we fail or crash, we can always clean up.
2013-05-24 13:31:10 -04:00
Peter Retzlaff
78cc5833a1
Unit tests for check_or_create_data_subdir and write_to_data_subdir.
2013-05-24 13:13:21 -04:00
Arlo Breault
0ab38b9366
Remove PK_PKCS1_PADDING
...
See #8792
2013-05-17 10:11:33 -04:00
Nick Mathewson
95c34399cf
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-05-15 14:35:37 -04:00
Nick Mathewson
31a6b4e11f
Fix unit tests to pass after fix for #8879
2013-05-15 14:34:59 -04:00
Arlo Breault
73b98948a2
Remove strcpy from unit tests.
...
See #8790 .
2013-05-11 23:33:41 -04:00
Andrea Shepard
50beb81d53
Merge branch 'maint-0.2.4'
2013-05-10 21:05:34 -07:00
Andrea Shepard
aaa3a085db
Merge bug5595-v2-squashed into maint-0.2.4
2013-05-10 19:39:48 -07:00
Andrea Shepard
54f41d68e9
Add some unit tests for fp_pair_map_t to test/containers.c based on the strmap tests
2013-05-09 10:55:07 -07:00
Nick Mathewson
82ab33c9a6
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-05-09 13:20:01 -04:00
Nick Mathewson
bae5dd6c8d
Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4
2013-05-09 13:14:53 -04:00
Nick Mathewson
00e2310f12
Don't run off the end of the array-of-freelists
...
This is a fix for bug 8844, where eugenis correctly notes that there's
a sentinel value at the end of the list-of-freelists that's never
actually checked. It's a bug since the first version of the chunked
buffer code back in 0.2.0.16-alpha.
This would probably be a crash bug if it ever happens, but nobody's
ever reported something like this, so I'm unsure whether it can occur.
It would require write_to_buf, write_to_buf_zlib, read_to_buf, or
read_to_buf_tls to get an input size of more than 32K. Still, it's a
good idea to fix this kind of thing!
2013-05-09 13:10:48 -04:00
Nick Mathewson
8f21838ee5
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-05-08 13:01:58 -04:00
Nick Mathewson
7d3fd85838
Fix bug 8845: check the right length of memory in aes unit tests
...
This couldn't actually be a buffer overrun unless AES somehow turned
into memcpy, but still it's good to fix it.
2013-05-08 12:59:43 -04:00
Nick Mathewson
da30adcf0f
Merge remote-tracking branch 'origin/maint-0.2.4'
...
Conflicts:
src/common/crypto.c
2013-04-18 11:16:05 -04:00
Nick Mathewson
8362f8854a
Merge branch 'less_charbuf_rebased' into maint-0.2.4
...
Conflicts:
src/or/dirserv.c
src/or/dirserv.h
src/test/test_dir.c
2013-04-18 11:13:36 -04:00
Nick Mathewson
4b15606fa2
Add unit test for encoding ntor key in routerinfo
2013-04-18 11:04:58 -04:00
Nick Mathewson
cb74b5a152
Remove the unused pk3 variable from test_dir_formats
2013-04-18 11:04:58 -04:00
Nick Mathewson
992bbd02f9
Re-enable test for parsing and generating descriptor with exit policy
...
Looks like I turned this off in 6ac42f5e
back in 2003 and never got
around to making it work again. There has been no small amount of
code drift.
2013-04-18 11:04:58 -04:00
Nick Mathewson
4d672f3ae3
Test networkstatus_getinfo_helper_single
2013-04-18 11:04:58 -04:00
Nick Mathewson
0f83fcc5c2
Add a quick-and-dirty-test for generate_v2_networkstatus.
...
It sure is a good thing we can run each test in its own process, or
else the amount of setup I needed to do to make this thing work
would have broken all the other tests.
Test mocking would have made this easier to write too.
2013-04-18 11:04:58 -04:00
Nick Mathewson
c35ef8e6e9
Test improvement: include microdesc lines in our synthetic microdesc consensuses.
2013-04-18 11:04:57 -04:00
Nick Mathewson
fd93622cc8
Use chunks, not buffers, for router descriptors
2013-04-18 11:04:56 -04:00
Nick Mathewson
cd1cdae0fa
Fix some wide lines
2013-04-18 10:30:14 -04:00
Nick Mathewson
d34d0b4dc5
Merge remote-tracking branch 'origin/maint-0.2.4'
...
Conflicts:
src/or/dirserv.c
2013-04-14 21:57:56 -04:00
Nick Mathewson
a6545d6335
Merge branch 'bug8683_rebased' into maint-0.2.4
2013-04-14 21:48:44 -04:00
Nick Mathewson
52cadff0d6
Rename all fields which measure bw in kb to end with _kb
2013-04-14 21:45:05 -04:00
Roger Dingledine
d028c005da
socks5 will ask for username/password if we offer it
...
Commit a264c4fe
made the socks5 server prefer auth 2 if it's offered,
but it didn't update the unit test to expect it.
2013-04-11 10:37:41 -04:00
Roger Dingledine
7ed1af3671
socks5 will ask for username/password if we offer it
...
Commit a264c4fe
made the socks5 server prefer auth 2 if it's offered,
but it didn't update the unit test to expect it.
2013-04-11 02:53:26 -04:00
Nick Mathewson
55817c4c50
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-04-05 16:53:07 -04:00
Peter Palfrader
d1dc23c938
test.c: Try to create a more random temporary directory for our workspace (re: Bug#8638)
2013-04-05 16:51:48 -04:00
Nick Mathewson
80e9ca411f
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-03-23 18:51:15 -04:00
Nick Mathewson
8b6a952c94
Avoid clang warnings from implicit off_t->size_t cast
2013-03-23 18:50:21 -04:00
Nick Mathewson
9a6514ce4f
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-03-22 12:41:16 -04:00
Nick Mathewson
1b6b8b0564
Fix an uninitialized-var warning in unit tests
...
Found by formorer; fix on 42fb61d172
, not in any released Tor.
2013-03-22 12:38:55 -04:00
Nick Mathewson
294c89f238
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-03-21 07:53:46 -04:00
Nick Mathewson
42fb61d172
Fix a small memory leak in the unit tests
...
Found by coverity; this is CID 992692.
2013-03-21 07:52:36 -04:00
Nick Mathewson
c101ecc8dc
Merge remote-tracking branch 'asn/bug3594_rebased_and_fixed'
...
Conflicts:
src/common/util.c
src/or/entrynodes.h
2013-03-19 13:25:45 -04:00
Nick Mathewson
c8c86c9b23
Fix a double-newline
2013-03-18 15:39:47 -04:00
Nick Mathewson
a88f3e24ea
Merge remote-tracking branch 'origin/maint-0.2.4'
...
Conflicts:
src/test/test_addr.c
2013-03-18 15:29:32 -04:00
Nick Mathewson
2ac66e59f7
Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4
...
Conflicts:
src/test/test_addr.c
2013-03-18 15:28:39 -04:00
Nick Mathewson
67709398b6
Merge remote-tracking branch 'origin/maint-0.2.4'
2013-03-18 15:18:56 -04:00
Nick Mathewson
5959d1c105
Merge remote-tracking branch 'andrea/bug8435' into maint-0.2.4
2013-03-18 15:17:11 -04:00
Nick Mathewson
b163e801bc
Merge remote-tracking branch 'origin/maint-0.2.4'
...
Conflicts:
src/or/routerlist.c
2013-03-15 12:20:17 -04:00
Andrea Shepard
6e978ab829
Add unit test for dirserv measured bandwidth cache
2013-03-07 15:41:22 -08:00
Nick Mathewson
62ef02ad65
A couple more easy unit tests
2013-03-02 10:56:57 -05:00
Nick Mathewson
55ce9bff54
Remove unused check_fingerprint_syntax
2013-03-01 22:01:26 -05:00
Nick Mathewson
a05dc378e3
Remove unused HMAC-SHA1 function
...
(We're not adding any new SHA1 instances in our protocols, so this
should never actually be needed.)
2013-03-01 21:59:12 -05:00
Nick Mathewson
a6c7630845
Unit tests for a few more functions and cases in address.c
...
This brings address's coverage up over 80%.
2013-03-01 14:48:33 -05:00
Nick Mathewson
f6697d5b3b
More unit tests for old TAP onion handshake.
...
The test coverage for onion_tap.c is now at 89%, up from 67%.
2013-03-01 14:06:09 -05:00
Nick Mathewson
165b2c0123
Add unit test for tor_addr_is_loopback
2013-03-01 12:40:41 -05:00
Nick Mathewson
a4e9d67292
Remove some functions which were unused except for their tests
2013-02-23 23:38:43 -05:00
Nick Mathewson
365e302f61
Remove a bunch of unused macro definitions
2013-02-23 23:05:25 -05:00
Nick Mathewson
804be10b09
Fix a may-be-used-uninitialized warning.
2013-02-19 15:00:08 -05:00
Nick Mathewson
b0b0d6af63
Merge branch 'bug2286_unit_test_squashed'
2013-02-19 14:54:05 -05:00
Andrea Shepard
699c39dada
Test alternate values of maxunmeasuredbw too
2013-02-19 14:53:31 -05:00
Andrea Shepard
f445aae2e3
Update unmeasured bandwidth clipping unit test per NickM's bugfix for the Unmeasured=1 issue
2013-02-19 11:06:24 -05:00
Andrea Shepard
4c45b3d845
Add unit test for unmeasured bandwidth clipping in consensus
2013-02-19 11:06:24 -05:00
Andrea Shepard
f4d5ca9b5e
Refactor v3_networkstatus test to allow reuse of test for measuredbw
2013-02-19 11:06:24 -05:00
Nick Mathewson
6c8b6e9e78
Fix unreachable use-before-assign in test_util_join_win_cmdline
...
Apparently there is a compiler that believes this is something to
warn about.
2013-02-15 15:57:47 -05:00
George Kadianakis
9bdd33eae6
Add parse_bridge_line() unittests.
2013-02-11 23:45:18 +01:00
Nick Mathewson
9b2bb901d7
Fix a null-deref-on-fail in unit tests
...
If geoip_format_bridge_stats() returned NULL when it should have
returned a string, we would have tried to deref NULL, and died. Not
a big deal in the unit tests, but still worth fixing.
Found by coverity; This is CID 743384.
2013-02-11 16:32:13 -05:00
Nick Mathewson
52263b0dda
Fix even more dead code and resource leaks in the unit tests
...
Found by coverity
2013-02-11 15:20:20 -05:00
Nick Mathewson
717946089b
Resolve memory leaks in the unit tests and benchmarks (found by coverity)
...
These shouldn't really matter, but it's nice to be leak-free.
2013-02-11 14:57:10 -05:00
Nick Mathewson
ffd6e557cb
Speed up the curve25519 unit test by doing fewer iterations
...
This test was accounting for about 2/3 of our unit tests' runtime,
even on systems with a fast curve25519. No test should take so long.
2013-02-11 13:55:42 -05:00
George Kadianakis
266f8cddd8
Refactoring to make parse_bridge_line() unittestable.
...
- Make parse_bridge_line() return a struct.
- Make bridge_add_from_config() accept a struct.
- Make string_is_key_value() less hysterical.
2013-02-11 18:07:26 +00:00
Roger Dingledine
74e6a47a80
stop setting, or using, router->address
...
resolves ticket 5528.
2013-02-09 22:07:22 -05:00
Roger Dingledine
002c860cae
use me->addr when adding our address to our exit policy
...
(rather than me->address)
2013-02-09 21:17:44 -05:00
George Kadianakis
b5dceab175
Fix various issues pointed out by Nick and Andrea.
...
- Document the key=value format.
- Constify equal_sign_pos.
- Pass some strings that are about to be logged to escape().
- Update documentation and fix some bugs in tor_escape_str_for_socks_arg().
- Use string_is_key_value() in parse_bridge_line().
- Parenthesize a forgotten #define
- Add some more comments.
- Add some more unit test cases.
2013-02-09 18:46:10 +00:00
George Kadianakis
b8532bcb1e
Add utility functions needed for SOCKS argument parsing.
2013-02-09 16:30:16 +00:00
Nick Mathewson
029d2c6587
Unit test for tor_weak_random_range
2013-02-08 16:46:35 -05:00
Nick Mathewson
522b312a51
whitespace fix
2013-02-07 14:31:51 -05:00
Nick Mathewson
266419d244
Tolerate curve25519 backends where the high bit of the pk isn't ignored
...
Right now, all our curve25519 backends ignore the high bit of the
public key. But possibly, others could treat the high bit of the
public key as encoding out-of-bounds values, or as something to be
preserved. This could be used to distinguish clients with different
backends, at the cost of killing a circuit.
As a workaround, let's just clear the high bit of each public key
indiscriminately before we use it. Fix for bug 8121, reported by
rransom. Bugfix on 0.2.4.8-alpha.
2013-02-07 14:09:01 -05:00
Nick Mathewson
1dd03fbc77
Fix a silly mistake in the tor_mathlog() documentation. Give it a unit test.
2013-02-01 16:09:16 -05:00
Nick Mathewson
a0351311ae
Fix unit test to not expect v2 directory request geoip info
...
When we implemented #5823 and removed v2 directory request info, we
never actually changed the unit tests not to expect it.
Fixes bug 8084; bug not in any released version of Tor.
2013-01-29 12:01:41 -05:00
Nick Mathewson
c71b7db8f3
Merge remote-tracking branch 'karsten/bug5823'
2013-01-19 09:36:55 -05:00
Nick Mathewson
2386a98d46
Add a missing part of bug 7311's makefile.nmake tweaks
...
Fix by "ultramage".
This already has a changes entry.
2013-01-17 10:01:22 -05:00
Karsten Loesing
da1e44ee51
Remove dirreq-v2-* lines from extra-info descriptors.
...
Implements the rest of #5823 .
2013-01-17 10:46:34 +01:00
Jérémy Bobbio
aa01d0a183
Implement proposal 204: ignore subdomains in hidden service addresses
...
The implementation is pretty straightforward: parse_extended_hostname() is
modified to drop any leading components from an address like
'foo.aaaaaaaaaaaaaaaa.onion'.
2013-01-16 23:29:59 -05:00
Nick Mathewson
b998431a33
Merge branch '024_msvc_squashed'
...
Conflicts:
src/or/or.h
srcwin32/orconfig.h
2013-01-16 22:32:12 -05:00
Nick Mathewson
3b2abd8a40
Add more test modules for nmake makefiles
2013-01-16 22:29:39 -05:00
Nick Mathewson
aa8f30a487
Try to build tinytest.obj from the right sources
2013-01-16 22:29:39 -05:00
Nick Mathewson
ca3bc8973b
use the /Fe flag with msvc
...
Fixes 7309
2013-01-16 22:29:39 -05:00
Nick Mathewson
9ddcd96149
Add missing targets to src/test/Makefile.nmake. Fix for 7316
2013-01-16 22:29:39 -05:00
Nick Mathewson
b7dd716195
Add missing includes and libs to makefile.nmake
...
Fixes bugs 7312 and 7310.
2013-01-16 22:29:38 -05:00
Nick Mathewson
ca18768fb2
Aftermath of isin->contains renaming
...
Fix wide lines and comments, and add a changes file
2013-01-16 16:57:32 -05:00
Nick Mathewson
49e619c1cf
Rename *_isin to *_contains
...
This is an automatically generated commit, from the following perl script,
run with the options "-w -i -p".
s/smartlist_string_num_isin/smartlist_contains_int_as_string/g;
s/smartlist_string_isin((?:_case)?)/smartlist_contains_string$1/g;
s/smartlist_digest_isin/smartlist_contains_digest/g;
s/smartlist_isin/smartlist_contains/g;
s/digestset_isin/digestset_contains/g;
2013-01-16 16:57:11 -05:00
Nick Mathewson
50f527a2c9
Actually link against nacl when we want to use it
...
Fixes more of bug 7972
2013-01-16 13:07:52 -05:00
Nick Mathewson
4da083db3b
Update the copyright date to 201.
2013-01-16 01:54:56 -05:00
Nick Mathewson
31d888c834
Make the = at the end of ntor-onion-key optional.
...
Makes bug 7869 more easily fixable if we ever choose to do so.
2013-01-05 22:53:32 -05:00
Nick Mathewson
dffc8e359b
Whoops; make that unit test actually pass :/
2013-01-03 12:46:55 -05:00
Nick Mathewson
27ac306deb
Add a unit test for the curve25519 keypair persistence functions
2013-01-03 12:38:44 -05:00
Nick Mathewson
b1bdecd703
Merge branch 'ntor-resquashed'
...
Conflicts:
src/or/cpuworker.c
src/or/or.h
src/test/bench.c
2013-01-03 11:52:41 -05:00
Nick Mathewson
f07a5125cb
Implement a constant-time safe_mem_is_zero.
2013-01-03 11:29:48 -05:00
Nick Mathewson
c46ff3ec79
Add reference implementation for ntor, plus compatibility test
...
Before I started coding ntor in C, I did another one in Python.
Turns out, they interoperate just fine.
2013-01-03 11:29:48 -05:00
Nick Mathewson
839016ac79
ntor: Don't fail fast server-side on an unrecognized KEYID(B)
2013-01-03 11:29:48 -05:00
Nick Mathewson
d907fca29b
Make libcurve25519_donna get built as a .a
...
This lets us give it compiler flags differing from the rest of
libor-crypto.a
2013-01-03 11:29:47 -05:00
Nick Mathewson
5c68a1efaa
Don't check create cells too much when we're relaying them
...
We want to sanity-check our own create cells carefully, and other
people's loosely.
2013-01-03 11:29:47 -05:00
Nick Mathewson
1ed4786dba
Implement scheme to allow ntor requests/responses via older servers
2013-01-03 11:29:47 -05:00
Nick Mathewson
5d15d597a9
Code to parse and format CREATE{,2,_FAST} cells and their allies
...
As elsewhere, it makes sense when adding or extending a cell type to
actually make the code to parse it into a separate tested function.
This commit doesn't actually make anything use these new functions;
that's for a later commit.
2013-01-03 11:29:46 -05:00
Nick Mathewson
f58d4dfcd6
Massive refactoring of the various handshake types
...
The three handshake types are now accessed from a unified interface;
their state is abstracted from the rest of the cpath state, and so on.
2013-01-03 11:29:46 -05:00
Nick Mathewson
f7e590df05
Split onion.[ch] into onion{,_fast,_tap}.[ch]
...
I'm going to want a generic "onionskin" type and set of wrappers, and
for that, it will be helpful to isolate the different circuit creation
handshakes. Now the original handshake is in onion_tap.[ch], the
CREATE_FAST handshake is in onion_fast.[ch], and onion.[ch] now
handles the onion queue.
This commit does nothing but move code and adjust header files.
2013-01-02 14:11:14 -05:00
Nick Mathewson
25c05cb747
Refactor strong os-RNG into its own function
...
Previously, we only used the strong OS entropy source as part of
seeding OpenSSL's RNG. But with curve25519, we'll have occasion to
want to generate some keys using extremely-good entopy, as well as the
means to do so. So let's!
This patch refactors the OS-entropy wrapper into its own
crypto_strongest_rand() function, and makes our new
curve25519_secret_key_generate function try it as appropriate.
2013-01-02 14:11:13 -05:00
Nick Mathewson
cf4dd5fbcb
Implementat the ntor handshake
...
The ntor handshake--described in proposal 216 and in a paper by
Goldberg, Stebila, and Ustaoglu--gets us much better performance than
our current approach.
2013-01-02 14:10:49 -05:00
Nick Mathewson
89ec584805
Add a wrapper around, and test and build support for, curve25519.
...
We want to use donna-c64 when we have a GCC with support for
64x64->uint128_t multiplying. If not, we want to use libnacl if we
can, unless it's giving us the unsafe "ref" implementation. And if
that isn't going to work, we'd like to use the
portable-and-safe-but-slow 32-bit "donna" implementation.
We might need more library searching for the correct libnacl,
especially once the next libnacl release is out -- it's likely to have
bunches of better curve25519 implementations.
I also define a set of curve25519 wrapper functions, though it really
shouldn't be necessary.
We should eventually make the -donna*.c files get build with
-fomit-frame-pointer, since that can make a difference.
2013-01-02 14:10:48 -05:00
Nick Mathewson
cfab9f0755
Add a data-invariant linear-search map structure
...
I'm going to use this for looking op keys server-side for ntor.
2013-01-02 14:10:48 -05:00
Nick Mathewson
2f8fd53750
Add benchmark for DH handshake and ECDH-P-224/56 handshake
2012-12-25 20:14:07 -05:00
Nick Mathewson
de4cc126cb
Build and test most of the machinery needed for IPv6 virtualaddrmaps
...
With an IPv6 virtual address map, we can basically hand out a new
IPv6 address for _every_ address we connect to. That'll be cool, and
will let us maybe get around prop205 issues.
This uses some fancy logic to try to make the code paths in the ipv4
and the ipv6 case as close as possible, and moves to randomly
generated addresses so we don't need to maintain those stupid counters
that will collide if Tor restarts but apps don't.
Also has some XXXX items to fix to make this useful. More design
needed.
2012-12-17 14:51:29 -05:00
Nick Mathewson
f33487668f
Implement option to turn off DNS cache use on a client port
...
(This is part 2 of making DNS cache use enabled/disabled on a
per-client port basis. This implements the CacheIPv[46]DNS options,
but not the UseCachedIPv[46] ones.)
2012-12-17 14:48:09 -05:00
Nick Mathewson
3fa9151f26
Merge branch 'win64-7260'
...
Conflicts:
src/or/dns.c
2012-12-07 14:12:17 -05:00
Nick Mathewson
81fcebcd05
Merge branch 'bug7306'
2012-12-07 11:11:26 -05:00
Nick Mathewson
025dc19b63
Merge remote-tracking branch 'public/bug6887'
2012-12-07 11:02:27 -05:00
Nick Mathewson
b326e76144
Use FreeLibrary, not CloseHandle, for library in test_util.c
...
Fix for bug 7306. Bugfix on 0.2.2.17-alpha.
2012-12-06 10:59:02 -05:00
Nick Mathewson
014e69054d
Add a unit test for the old KDF while we're at it
2012-12-06 01:54:09 -05:00
Nick Mathewson
6921d1fd25
Implement HKDF from RFC5869
...
This is a customizable extract-and-expand HMAC-KDF for deriving keys.
It derives from RFC5869, which derives its rationale from Krawczyk,
H., "Cryptographic Extraction and Key Derivation: The HKDF Scheme",
Proceedings of CRYPTO 2010, 2010, <http://eprint.iacr.org/2010/264 >.
I'm also renaming the existing KDF, now that Tor has two of them.
This is the key derivation scheme specified in ntor.
There are also unit tests.
2012-12-06 01:54:09 -05:00
Nick Mathewson
4f60bca1c1
Add benchmark to test onionskin performance.
2012-12-06 01:54:09 -05:00
Nick Mathewson
190c1d4981
Merge branch 'bug7013_take2_squashed'
2012-11-27 22:18:16 -05:00
George Kadianakis
6f21d2e496
Introduce tor_addr_port_parse() and use it to parse ServerTransportListenAddr.
2012-11-27 22:18:08 -05:00
Nick Mathewson
bb2145b45b
Fix a bug in policy_is_reject_star() that was making IPv4 exits break
...
IPv4-only exits have an implicit "reject [::]/0", which was making
policy_is_reject_star() return 1 for them, making us refuse to do
hostname lookups.
This fix chanes policy_is_reject_star() to ask about which family we meant.
2012-11-14 23:16:57 -05:00