Nick Mathewson
3c2eefac2e
Fix a couple more msvc issues, reported by gisle vanem
2015-07-23 12:01:57 -04:00
cypherpunks
f4b03f936e
Improve the workqueue test help message.
...
The workqueue test help message has two issues. First, the message uses 4 space
indentation when 2 space indentation seems more common. Second, the help
message misses some options.
This commit fixes both issues.
2015-07-21 14:02:41 -04:00
cypherpunks
c68b341882
Limit the number of inflight items to the number of items.
2015-07-21 14:02:41 -04:00
Nick Mathewson
2200d9d3f8
typo fix; spotted by arma
2015-07-20 13:02:21 -04:00
rl1987
7983e00938
Fix testcases where scrypt APIs are used wrong.
2015-07-20 10:49:09 -04:00
Nick Mathewson
edaf681735
Break some wide lines
2015-07-16 11:11:21 -04:00
Nick Mathewson
b5cfcb2045
Fix most check-spaces issues
2015-07-16 11:10:14 -04:00
Nick Mathewson
8507d75c82
Fix a leak in test_microdesc (CID 1311631)
2015-07-11 16:47:25 -04:00
Nick Mathewson
fdf5014d11
Fix missing-macro errors
2015-07-09 16:34:51 -04:00
Nick Mathewson
0ca98c1ee5
Merge branch 'libscrypt_eq_openssl_squashed'
2015-07-09 16:31:42 -04:00
rl1987
5c86708e4d
Assert interoperability betweeen libscrypt and OpenSSL EBP_PBE_scrypt().
...
Add a new and slow unit test that checks if libscrypt_scrypt() and
EBP_PBE_scrypt() yield the same keys from test vectors.
squash! Assert interoperability betweeen libscrypt and OpenSSL EBP_PBE_scrypt().
squash! Assert interoperability betweeen libscrypt and OpenSSL EBP_PBE_scrypt().
squash! Assert interoperability betweeen libscrypt and OpenSSL EBP_PBE_scrypt().
2015-07-09 16:31:19 -04:00
Yawning Angel
840e68d917
Integrate and enable ed25519-donna.
...
The runtime sanity checking is slightly different from the optimized
basepoint stuff in that it uses a given implementation's self tests if
available, and checks if signing/verification works with a test vector
from the IETF EdDSA draft.
The unit tests include a new testcase that will fuzz donna against ref0,
including the blinding and curve25519 key conversion routines. If this
is something that should be done at runtime (No?), the code can be
stolen from there.
Note: Integrating batch verification is not done yet.
2015-07-06 10:11:10 +00:00
Yawning Angel
f079c27761
Integrate the accelerated Curve25519 scalar basemult.
...
Integration work scavanged from nickm's `ticket8897_9663_v2` branch,
with minor modifications. Tor will still sanity check the output but
now also attempts to catch extreme breakage by spot checking the
optimized implementation vs known values from the NaCl documentation.
Implements feature 9663.
2015-07-06 09:57:23 +00:00
teor
128d4a6896
Add chutney performance testing support to src/test/test-network.sh
...
The following arguments change how chutney verifies the network:
--bytes n sends n bytes per test connection (10 KBytes)
--connections n makes n test connections per client (1)
--hs-multi-client 1 makes each client connect to each HS (0)
Requires the corresponding chutney performance testing changes.
Note: using --connections 7 or greater on a HS will trigger #15937 .
Patch by "teor".
2015-07-06 16:59:15 +10:00
Nick Mathewson
19440b9e58
Make test_workqueue.c faster, and on-by-default.
...
Instead of having a 30-second timer be the only way to end the test,
add a 2 second shutdown timer when the test is actually about to be over.
2015-07-03 14:38:14 -04:00
Nick Mathewson
753797391f
More tweaks for windows compilation. (ick)
2015-06-29 13:47:44 -04:00
Nick Mathewson
d9052c629b
Remove checks for visual C 6.
2015-06-29 12:55:03 -04:00
Nick Mathewson
fce2a15ffb
Merge remote-tracking branch 'origin/maint-0.2.6'
2015-06-25 10:41:15 -04:00
Yawning Angel
3f336966a2
Work around nytimes.com's broken hostnames in our SOCKS checks.
...
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-24 13:52:29 +00:00
Nick Mathewson
e0b7598833
Repair breakage in early-error case of microdesc parsing
...
When I fixed #11243 , I made it so we would take the digest of a
descriptor before tokenizing it, so we could desist from download
attempts if parsing failed. But when I did that, I didn't remove an
assertion that the descriptor began with "onion-key". Usually, this
was enforced by "find_start_of_next_microdescriptor", but when
find_start_of_next_microdescriptor returned NULL, the assertion was
triggered.
Fixes bug 16400. Thanks to torkeln for reporting and
cypherpunks_backup for diagnosing and writing the first fix here.
2015-06-22 13:51:56 -04:00
teor
e0477de0e2
Remove undefined directive-in-macro in test_util_writepid
...
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 79e85313aa
on 0.2.7.1-alpha.
2015-06-03 04:19:05 +10:00
Nick Mathewson
3d653dff5e
Add a master-key-ed25519 line for convenience
2015-06-01 11:24:55 -04:00
Nick Mathewson
3028507e96
More check-spaces fixes
2015-06-01 10:56:54 -04:00
Nick Mathewson
d31877c6bf
Fix some memory leaks in ed25519 code and tests
2015-06-01 10:26:11 -04:00
Andrea Shepard
0e0b65db4f
Appease make check-spaces
2015-06-01 12:59:14 +00:00
Nick Mathewson
ba17968534
Fix another int-to-ptr cast.
2015-05-29 14:09:11 -04:00
Nick Mathewson
27bc0da14d
Fix a sizeof(ptr) mistake in test-memwipe.c
2015-05-29 13:50:12 -04:00
Nick Mathewson
b66f4cfc9d
Merge remote-tracking branch 'origin/maint-0.2.6'
2015-05-28 14:06:01 -04:00
Nick Mathewson
97a2dbb3e3
There sure are a lot of these in test_hs.c. CID 1301385
2015-05-28 13:17:24 -04:00
Nick Mathewson
9f289e3b9e
Another test_hs leak. CID 1301383.
2015-05-28 13:13:15 -04:00
Nick Mathewson
83ad7d2fbb
Memory leak in tor_cert_parse. CID 1301382.
2015-05-28 13:11:54 -04:00
Nick Mathewson
3262f3c3f6
Fix leak-on-test-failure in test_routerkeys.c
...
CID 1301379
2015-05-28 13:06:30 -04:00
Nick Mathewson
0585d4e94b
Memory leak in test_hs_rend_data
...
CID 1301377
2015-05-28 13:01:48 -04:00
Nick Mathewson
72714270e2
Fix memory leak in test_routerkeys
...
CID 1301376
2015-05-28 13:00:25 -04:00
Nick Mathewson
a348df6d8b
Avoid dereferencing null on unit test failure for link handshakes.
...
This fixes CID 1301368 -- found by coverity
2015-05-28 12:41:00 -04:00
Nick Mathewson
1b52e95028
Merge branch '12498_ed25519_keys_v6'
...
Fixed numerous conflicts, and ported code to use new base64 api.
2015-05-28 11:04:33 -04:00
Nick Mathewson
8f15423b76
Do not allocate our ed-link crosscert till after tls ctx
...
We need this to prevent some annoying chutney crash-at-starts
2015-05-28 10:47:47 -04:00
Nick Mathewson
3bee74c6d1
Generate weird certificates correctly
...
(Our link protocol assumes that the link cert certifies the TLS key,
and there is an RSA->Ed25519 crosscert)
2015-05-28 10:47:47 -04:00
Nick Mathewson
57189acd6f
# This is a combination of 2 commits.
...
# The first commit's message is:
Regenerate ed25519 keys when they will expire soon.
Also, have testing-level options to set the lifetimes and
expiration-tolerances of all key types, plus a non-testing-level
option to set the lifetime of any auto-generated signing key.
# The 2nd commit message will be skipped:
# fixup! Regenerate ed25519 keys when they will expire soon.
2015-05-28 10:42:30 -04:00
Nick Mathewson
79db24b3d5
Sign extrainfo documents with ed25519
...
Extrainfo documents are now ed-signed just as are router
descriptors, according to proposal 220. This patch also includes
some more tests for successful/failing parsing, and fixes a crash
bug in ed25519 descriptor parsing.
2015-05-28 10:42:22 -04:00
Nick Mathewson
b600b68b20
Revise makedesc.py: teach it how to emit ed signatures and crosscerts
...
Also, add a trivial ed25519-signed routerinfo to the tests.
2015-05-28 10:41:50 -04:00
Nick Mathewson
4d1a0ece5c
Fix memory leaks in test_link_handshake.c
2015-05-28 10:41:50 -04:00
Nick Mathewson
55bb7bbafd
Tests for AUTHENTICATE cell functionality.
2015-05-28 10:41:50 -04:00
Nick Mathewson
b75361c5ed
Start testing cell encoders/processers for the v3 handshake.
...
An earlier version of these tests was broken; now they're a nicer,
more robust, more black-box set of tests. The key is to have each
test check a handshake message that is wrong in _one_ way.
2015-05-28 10:41:50 -04:00
Nick Mathewson
24b720a984
Include ed25519 keys in microdescriptors.
2015-05-28 10:41:49 -04:00
Nick Mathewson
006b7ce5ff
Fix the position-check for ed25519 certs to work with annotations
...
When there are annotations on a router descriptor, the
ed25519-identity element won't be at position 0 or 1; it will be at
router+1 or router-1.
This patch also adds a missing smartlist function to search a list for
an item with a particular pointer.
2015-05-28 10:41:49 -04:00
Nick Mathewson
eacbe03c71
Key-pinning back-end for directory authorities.
...
This module implements a key-pinning mechanism to ensure that it's
safe to use RSA keys as identitifers even as we migrate to Ed25519
keys. It remembers, for every Ed25519 key we've seen, what the
associated Ed25519 key is. This way, if we see a different Ed25519
key with that RSA key, we'll know that there's a mismatch.
We persist these entries to disk using a simple format, where each
line has a base64-encoded RSA SHA1 hash, then a base64-endoded
Ed25519 key. Empty lines, misformed lines, and lines beginning with
a # are ignored. Lines beginning with @ are reserved for future
extensions.
2015-05-28 10:41:49 -04:00
Nick Mathewson
efa21bb941
Implement proposal 228: cross-certification with onion keys
...
Routers now use TAP and ntor onion keys to sign their identity keys,
and put these signatures in their descriptors. That allows other
parties to be confident that the onion keys are indeed controlled by
the router that generated the descriptor.
2015-05-28 10:40:57 -04:00
Nick Mathewson
fe5d2477aa
Implement ed25519-signed descriptors
...
Now that we have ed25519 keys, we can sign descriptors with them
and check those signatures as documented in proposal 220.
2015-05-28 10:40:56 -04:00
Nick Mathewson
818e6f939d
prop220: Implement certificates and key storage/creation
...
For prop220, we have a new ed25519 certificate type. This patch
implements the code to create, parse, and validate those, along with
code for routers to maintain their own sets of certificates and
keys. (Some parts of master identity key encryption are done, but
the implementation of that isn't finished)
2015-05-28 10:40:56 -04:00
Nick Mathewson
8ca3773f68
Fix unit tests on MSVC2013.
...
Patch from "NewEraCracker." Fixes bug16030; bugfix on 0.2.6.2-alpha.
2015-05-26 10:34:07 -04:00
Yawning Angel
452cebc4a4
Remove support for OpenSSL without ECC.
...
As OpenSSL >= 1.0.0 is now required, ECDHE is now mandatory. The group
has to be validated at runtime, because of RedHat lawyers (P224 support
is entirely missing in the OpenSSL RPM, but P256 is present and is the
default).
Resolves ticket #16140 .
2015-05-21 17:07:30 +00:00
Nick Mathewson
ed02a409cf
Merge branch 'bug16034_no_more_openssl_098_squashed'
...
Conflicts:
src/test/testing_common.c
2015-05-20 15:33:22 -04:00
Nick Mathewson
f8f407d66a
Now that OpenSSL 0.9.8 is dead, crypto_seed_rng() needs no args
...
It needed an argument before because it wasn't safe to call
RAND_poll() on openssl 0.9.8c if you had already opened more fds
than would fit in fd_set.
2015-05-20 15:27:36 -04:00
Nick Mathewson
971f0f8e18
Remove code to support OpenSSL 0.9.8
2015-05-20 15:27:36 -04:00
Nick Mathewson
d5e4a63436
Fix some compilation warnings
2015-05-18 15:57:21 -04:00
Nick Mathewson
cc1943bf6e
Merge remote-tracking branch 'dgoulet/bug16021_027_01'
2015-05-18 11:29:50 -04:00
cypherpunks
b54626fd11
Silence two make rules
2015-05-18 11:29:07 -04:00
David Goulet
a324d7e8e1
Test: add unit test for rend_data_t object and functions
...
Closes #16021
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-14 12:08:54 -04:00
David Goulet
acfa374048
Test: fix HS_DESC to expect descriptor ID
...
With #15881 implemented, this adds the missing descriptor ID at the end of
the expected control message.
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-14 10:46:38 -04:00
David Goulet
c1ffeadff4
Add missing descriptor ID to HS_DESC control event
...
For FAILED and RECEIVED action of the HS_DESC event, we now sends back the
descriptor ID at the end like specified in the control-spec section 4.1.25.
Fixes #15881
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-14 10:46:38 -04:00
Nick Mathewson
e086db7952
Merge branch 'writing_tests'
2015-05-07 15:29:56 -04:00
Nick Mathewson
79e85313aa
Write the outlines of a WritingTests.txt document
...
Also, add some sample tests to be examples.
2015-05-07 15:29:16 -04:00
teor
75fc4d5511
Remove test for strclear as it no longer exists in the codebase
2015-05-06 18:27:26 +10:00
teor
e60c612447
Use standard float.h header and resolve undefined left shift behaviour
2015-05-06 18:09:10 +10:00
teor
0fcd150959
Add unit tests for cast_double_to_int64().
2015-05-06 18:08:18 +10:00
Karsten Loesing
dad5eb7e1f
Tweak teor's and dgoulet's #13192 patches.
...
- 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-06 18:05:16 +10:00
David Goulet
dcf0f808c0
Test: change INT64_MAX to DBL_MAX in laplace test
...
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-06 18:05:15 +10:00
David Goulet
aecc354ee7
Test: remove edge cases that assert in laplace test
...
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-06 18:05:15 +10:00
teor
09cac24373
Handle edge cases in the round_*_to_next_multiple_of functions
...
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-06 18:05:15 +10:00
teor
6d54bdbdcf
Handle edge cases in laplace functions
...
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-05-06 18:05:15 +10:00
Nick Mathewson
f61088ce23
Fix a few more memory leaks; not in any released Tor
2015-05-05 11:08:05 -04:00
cypherpunks
26e0f8635a
Add missing newline in memwipe test.
2015-04-30 12:15:34 -04:00
Nick Mathewson
6ed5733169
Fix another test failure
...
We need the test scripts to become +x *after* they are created.
2015-04-28 10:47:37 -04:00
Yawning Angel
915c7438a7
Add "ADD_ONION"/"DEL_ONION" and "GETINFO onions/*" to the controller.
...
These commands allow for the creation and management of ephemeral
Onion ("Hidden") services that are either bound to the lifetime of
the originating control connection, or optionally the lifetime of
the tor instance.
Implements #6411 .
2015-04-28 10:19:08 -04:00
Nick Mathewson
63a90f2df4
Mark set-test-permissions as .PHONY; use u+x only
2015-04-24 16:10:34 -04:00
Nick Mathewson
f6167f51ac
Revert "Add +x to these .in files; see if it helps"
...
This reverts commit ecf98313d6
.
It didn't help.
2015-04-24 16:05:41 -04:00
Nick Mathewson
d579d751dc
Kludge include.am to work with automake <1.12
...
The SH_LOG_COMPILER feature doesn't work with older automakes, and
those are still in use in many environments we want to support
development on, like Debian Stable.
Instead, use autoconf substitution to fill out the shebang lines on
the shell scripts, and an intermediate make target to make them
executable.
This is a bugfix on the patches for #15344 . Bug not in any released
tor.
2015-04-24 08:41:53 -04:00
Nick Mathewson
ecf98313d6
Add +x to these .in files; see if it helps
2015-04-23 16:15:21 -04:00
Nick Mathewson
54000d7ad9
Merge remote-tracking branch 'dgoulet/bug14847_027_06'
2015-04-23 12:24:35 -04:00
Nick Mathewson
9b6e57290f
Fix crash-test for assertion failure
...
When we made assertions not get compiled in for the coverage case, we
missed one case where, for our tests, we really DO want to have an
assertion fail: the backtrace test.
Bugfix on 1228dd293b60a8eaab03472fa29428c5e2752c44; bug not in any
released tor
2015-04-23 10:25:16 -04:00
cypherpunks
0e89abfa73
Integrate backtrace test into the automake test suite.
...
For this to work bt_test.py now returns an exit code indicating success or
failure. Additionally, check-local and its specific dependencies are now
obsolete so they are removed.
2015-04-23 09:56:25 -04:00
cypherpunks
c535494238
Integrate ntor test into the automake test suite.
2015-04-23 09:56:16 -04:00
cypherpunks
21e2425307
Integrate zero_length_keys test into the automake test suite.
...
The zero length keys test now requires the path to the Tor binary as the first
parameter to ensure the correct Tor binary is used without hard coding a path.
The wrapper script calls the zero length keys test for each test separately to
ensure the correct shell is used (as configured by autoconf). Another solution
would have been to place the tests into separate functions so multiple tests
could be run internally. This would have made a diff of considerable size and
frankly it is outside the scope of this fix.
2015-04-23 09:56:12 -04:00
Nick Mathewson
01d988d72f
Merge remote-tracking branch 'teor/bug-15642-v3-fallback-unit-tests'
2015-04-23 09:22:16 -04:00
Nick Mathewson
647b7d37c2
Merge remote-tracking branch 'public/bug15745_027_03'
2015-04-23 09:10:35 -04:00
Nick Mathewson
3acee61422
Merge branch 'feature15652_squashed'
2015-04-23 09:09:33 -04:00
Nick Mathewson
55118d90ca
Fix some implicit conversion warnings
2015-04-23 09:09:20 -04:00
Yawning Angel
196499da73
Use a custom Base64 encoder with more control over the output format.
2015-04-23 09:06:58 -04:00
teor
d68bbb0a29
Unit tests for consider_adding_dir_servers() as modified in #15642
...
Unit tests for the 10 valid combinations of set/NULL config options
DirAuthorities, AlternateBridgeAuthority, AlternateDirAuthority,
and FallbackDir.
Add assertion in consider_adding_dir_servers() for checks in
validate_dir_servers():
"You cannot set both DirAuthority and Alternate*Authority."
2015-04-23 00:16:04 +10:00
David Goulet
dd07c78524
Test: fix HSFETCH control command with latest change
...
The expected message of the command now expects "650+" and "650 OK".
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-21 14:22:54 -04:00
David Goulet
28cf9f2186
Control: unbolt rend_data from HS desc event
...
The HS_DESC event was using rend_data_t from the dir connection to reply the
onion address and authentication type. With the new HSFETCH command, it's
now possible to fetch a descriptor only using the descriptor id thus
resulting in not having an onion address in any HS_DESC event.
This patch removes rend_query from the hs desc control functions and replace
it by an onion address string and an auth type.
On a successful fetch, the service id is taken from the fetched descriptor.
For that, an extra parameter is added to "store as a client" function that
contains the cache entry stored.
This will make the control event functions scale more easily over time if
other values not present in rend_data_t are needed since the rend_data from
the dir connection might not contained everything we need.
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-21 14:22:54 -04:00
David Goulet
7db58445fd
Control: add HS_DESC_CONTENT event
...
As defined in section 4.1.26 in the control-spec.txt, this new event replies
the content of a successfully fetched HS descriptor. This also adds a unit
test for the controller event.
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-21 14:15:02 -04:00
Yawning Angel
9a9ab455a3
Use correct severity in the get_if_addrs tests.
2015-04-21 16:42:07 +00:00
Nick Mathewson
e48ad353a3
Add test for random-int-in-range
2015-04-21 11:41:31 -04:00
teor
af2b6bdaba
Fix spaces in crypto.h and test-memwipe.c
2015-04-15 19:42:41 +10:00
Yawning Angel
e891deb021
Disable the udp_socket_trick_blackbox tests that fail due to #12377
...
Till someone writes get_interface_address6 interface enumeration that is
routing table aware, these tests will continue to fail on certain
systems because the get_interface_address6() code is broken.
2015-04-10 18:13:34 +00:00
Nick Mathewson
f9327848ba
Collect badness values in ntor_ref.py; don't just clobber.
...
Fixes bug 15591; patch from joelanders
2015-04-09 11:57:55 -04:00
Sebastian Hahn
e10e6f78b1
Update entrynodes unit test for dirs
...
We no longer base our opinion on whether someone is a directory solely
on the routerstatus we might have for that relay, but also on a
routerinfo. Remove logic in test checking that. This broke unit tests in
05f7336624
.
Reported by toralf on #tor-dev, thanks!
2015-04-01 21:10:39 +02:00
Nick Mathewson
cd8f13b5cb
Merge branch 'bug13736'
2015-04-01 13:46:50 -04:00
Nick Mathewson
aa7b792250
Merge remote-tracking branch 'yawning/feature15435'
2015-04-01 13:34:14 -04:00
Nick Mathewson
1ac3cb4823
work around lack of AF_CCITT
2015-03-31 15:56:52 -04:00
Nick Mathewson
02c3879f87
Merge remote-tracking branch 'teor/ticket15431-event-mask-tests'
2015-03-31 14:57:04 -04:00
Nick Mathewson
725d6157df
fix some compilation warnings
2015-03-31 14:42:01 -04:00
Nick Mathewson
30e933b136
Merge branch 'ticket14710_squashed'
2015-03-31 14:37:09 -04:00
rl1987
33fbb5011d
Use tor_inet_pton() (not inet_pton()) in testcases.
2015-03-31 14:37:02 -04:00
rl1987
5e759127f8
Remove unused function.
2015-03-31 14:37:02 -04:00
rl1987
b5f84fde49
IPv6 case for whitebox test.
2015-03-31 14:37:02 -04:00
rl1987
a4f89e21a6
Whitebox test for get_interface_address6_via_udp_socket_hack().
...
Also, fix some whitespace mishaps.
2015-03-31 14:37:02 -04:00
rl1987
c03493ad13
Skipping the AF_INET6 case because bug #12377 makes it fail.
2015-03-31 14:37:02 -04:00
rl1987
6af471f394
Rework the black box test, like Yawning and nickm suggested.
2015-03-31 14:37:01 -04:00
rl1987
a13f944314
Black box test for get_interface_address6_via_udp_socket_hack().
2015-03-31 14:36:35 -04:00
Yawning Angel
fda61e030e
Implement "TOR_PT_EXIT_ON_STDIN_CLOSE".
...
Background processes spawned by Tor now will have a valid stdin.
Pluggable transports can detect this behavior with the aformentioned
enviornment variable, and exit if stdin ever gets closed.
2015-03-26 12:55:12 +00:00
Nick Mathewson
dde4ffeb97
Merge remote-tracking branch 'dgoulet/bug15377_027_01'
2015-03-24 16:27:27 -04:00
David Goulet
2dc5d790d3
Test: add missing libor.a in include.am
...
Also add test-memwipe to .gitignore file.
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-03-24 16:04:30 -04:00
Nick Mathewson
9e80fc8171
Merge remote-tracking branch 'sebastian/coverage_builds'
2015-03-24 15:16:49 -04:00
Nick Mathewson
8f951d0196
Put an upper bound on test_workqueue -I argument
...
This makes coverity happy, since it doesn't like us looping against
a value which might be INT_MAX.
This is CID 1268069
2015-03-24 10:49:29 -04:00
Sebastian Hahn
1a50cb88e6
Fix test-network.sh argument parsing
...
The bash on one of my machines didn't understand the question mark
correctly, it didn't end up accepting flavor. We can spell it out
explicitly.
2015-03-22 09:43:50 +01:00
teor
99c10a95e4
Add unit tests for control_event_is_interesting()
...
Part of ticket 15431, checks for bugs similar to 13085.
2015-03-22 14:24:41 +11:00
Sebastian Hahn
1228dd293b
Disable assertions during coverage builds
...
This removes roughly 5000 branches in my testing. We never want to
trigger assertions even during tests, so this is sane. Implements #15400 .
2015-03-21 02:34:44 +01:00
Nick Mathewson
e82e600d6e
Here is a test for memwipe.
...
It invokes undefined behavior, I'm afraid, since there's no other
c-legal way to test whether memwipe() works when we're not allowed to
look at it.
Closes ticket 15377.
2015-03-19 18:47:24 -04:00
cypherpunks
17cbc4350f
Use output variables instead of relative paths.
...
Fixes the following rules in out-of-tree builds;
- check-spaces
- check-docs
- check-logs
- Doxygen
- coverage-html
And cleans up additional directories;
- coverage_html
- doc/doxygen
2015-03-14 13:00:04 -04:00
Nick Mathewson
511ca9b91c
Remove DynamicDHGroups as obsoleted by PluggableTransports or P256.
...
Closes ticket 13736.
2015-03-14 12:40:55 -04:00
Nick Mathewson
3ee2fca7ca
Merge remote-tracking branch 'origin/maint-0.2.6'
2015-03-12 13:16:22 -04:00
Nick Mathewson
eb68ea20f8
Merge remote-tracking branch 'public/feature15212_026' into maint-0.2.6
2015-03-12 13:15:08 -04:00
Nick Mathewson
985687bc4f
Fix check-spaces
2015-03-10 10:10:35 -04:00
Nick Mathewson
d29a8ad564
Add link protocol version counts to the heartbeat message
...
Closes ticket 15212
2015-03-10 10:07:41 -04:00
Nick Mathewson
0ec135b696
Merge remote-tracking branch 'origin/maint-0.2.6'
2015-03-09 11:14:03 -04:00
Tom van der Woerdt
d39ede7f20
testing_common.c: avoid side-effects of tor_assert
2015-03-09 11:10:58 -04:00
Andrea Shepard
d97f43dc8b
Fix formatting
2015-03-02 10:24:58 +00:00
Nick Mathewson
d7fcaca3fc
Have zero_length_keys.sh use an empty torrc file.
...
Fixes 15033; bugfix on 0.2.6.3-alpha.
2015-02-26 15:22:37 -05:00
Nick Mathewson
3e30d4df7f
Have zero_length_keys.sh use an empty torrc file.
...
Fixes 15033; bugfix on 0.2.6.3-alpha.
2015-02-26 15:21:31 -05:00
Nick Mathewson
1b913777c7
Merge remote-tracking branch 'atagar/trac14806'
2015-02-25 09:30:29 -05:00
Nick Mathewson
0dde4d6fa2
Merge remote-tracking branch 'yawning/bug14922'
2015-02-25 08:56:34 -05:00
Nick Mathewson
af60e7566e
Update test_status.c to accommodate changes in heartbeat messages
...
Fixes #15012 ; bug not in any released Tor
2015-02-24 10:05:34 -05:00
cypherpunks
5246e8f992
Remove lingering mempool code
2015-02-23 11:19:31 -05:00
rl1987
385558c32f
Fix endianness issues in test_config_resolve_my_address().
...
Since resolve_my_address() yields IP address in host order there is
no need to use byteorder functions for conversion.
2015-02-23 09:57:17 -05:00
Roger Dingledine
0e4bdc4005
clean up comments and whitespace a bit
2015-02-18 19:27:02 -05:00
Nick Mathewson
afe10e4707
whitespace fixes
2015-02-18 10:55:56 -05:00
Nick Mathewson
6cdb213b6c
Combine test_helpers.[ch] and testhelper.[ch]
2015-02-18 09:19:38 -05:00
Nick Mathewson
96211bcf71
Merge branch 'bug9321_rerebase'
...
Conflicts:
src/or/dirvote.h
src/test/include.am
src/test/test_entrynodes.c
2015-02-18 09:17:02 -05:00
George Kadianakis
028ede2f5e
Add unittests for the guardfraction feature.
2015-02-18 09:09:34 -05:00
George Kadianakis
c2b13e22e7
Unittest prep: Move get_yesterday_date_str() to helper file.
...
We want to use this function in our guardfraction unittests, so make a
test_helpers module and move it there.
2015-02-18 09:09:34 -05:00
Yawning Angel
cbd26157c5
Remove tor_strclear(), and replace previous calls with memwipe().
2015-02-17 18:53:33 +00:00
Nick Mathewson
c3813e2e64
Use --list-fingerprint instead of process control in zero_length_keys.sh
...
Using kill and wait in this way may have been making windows
builders unhappy.
2015-02-17 08:30:32 -05:00
Nick Mathewson
8375663adf
Wrap two long lines
2015-02-17 08:30:28 -05:00
Nick Mathewson
5d2a23397a
Fix a few coverity "Use after NULL check" warnings
...
Also remove the unit test mocks that allowed get_options() to be
NULL; that's an invariant violation for get_options().
2015-02-16 15:40:15 -05:00
Nick Mathewson
5644d92dd7
Merge remote-tracking branch 'sebastian/bug14875'
2015-02-12 14:50:13 -05:00
Sebastian Hahn
87a95b0236
Actually get all interface addresses
...
If we guessed a buffer size too small, we never increased the buffer and
tried again
Also simplify the interface of ifreq_to_smartlist a little
2015-02-12 14:54:39 +01:00
Nick Mathewson
f794a09164
Merge branch 'bug14478_squashed'
2015-02-11 15:59:41 -05:00
Sebastian Hahn
dfb409b8b0
Put error messages to stderr
...
Thanks weasel :)
Also remove stray debug output
2015-02-11 15:59:34 -05:00
Sebastian Hahn
c5f176b9b0
Change exit code of zero_length_keys script
...
Weasel notes that exit codes above 128 are for when a script dies from a
signal.
2015-02-11 15:59:34 -05:00
Sebastian Hahn
6ecd6e27da
Avoid undefined behaviour of test
...
Fixes part of bug #14478 , patch idea suggested by an anonymous
contributor. Thanks!
2015-02-11 15:59:34 -05:00
Sebastian Hahn
0a0c5d7c0e
Check that mktemp result is a directory
...
Fixes part of bug #14478 , patch idea suggested by an anonymous
contributor. Thanks!
2015-02-11 15:59:34 -05:00
Sebastian Hahn
f84a54c159
Clean up after zero length key test
2015-02-11 15:59:34 -05:00
Nick Mathewson
d7a1e83f50
Merge remote-tracking branch 'public/remove_freelist'
2015-02-11 15:09:01 -05:00
Nick Mathewson
caf28519d9
Merge branch 'bug12844'
...
Conflicts:
src/or/circuituse.c
src/test/include.am
src/test/test_entrynodes.c
2015-02-11 15:06:04 -05:00
Nick Mathewson
6f331645c7
Remove mempools and buf freelists
...
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-02-11 09:03:50 -05:00
Damian Johnson
44abbf5ab6
Dropping test_cmdline_args.py
...
Before a couple weeks ago didn't know Tor had these tests, interesting! Stem
already has tests for spawning tor processes but lacked any with this targeted
focus on its arguments.
I've added our own counterpart for these tests. Many are direct copies but
there were others I improved a little...
https://trac.torproject.org/projects/tor/ticket/14109
https://gitweb.torproject.org/stem.git/commit/?id=137d193a026638f066e817e3396cebbbb6ace012
Now that Tor uses Stem to supplement its tests no reason for these to live
separately. Tested by simply building tor and confirming test_cmdline_args.py
is no longer in the generated Makefile.
2015-02-08 21:34:36 -08:00
teor
d0759da14e
Avoid calling SMARTLIST_FOREACH on a NULL smartlist in tests
...
Check if each smartlist is NULL before calling SMARTLIST_FOREACH on it.
Bug discovered by the clang static analyzer.
Apple clang 600.0.56 (LLVM 3.5svn) on x86_64-apple-darwin14.1.0.
2015-02-08 23:41:37 +11:00
Sebastian Hahn
136b1d8ed0
Remove useless export in zero length key test
...
Fixes part of bug #14478 , patch idea suggested by an anonymous
contributor. Thanks!
2015-02-06 21:56:26 +01:00
Sebastian Hahn
d695f7b423
Don't use invalid exit values in zero length key test
...
Shell exit values must fall into the range of [0-255], so let's honour
this. In practice, the "exit -1" from the old code set an exit value of
255 on most systems, so let's pick that.
Fixes part of bug #14478 , patch idea suggested by an anonymous
contributor. Thanks!
2015-02-06 21:55:59 +01:00
Nick Mathewson
e36faeec1d
Merge remote-tracking branch 'sebastian/bug13993'
2015-02-06 15:42:53 -05:00
Sebastian Hahn
e0c3de40ad
Fix check-spaces complaints
2015-02-06 21:36:40 +01:00
Sebastian Hahn
b3bc871214
Add unit test for #13290
2015-02-06 21:04:05 +01:00
Nick Mathewson
ac8f235446
fix a unit tests memory leak (my fault)
2015-02-03 15:58:48 -05:00
Nick Mathewson
d03e1da232
Merge remote-tracking branch 'public/bug9635_warnings_025'
...
Conflicts:
src/test/test.c
2015-02-02 16:31:32 -05:00
rl1987
a9caeb961f
Test for 13865.
2015-02-02 14:38:36 -05:00
Nick Mathewson
fac8d40886
Merge remote-tracking branch 'public/prop227_v2'
...
Conflicts:
src/test/test_dir.c
2015-01-30 07:36:55 -05:00
Nick Mathewson
bd630a899a
Correctly reject packages lines with empty entries
2015-01-29 14:09:57 -05:00
Nick Mathewson
8f9fb3e8fa
Try to fix some more memory leaks in the unit tests
2015-01-23 11:35:05 -05:00
Nick Mathewson
614fbf1812
Fix some memory leaks in new address tests
2015-01-23 11:26:40 -05:00
Nick Mathewson
034e2788f8
whitespace fixes
2015-01-23 11:18:28 -05:00
Nick Mathewson
7322de15dc
Split the slow unit tests into their own binary
...
This can run in parallel with the faster ones and the other tests.
2015-01-23 11:15:53 -05:00
Nick Mathewson
420037dcef
Merge branch 'if_addr_refactoring_squashed'
...
Conflicts:
src/test/include.am
src/test/test.c
2015-01-23 10:13:37 -05:00
rl1987
3966145dff
Refactor code that looks up addresses from interfaces
...
Now the code has separate implementation and examination functions,
uses smartlists sanely, and has relatively decent test coverage.
2015-01-23 10:07:17 -05:00
Nick Mathewson
5d4bb6f61f
Merge remote-tracking branch 'public/ticket9969'
...
Conflicts:
src/or/directory.c
src/or/routerlist.c
src/or/routerlist.h
src/test/include.am
src/test/test.c
2015-01-23 09:36:00 -05:00
Nick Mathewson
b677ccd3ab
Merge remote-tracking branch 'public/ticket13762'
2015-01-23 08:55:31 -05:00
Nick Mathewson
23fc1691b6
Merge branch 'better_workqueue_v3_squashed'
2015-01-21 14:47:16 -05:00
David Goulet
f52ac5be74
Fix: change copyright year in workqueue and thread tests
...
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-21 14:31:02 -05:00
Nick Mathewson
2e8b8c8698
Make check-spaces happier.
2015-01-19 11:56:03 -05:00
Nick Mathewson
f92b01b963
Remove a now-needless testing workaround.
2015-01-19 11:55:52 -05:00
Nick Mathewson
1053af0b9c
Merge branch 'bug7555_v2_squashed'
...
Conflicts:
src/or/connection_edge.c
2015-01-19 11:43:41 -05:00
Nick Mathewson
ba17cdfb0a
fix another mingw64 unit test warnin
2015-01-16 11:49:58 -05:00
Nick Mathewson
4b23b398a3
Merge branch 'bug8546_squashed'
...
Conflicts:
src/or/connection.c
src/or/or.h
src/or/relay.c
2015-01-16 09:31:50 -05:00
Nick Mathewson
13dac5e463
Move entry_port_cfg_t fields in entry_connection_t
...
Also rename some options for uniformity, and apply this script:
@@
entry_connection_t *conn;
@@
conn->
+entry_cfg.
\(
isolation_flags
\|
session_group
\|
socks_prefer_no_auth
\|
ipv4_traffic
\|
ipv6_traffic
\|
prefer_ipv6
\|
cache_ipv4_answers
\|
cache_ipv6_answers
\|
use_cached_ipv4_answers
\|
use_cached_ipv6_answers
\|
prefer_ipv6_virtaddr
\)
2015-01-16 09:22:58 -05:00
Nick Mathewson
2329d9fe37
Fix a compilation warning in the unit tests
2015-01-15 12:56:57 -05:00
George Kadianakis
bb56fd1f8f
unittests: use tt_i64_op() instead of tt_int_op() in laplace tests.
...
Do this in even more places to try to fix the build.
2015-01-15 11:08:22 -05:00
Nick Mathewson
a52e549124
Update workqueue implementation to use a single queue for the work
...
Previously I used one queue per worker; now I use one queue for
everyone. The "broadcast" code is gone, replaced with an idempotent
'update' operation.
2015-01-15 11:05:22 -05:00
Nick Mathewson
88e36eaf0e
Fix the checkdir/perms test when umask==077
...
Fixes 14215; bugfix on 0.2.6.2-alpha. Reported by "cypherpunks".
2015-01-15 10:24:27 -05:00
George Kadianakis
354ddf8712
unittests: use tt_i64_op() instead of tt_int_op() in laplace tests.
2015-01-15 15:14:33 +00:00
George Kadianakis
25e7821bb1
unittests: Change some tt_assert()s to tt_int_op()s.
2015-01-15 14:43:58 +00:00
George Kadianakis
45bc5a0743
Restrict sample values of the Laplace distribution to int64_t.
...
This helps avoid undefined behavior from casting big double values to
int64_t. Fixes #14090 .
2015-01-15 14:43:58 +00:00
Nick Mathewson
cc6529e9bb
Fix check-spaces
2015-01-14 11:19:35 -05:00
Nick Mathewson
e5f8c772f4
Test and fix workqueue_entry_cancel().
2015-01-14 11:17:46 -05:00
Nick Mathewson
ebbc177005
Add shutdown and broadcast support to test_workqueue.
2015-01-14 11:17:46 -05:00
Nick Mathewson
81354b081b
Add unit test for thread IDs.
2015-01-14 11:17:43 -05:00
Nick Mathewson
7a63005220
Basic unit test for condition variables.
2015-01-14 11:17:09 -05:00
Nick Mathewson
74b782645a
Move thread tests into their own module
2015-01-14 11:09:47 -05:00
Nick Mathewson
c51f7c23e3
Test a little more of compat_threads.c
2015-01-14 11:05:56 -05:00
Nick Mathewson
93ad89e9d2
Rename bench_workqueue -> test_workqueue and make it a unit test.
2015-01-14 11:05:56 -05:00
Nick Mathewson
c7eebe237d
Make pending work cancellable.
2015-01-14 10:56:27 -05:00
Nick Mathewson
a82604b526
Initial workqueue implemention, with a simple test.
...
It seems to be working, but more tuning is needed.
2015-01-14 10:56:24 -05:00
Nick Mathewson
b72acd725a
More tests as suggested by rl1987
2015-01-14 09:10:35 -05:00
Nick Mathewson
03f783c045
remove a bogus comment
2015-01-13 13:59:39 -05:00
Nick Mathewson
73d1d153dc
remove needless AllowDotExit in test_entryconn_rewrite_mapaddress_automap_onion2
2015-01-13 13:56:59 -05:00
Nick Mathewson
73ccf0b33f
Uncomment a test
2015-01-13 13:42:20 -05:00
Nick Mathewson
9d0fab9872
Allow MapAddress and Automap to work together
...
The trick here is to apply mapaddress first, and only then apply
automapping. Otherwise, the automap checks don't get done.
Fix for bug 7555; bugfix on all versions of Tor supporting both
MapAddress and AutoMap.
2015-01-13 12:41:15 -05:00
Nick Mathewson
ab6bd78eca
(Disabled, failing) test for the bug in 7555.
2015-01-13 12:26:04 -05:00
Nick Mathewson
6cbe016cb1
Fix memory leaks in entryconn tests.
2015-01-13 12:13:46 -05:00
Nick Mathewson
05a80bb46c
More unit tests for rewriting entry connection addresses
2015-01-13 11:08:33 -05:00
Nick Mathewson
a0b4c2f1bd
On jessie, we need a =, not a ==
2015-01-12 22:30:40 -05:00
Nick Mathewson
7257f2e31d
mktemp wants some Xs
2015-01-12 21:45:41 -05:00
Nick Mathewson
038804e13d
Tweak zero_length_keys.sh and test/include.am to make out-of-tree builds work
2015-01-12 21:28:01 -05:00
Nick Mathewson
bba995e666
Begin writing unit tests for rewrite code
2015-01-12 21:08:43 -05:00
Nick Mathewson
2edfdc02a2
Merge remote-tracking branch 'teor/bug13111-empty-key-files-fn-empty'
2015-01-12 14:06:14 -05:00
Nick Mathewson
c83d838146
Implement proposal 227-vote-on-package-fingerprints.txt
...
This implementation includes tests and a little documentation.
2015-01-10 15:09:07 -05:00
teor
ac2f90ed00
Speed up hidden service bootstrap by reducing the initial post delay
...
Drop the MIN_REND_INITIAL_POST_DELAY on a testing network to 5 seconds,
but keep the default at 30 seconds.
Reduces the hidden service bootstrap to 25 seconds from around 45 seconds.
Change the default src/test/test-network.sh delay to 25 seconds.
Closes ticket 13401.
2015-01-10 22:34:29 +11:00
teor
f8ffb57bc4
Merge branch 'master' of https://git.torproject.org/tor into bug13111-empty-key-files-fn-empty
...
Conflicts:
src/or/connection_edge.c
Merged in favour of origin.
2015-01-10 17:20:06 +11:00
teor
debd7862bb
Test that tor correctly handles zero-length keys
...
Check that tor generates new keys, and overwrites the empty key files.
Test that tor generates new keys when keys are missing (existing
behaviour).
Test that tor does not overwrite key files that already contain data
(existing behaviour).
Tests fixes to bug 13111.
2015-01-10 17:14:29 +11:00
Nick Mathewson
6f171003ce
fix new mingw64 compilation warnings
2015-01-08 10:44:30 -05:00
Nick Mathewson
90db39448d
Downgrade warnings about extrainfo incompatibility when reading cache
...
Fixes 13762.
2015-01-07 13:11:06 -05:00
Nick Mathewson
79aaad952f
appease "make check-spaces"
2015-01-07 10:09:09 -05:00
Nick Mathewson
cb54cd6745
Merge branch 'bug9286_v3_squashed'
2015-01-07 10:06:50 -05:00
Nick Mathewson
7984fc1531
Stop accepting milliseconds in various directory contexts
...
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-07 10:05:55 -05:00
Nick Mathewson
108808e98e
Fix obsolete usage of test_{str_},eq macros
2015-01-06 15:25:20 -05:00
Nick Mathewson
ae9efa863e
Merge remote-tracking branch 'public/bug13661_025'
2015-01-06 15:16:28 -05:00
Nick Mathewson
cf2ac8e255
Merge remote-tracking branch 'public/feature11791'
2015-01-06 13:52:54 -05:00
Nick Mathewson
f4221a809a
Make test_cmdline_args.py work on Windows
...
Patch from Gisle Vanem on tor-dev ml
2015-01-06 13:26:52 -05:00
Nick Mathewson
f54e54b0b4
Bump copyright dates to 2015, in case someday this matters.
2015-01-02 14:27:39 -05:00
Nick Mathewson
e85f0c650c
Merge branch 'resolvemyaddr_squashed'
2014-12-29 10:00:34 -05:00
Nick Mathewson
feed26d037
Make the resolvemyaddr unit tests pass when local dns is hijacked
...
If you are in a coffee shop that returns a helpful redirect page for
"onionrouter", or on an ISP that does the same, the test as written
would fail.
2014-12-29 10:00:22 -05:00
Nick Mathewson
3538dfc91f
Fix memory leaks in resolvemyaddr tests
2014-12-29 10:00:22 -05:00
Nick Mathewson
c07747be2e
Fix compilation errors in resolvemyaddr tests
2014-12-29 10:00:22 -05:00
rl1987
28217b969e
Adding comprehensive test cases for resolve_my_address.
...
Also, improve comments on resolve_my_address to explain what it
actually does.
2014-12-29 09:59:47 -05:00
Nick Mathewson
eda5cebd6c
Add another cellintptr use; fixes 14031
2014-12-26 19:17:24 -05:00
Michael Scherer
aabaed6f49
add support for systemd notification protocol
...
This permit for now to signal readiness in a cleaner way
to systemd.
2014-12-23 11:06:01 -05:00
Nick Mathewson
808e2b856b
Tweak channel unit tests so we don't see coverity complaints
...
channel_write_*_cell() can delete its argument, so coverity doesn't
like us doing pointer comparison against that argument later.
Silly.
2014-12-22 16:06:05 -05:00
Nick Mathewson
03d2df62f6
Fix a bunch of memory leaks in the unit tests. Found with valgrind
2014-12-22 12:27:26 -05:00
Nick Mathewson
13f26f41e4
Fix some coverity issues in the unit tests
2014-12-22 11:13:01 -05:00
Nick Mathewson
3d85df9569
LLONG_MIN => INT64_MIN.
2014-12-19 14:12:35 -05:00
Karsten Loesing
816e6f2eac
Fix unit test.
...
Looks like we forgot to update unit tests when we switched from 32-bit to
64-bit ints while tweaking 7cd53b7
.
2014-12-19 18:37:43 +01:00
Nick Mathewson
64787e99fa
Merge branch 'asn-karsten-task-13192-5-squashed'
2014-12-19 10:35:47 -05:00
Karsten Loesing
7cd53b75c1
Add better support to obfuscate statistics.
2014-12-10 11:16:26 +01:00
Nick Mathewson
3c0e09ef81
Add fakechans.h to noinst_headers
2014-12-04 09:19:44 -05:00
Nick Mathewson
58df153163
Fix more 64/32 warnings in test_channel.c
2014-12-04 09:16:49 -05:00
Nick Mathewson
11c044e46a
Initialize libevent in circuitmux/destroy_cell_queue test
2014-12-04 09:11:13 -05:00
Nick Mathewson
11b652acb3
Fix some 32-bit build issues in the tests
...
When comparing 64-bit types, you need to use tt_[ui]64_op().
Found by Jenkins
2014-11-28 10:06:10 -05:00
Nick Mathewson
49976fabc4
Fix a likely bug found by coverity in test_scheduler.c.
...
Andrea, do you agree with this?
This is CID 1256186
2014-11-27 23:21:46 -05:00
Nick Mathewson
a28df3fb67
Merge remote-tracking branch 'andrea/cmux_refactor_configurable_threshold'
...
Conflicts:
src/or/or.h
src/test/Makefile.nmake
2014-11-27 22:39:46 -05:00
Nick Mathewson
734ba5cb0a
Use smaller zlib objects when under memory pressure
...
We add a compression level argument to tor_zlib_new, and use it to
determine how much memory to allocate for the zlib object. We use the
existing level by default, but shift to smaller levels for small
requests when we have been over 3/4 of our memory usage in the past
half-hour.
Closes ticket 11791.
2014-11-17 11:43:50 -05:00
rl1987
0db96d023b
Adding REASON field to HS_DESC FAILED controller event.
2014-11-16 15:51:23 +02:00
Nick Mathewson
9b11dc3617
Merge remote-tracking branch 'public/bug7484'
...
Conflicts:
src/test/test_addr.c
2014-11-12 13:44:57 -05:00
Nick Mathewson
4ac5175109
Fix wide lines (from 13172)
2014-11-12 13:42:01 -05:00
Nick Mathewson
a3dafd3f58
Replace operators used as macro arguments with OP_XX macros
...
Part of fix for 13172
2014-11-12 13:28:07 -05:00
Nick Mathewson
d85270e13c
Reenhappy make check-spaces
2014-11-12 13:15:10 -05:00
Nick Mathewson
5b1971c7f3
test_checkdir.c: Perhaps this is what will make this test pass on windows?
2014-11-07 09:28:49 -05:00
Nick Mathewson
85a76cd4eb
test_checkdir.c: try to make it pass on windows
...
also fix memory-leak on failing tests.
2014-11-07 08:54:44 -05:00
Nick Mathewson
4ae729683d
Try to fix test_checkdir windows compilation more
2014-11-05 14:51:17 -05:00
Nick Mathewson
bb54d008c2
Try to fix test_checkdir windows compilation
2014-11-05 14:39:09 -05:00
Nick Mathewson
1dcc492295
chgrp the testing tempdir to ourself to clear the sticky bit
...
Closes 13678. Doesn't actually matter for older tors.
2014-11-05 14:28:34 -05:00
Nick Mathewson
8f645befba
11291: Fix warnings, add changes file, rename 'mask'.
2014-11-05 14:12:18 -05:00
Nick Mathewson
4df419a4b1
Merge remote-tracking branch 'meejah/ticket-11291-extra-utests'
...
Conflicts:
src/or/config.c
2014-11-05 14:11:47 -05:00
Nick Mathewson
fc62721b06
Fix version number parsing to allow 2- and 3-part versions.
...
Fixes bug 13661; bugfix on 0.0.8pre1.
2014-11-05 13:29:28 -05:00
Nick Mathewson
07e06b335d
Fix unused-argument warnings
2014-11-04 09:54:51 -05:00
Nick Mathewson
9619c395ac
Merge remote-tracking branch 'andrea/ticket6456'
...
Somewhat tricky conflicts:
src/or/config.c
Also, s/test_assert/tt_assert in test_config.c
2014-11-04 09:52:04 -05:00
Nick Mathewson
60c86a3b79
Merge branch 'bug13315_squashed'
...
Conflicts:
src/or/buffers.c
2014-11-04 00:48:25 -05:00
rl1987
51e2473618
Sending 'Not allowed' error message before closing the connection.
2014-11-04 00:37:24 -05:00
rl1987
0da4ddda4f
Checking if FQDN is actually IPv6 address string and handling that case.
2014-11-04 00:37:24 -05:00
rl1987
2862b769de
Validating SOCKS5 hostname more correctly.
2014-11-04 00:36:42 -05:00
rl1987
e8e45ff13e
Introducing helper function to validate IPv4 address strings.
2014-11-04 00:36:37 -05:00
rl1987
1ea9a6fd72
Introducing helper function to validate DNS name strings.
2014-11-04 00:35:43 -05:00
Nick Mathewson
bbd8d07167
Apply new calloc coccinelle patch
2014-11-02 11:56:02 -05:00
Nick Mathewson
fcdcb377a4
Add another year to our copyright dates.
...
Because in 95 years, we or our successors will surely care about
enforcing the BSD license terms on this code. Right?
2014-10-28 15:30:16 -04:00
Sebastian Hahn
909aa51b3f
Remove configure option to disable curve25519
...
By now, support in the network is widespread and it's time to require
more modern crypto on all Tor instances, whether they're clients or
servers. By doing this early in 0.2.6, we can be sure that at some point
all clients will have reasonable support.
2014-10-27 14:41:19 +01:00
Nick Mathewson
ac4dd248e1
Switch new time tests to use SIZEOF_TIME_T, not sizeof(time_t)
...
Otherwise, we get implicit conversion warning on some platforms.
2014-10-22 12:57:21 -04:00
teor
c9d0967dd9
Fix minor typos, two line lengths, and a repeated include
2014-10-23 02:57:11 +11:00
Nick Mathewson
8e4daa7bb0
Merge remote-tracking branch 'public/ticket6938'
...
Conflicts:
src/tools/tor-resolve.c
2014-10-22 10:14:03 -04:00
meejah
3d0d49be23
Additional test for error-case
...
This error-case was already fixed by previous changes,
this is to cover it in case there's a regression.
2014-10-21 00:14:57 -06:00
teor
a1c6a40c22
Conditionally compile time testing code based on integer size
2014-10-21 08:44:10 +11:00
teor
879b39e1a8
Further unit test tor_timegm and parse_rfc1123_time
...
Add unit tests for tor_timegm signed overflow,
tor_timegm and parse_rfc1123_time validity checks,
and correct_tm year clamping.
Unit tests (visible) fixes in bug 13476.
2014-10-20 02:52:21 +11:00
Nick Mathewson
fb91d647ac
Downgrade 'invalid result from curve25519 handshake: 4' warning
...
Also, refactor the way we handle failed handshakes so that this
warning doesn't propagate itself to "onion_skin_client_handshake
failed" and "circuit_finish_handshake failed" and
"connection_edge_process_relay_cell (at origin) failed."
Resolves warning from 9635.
2014-10-16 13:26:42 -04:00
Nick Mathewson
a5cc5ad08d
Merge remote-tracking branch 'yawning/bug13314'
2014-10-16 09:12:13 -04:00
Nick Mathewson
21fe945ebd
Define a strnlen replacement on platforms (win32) that lack it
...
Right now this is only needed for test_util_format_time_interval, so
define it as a static function. We can move it into compat later if
we need to.
2014-10-13 14:59:17 -04:00
Nick Mathewson
d950e24332
Merge remote-tracking branch 'public/bug11243_squashed'
2014-10-13 14:32:43 -04:00
Nick Mathewson
223d354e34
Bugfixes on bug11243 fix for the not-added cases and tests
...
1. The test that adds things to the cache needs to set the clock back so
that the descriptors it adds are valid.
2. We split ROUTER_NOT_NEW into ROUTER_TOO_OLD, so that we can
distinguish "already had it" from "rejected because of old published
date".
3. We make extrainfo_insert() return a was_router_added_t, and we
make its caller use it correctly. This is probably redundant with
the extrainfo_is_bogus flag.
2014-10-13 14:31:11 -04:00
Nick Mathewson
3efeb711f1
Unit tests for 11243: loading ri, ei, mds from lists
...
These tests make sure that entries are actually marked
undownloadable as appropriate.
2014-10-13 14:30:02 -04:00
Nick Mathewson
24dfbfda1d
Base tests for 11243: test parsing for md, ei, and ri.
...
We didn't really have test coverage for these parsing functions, so
I went and made some. These tests also verify that the parsing
functions set the list of invalid digests correctly.
2014-10-13 14:30:02 -04:00
Nick Mathewson
a30594605e
Treat unparseable (micro)descriptors and extrainfos as undownloadable
...
One pain point in evolving the Tor design and implementing has been
adding code that makes clients reject directory documents that they
previously would have accepted, if those descriptors actually exist.
When this happened, the clients would get the document, reject it,
and then decide to try downloading it again, ad infinitum. This
problem becomes particularly obnoxious with authorities, since if
some authorities accept a descriptor that others don't, the ones
that don't accept it would go crazy trying to re-fetch it over and
over. (See for example ticket #9286.)
This patch tries to solve this problem by tracking, if a descriptor
isn't parseable, what its digest was, and whether it is invalid
because of some flaw that applies to the portion containing the
digest. (This excludes RSA signature problems: RSA signatures
aren't included in the digest. This means that a directory
authority can still put another directory authority into a loop by
mentioning a descriptor, and then serving that descriptor with an
invalid RSA signatures. But that would also make the misbehaving
directory authority get DoSed by the server it's attacking, so it's
not much of an issue.)
We already have a mechanism to mark something undownloadable with
downloadstatus_mark_impossible(); we use that here for
microdescriptors, extrainfos, and router descriptors.
Unit tests to follow in another patch.
Closes ticket #11243 .
2014-10-13 14:30:02 -04:00
Nick Mathewson
f1782d9c4c
Clean whitespace in last patch.
2014-10-13 13:20:07 -04:00
teor
f51418aabc
Avoid overflow in format_time_interval, create unit tests
...
Fix an instance of integer overflow in format_time_interval() when
taking the absolute value of the supplied signed interval value.
Fixes bug 13393.
Create unit tests for format_time_interval().
2014-10-12 20:50:10 +11:00
Nick Mathewson
cc5571e1f1
Merge remote-tracking branches 'teor/issue-13161-test-network' and 'teor/issue-13161-TestingDirAuthVoteExit'
2014-10-08 15:46:29 -04:00
teor
c0794d22a2
Exit test-network with status of chutney verify
...
Preserve previous semantics of src/test/test-network.sh by exiting with
the exit status of chutney verify, even though the latest version ends
with chutney stop.
2014-10-05 09:59:27 +11:00
teor
9a2d4b6647
Stop an apparent test-network hang when used with make -j2
...
If (GNU) Make 3.81 is running processes in parallel using -j2 (or more),
it waits until all descendent processes have exited before it returns to
the shell.
When a command like "make -j2 test-network" is run, this means that
test-network.sh apparently hangs until it either make is forcibly
terminated, or all the chutney-launched tor processes have exited.
A workaround is to use make without -j, or make -j1 if there is an
existing alias to "make -jn" in the shell.
We resolve this bug in tor by using "chutney stop" after "chutney verify"
in test-network.sh.
2014-10-04 13:18:56 +10:00
Yawning Angel
c8132aab92
Send back SOCKS5 errors for all of the address related failures.
...
Cases that now send errors:
* Malformed IP address (SOCKS5_GENERAL_ERROR)
* CONNECT/RESOLVE request with IP, when SafeSocks is set
(SOCKS5_NOT_ALLOWED)
* RESOLVE_PTR request with FQDN (SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED)
* Malformed FQDN (SOCKS5_GENERAL_ERROR)
* Unknown address type (SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED)
Fixes bug 13314.
2014-10-01 14:16:59 +00:00
teor
bae7334390
Add test-network delay option
...
Add a --delay option to test-network.sh, which configures the delay before
the chutney network tests for data transmission. The default remains at
18 seconds if the argument isn't specified.
Apparently we should be using bootstrap status for this (eventually).
Partially implements ticket 13161.
2014-10-01 18:05:04 +10:00
teor
7c0215f8ca
test-network.sh: Use "/bin/echo -n" rather than builtin echo
...
The default shell on OS X is bash, which has a builtin echo. When called
in "sh" mode, this echo does not accept "-n". This patch uses "/bin/echo -n"
instead.
Partially fixes issue 13161.
2014-10-01 17:56:53 +10:00
Andrea Shepard
a28cfa128f
Update test_relay.c for recent test suite changes and --enable-mempools support
2014-09-30 23:16:11 -07:00
Andrea Shepard
4d20c427b4
Update test_relay.c for recent test suite changes and --enable-mempools support
2014-09-30 23:15:43 -07:00
Andrea Shepard
faea058baa
Update test_channeltls.c for recent test suite changes and --enable-mempools support
2014-09-30 23:15:43 -07:00
Andrea Shepard
2d171c1081
Update test_channel.c for recent test suite changes and --enable-mempools support
2014-09-30 23:15:41 -07:00
Andrea Shepard
41cf9f6260
Add scheduler/loop unit test
2014-09-30 23:14:59 -07:00
Andrea Shepard
684bcd886a
Add scheduler channel states unit test
2014-09-30 23:14:58 -07:00
Andrea Shepard
314c2f18ae
Add scheduler/compare_channels unit test
2014-09-30 23:14:58 -07:00
Andrea Shepard
030608d68d
Add scheduler/queue_heuristic unit test
2014-09-30 23:14:58 -07:00
Andrea Shepard
0af88f9096
Initial test_scheduler.c
2014-09-30 23:14:56 -07:00
Andrea Shepard
5e9a88e001
Add channel_tls_num_cells_writeable_method() coverage to channeltls/num_bytes_queued unit test
2014-09-30 23:14:25 -07:00
Andrea Shepard
030b0fe107
Add channeltls/num_bytes_queued unit test
2014-09-30 23:14:25 -07:00
Andrea Shepard
8719f8ff09
Implement tlschan create and overhead estimate unit tests
2014-09-30 23:14:25 -07:00
Andrea Shepard
50d5fb87bd
Initial test_channeltls.c
2014-09-30 23:14:24 -07:00
Andrea Shepard
462eaed43e
Limited unit test for channel_dump_statistics()
2014-09-30 23:14:24 -07:00
Andrea Shepard
5ee25cc185
Add channel/dumpstats unit test
2014-09-30 23:14:24 -07:00
Andrea Shepard
9740a07b8c
Check queueing case in channel/flushmux unit test too
2014-09-30 23:14:23 -07:00
Andrea Shepard
f12f7159a5
Add channel/flushmux unit test
2014-09-30 23:14:22 -07:00
Andrea Shepard
76fcb8cb55
Add channel/incoming unit test
2014-09-30 23:14:02 -07:00
Andrea Shepard
b5d4ef18e1
Add unknown cell queue entry type case to channel/queue_impossible unit test
2014-09-30 23:14:02 -07:00
Andrea Shepard
f7951d318a
Small channel unit test improvements
2014-09-30 23:14:01 -07:00
Andrea Shepard
3b78667d65
Unit test for unusual channel lifecycles
2014-09-30 23:14:01 -07:00
Andrea Shepard
b6d0aaec07
Check some can't-happen cases draining channel cell queues
2014-09-30 23:13:58 -07:00
Andrea Shepard
5992a69dee
Add append_cell_to_circuit_queue() unit test
2014-09-30 23:09:15 -07:00
Andrea Shepard
46ff91b6ec
Add scheduler_channel_has_waiting_cells_mock() and some mock counter queries
2014-09-30 23:09:15 -07:00
Andrea Shepard
bef11b7156
Expose a useful mock from test_channel.c
2014-09-30 23:09:14 -07:00
Andrea Shepard
79b8f14c25
Expose fake channel utility functions in test suite in fakechans.h, and fix a test_channel.c bug
2014-09-30 23:09:14 -07:00
Andrea Shepard
ba294ff2dc
Implement channel flush unit test
2014-09-30 23:09:00 -07:00
Andrea Shepard
37baef0687
Add channel lifecycle test
2014-09-30 23:08:16 -07:00
Andrea Shepard
e00fde1797
Implement two-channel queue estimate test
2014-09-30 22:54:09 -07:00
Andrea Shepard
6e427c30af
Implement channel queue size estimate unit test
2014-09-30 22:54:09 -07:00
Andrea Shepard
6d886787e3
Unit tests for channel_get_cell_queue_entry_size() and channel_write_*() functions
2014-09-30 22:54:02 -07:00
Andrea Shepard
283646fd90
Fix scheduler assertion in circuitmux/destroy_cell_queue unit test
2014-09-30 22:49:36 -07:00
Nick Mathewson
fa80983e52
fixup! Unit tests for router download functions.
...
(Add missing test_routerlist.c that I forgot to add from arlo's branch
last time. Oops.)
2014-09-29 09:59:59 -04:00
Nick Mathewson
15b0bf0aad
Whitespace fixes on 13291 fix
2014-09-29 09:39:21 -04:00
Nick Mathewson
0a985af072
Parenthesize macro arguments for 13291 fix
2014-09-29 09:38:50 -04:00
teor
b827a08284
Stop spawn test failures due to a race condition with SIGCHLD on process exit
...
When a spawned process forks, fails, then exits very quickly, (this
typically occurs when exec fails), there is a race condition between the
SIGCHLD handler updating the process_handle's fields, and checking the
process status in those fields. The update can occur before or after the
spawn tests check the process status.
We check whether the process is running or not running (rather than just
checking if it is running) to avoid this issue.
2014-09-29 09:37:53 -04:00
Nick Mathewson
11ebbf5e88
Merge branch 'bug12971_take2_squashed'
2014-09-29 09:18:03 -04:00
rl1987
c5ad890904
Respond with 'Command not supported' SOCKS5 reply message upon reception of unsupported request.
2014-09-29 09:14:42 -04:00
Nick Mathewson
5e8cc766e6
Merge branch 'ticket961_squashed'
2014-09-29 09:05:18 -04:00
Nick Mathewson
4903ab1caa
Avoid frequent strcmp() calls for AccountingRule
...
Generally, we don't like to parse the same thing over and over; it's
best IMO to do it once at the start of the code.
2014-09-29 09:05:11 -04:00
Nick Mathewson
8527a29966
Add an "AccountingRule" feature to permit limiting bw usage by read+write
...
Patch from "chobe". Closes ticket 961.
2014-09-29 09:05:11 -04:00
Nick Mathewson
b45bfba2ce
Whitespace fixes
2014-09-29 08:48:22 -04:00
teor
ffd92e8ef8
Stop test & bench build failures with --disable-curve25519
...
Ensure test & bench code that references curve25519 is disabled by the
appropriate macros. tor now builds with and without --disable-curve25519.
2014-09-29 12:19:04 +10:00
Nick Mathewson
1c5d680b3d
Merge branch 'ed25519_ref10_squashed'
...
Conflicts:
src/common/include.am
src/ext/README
2014-09-25 15:11:34 -04:00
Nick Mathewson
6dbd451b9f
Add benchmarks for ed25519 functions
2014-09-25 15:08:32 -04:00
Nick Mathewson
9b43a4a122
Add comments to ed25519_vectors.inc
2014-09-25 15:08:32 -04:00
Nick Mathewson
6981341764
Cut the time to run the python ed25519 tests by a factor of ~6
...
I know it's pointless to optimize them, but I just can't let them
spend all that time in expmod() when native python pow() does the same
thing.
2014-09-25 15:08:32 -04:00
Nick Mathewson
7ca470e13c
Add a reference implementation of our ed25519 modifications
...
Also, use it to generate test vectors, and add those test vectors
to test_crypto.c
This is based on ed25519.py from the ed25519 webpage; the kludgy hacks
are my own.
2014-09-25 15:08:32 -04:00
Nick Mathewson
d10e1bdec4
Add the pure-python ed25519 implementation, for testing.
2014-09-25 15:08:31 -04:00
Nick Mathewson
25b1a32ef8
Draft implementation for ed25519 key blinding, as in prop224
...
This implementation allows somebody to add a blinding factor to a
secret key, and a corresponding blinding factor to the public key.
Robert Ransom came up with this idea, I believe. Nick Hopper proved a
scheme like this secure. The bugs are my own.
2014-09-25 15:08:31 -04:00
Nick Mathewson
4caa6fad4c
Add curve25519->ed25519 key conversion per proposal 228
...
For proposal 228, we need to cross-certify our identity with our
curve25519 key, so that we can prove at descriptor-generation time
that we own that key. But how can we sign something with a key that
is only for doing Diffie-Hellman? By converting it to the
corresponding ed25519 point.
See the ALL-CAPS warning in the documentation. According to djb
(IIUC), it is safe to use these keys in the ways that ntor and prop228
are using them, but it might not be safe if we start providing crazy
oracle access.
(Unit tests included. What kind of a monster do you take me for?)
2014-09-25 15:08:31 -04:00
Nick Mathewson
c75e275574
Add encode/decode functions for ed25519 public keys
2014-09-25 15:08:31 -04:00
Nick Mathewson
006e6d3b6f
Another ed25519 tweak: store secret keys in expanded format
...
This will be needed/helpful for the key blinding of prop224, I
believe.
2014-09-25 15:08:31 -04:00
Nick Mathewson
87ba033cd5
Add Ed25519 support, wrappers, and tests.
...
Taken from earlier ed25519 branch based on floodyberry's
ed25519-donna. Tweaked so that it applies to ref10 instead.
2014-09-25 15:08:20 -04:00
Nick Mathewson
764e008092
Merge branch 'libscrypt_trunnel_squashed'
...
Conflicts:
src/test/test_crypto.c
2014-09-25 12:03:41 -04:00
Nick Mathewson
c433736734
Add tests for failing cases of crypto_pwbox
2014-09-25 11:58:14 -04:00
Nick Mathewson
3b7d0ed08e
Use trunnel for crypto_pwbox encoding/decoding.
...
This reduces the likelihood that I have made any exploitable errors
in the encoding/decoding.
This commit also imports the trunnel runtime source into Tor.
2014-09-25 11:58:14 -04:00
Nick Mathewson
d0f5d2b662
Test a full array of s2k flags with pwbox test.
...
Suggested by yawning.
2014-09-25 11:58:14 -04:00
Nick Mathewson
05a6439f1f
Use preferred key-expansion means for pbkdf2, scrypt.
...
Use HKDF for RFC2440 s2k only.
2014-09-25 11:58:13 -04:00
Nick Mathewson
8d84f3af7b
Test vectors for PBKDF2 from RFC6070
2014-09-25 11:58:13 -04:00
Nick Mathewson
b59d0dae14
Test vectors for scrypt from draft-josefsson-scrypt-kdf-00
2014-09-25 11:58:13 -04:00
Nick Mathewson
8184839a47
Rudimentary-but-sufficient passphrase-encrypted box code.
...
See crypto_pwbox.c for a description of the file format.
There are tests for successful operation, but it still needs
error-case tests.
2014-09-25 11:58:13 -04:00
Nick Mathewson
e84e1c9745
More generic passphrase hashing code, including scrypt support
...
Uses libscrypt when found; otherwise, we don't have scrypt and we
only support openpgp rfc2440 s2k hashing, or pbkdf2.
Includes documentation and unit tests; coverage around 95%. Remaining
uncovered code is sanity-checks that shouldn't be reachable fwict.
2014-09-25 11:58:13 -04:00
Nick Mathewson
482e3cfa09
fixup! Unit tests for router download functions.
...
Fix compilation warnings
2014-09-23 12:38:43 -04:00
Arlo Breault
bb137e23c1
Unit tests for router download functions.
...
Also, sort test suites alphabetically.
2014-09-23 12:23:18 -04:00
Nick Mathewson
bdd0c77643
Merge branch 'bug8197_squashed'
...
Conflicts:
src/test/test_policy.c
2014-09-22 14:34:52 -04:00
rl1987
2e951f8dda
Whitespace fixes
2014-09-22 14:18:00 -04:00
rl1987
0eaf82947d
Using the new API in unit-test.
2014-09-22 14:18:00 -04:00
Nick Mathewson
3f9fac7ee4
Fix a windows unused-arg warning
2014-09-17 11:00:27 -04:00
Nick Mathewson
ea72b4f60a
clean up eol whitespace from coccinelle-generated patches
2014-09-16 09:40:38 -04:00
Nick Mathewson
a6627fdb80
Remove the legacy_test_helper and legacy_setup wrappers
...
These wrappers went into place when the default type for our unit
test functions changed from "void fn(void)" to "void fn(void *arg)".
To generate this patch, I did the same hokey-pokey as before with
replacing all operators used as macro arguments, then I ran a
coccinelle script, then I ran perl script to fix up everything that
used legacy_test_helper, then I manually removed the
legacy_test_helper functions, then I ran a final perl script to put
the operators back how they were.
==============================
#!/usr/bin/perl -w -i -p
s/==,/_X_EQ_,/g;
s/!=,/_X_NE_,/g;
s/<,/_X_LT_,/g;
s/>,/_X_GT_,/g;
s/>=,/_X_GEQ_,/g;
s/<=,/_X_LEQ_,/g;
--------------------
@@
identifier func =~ "test_.*$";
statement S, S2;
@@
static void func (
-void
+void *arg
)
{
... when != S2
+(void) arg;
S
...
}
--------------------
#!/usr/bin/perl -w -i -p
s/, *legacy_test_helper, *([^,]+), *\&legacy_setup, *([^\}]+) *}/, $2, $1, NULL, NULL }/g;
--------------------
#!/usr/bin/perl -w -i -p
s/_X_NEQ_/!=/g;
s/_X_NE_/!=/g;
s/_X_EQ_/==/g;
s/_X_GT_/>/g;
s/_X_LT_/</g;
s/_X_GEQ_/>=/g;
s/_X_LEQ_/<=/g;
--------------------
2014-09-16 09:30:22 -04:00
Nick Mathewson
d684657548
Replace all uses of test_{str,}eq
2014-09-15 21:36:23 -04:00
Nick Mathewson
34bf9b3690
Replace the remaining test_assert instances
2014-09-15 21:29:48 -04:00
Nick Mathewson
0e0cef1d60
remove two unused test_* macros
2014-09-15 21:28:26 -04:00
Nick Mathewson
0d654d2355
Replace remaining uses of deprecated test_mem* functions
2014-09-15 21:27:23 -04:00
Nick Mathewson
1146a6a1c5
Replace the remaining test_n?eq_ptr calls
2014-09-15 21:25:27 -04:00
Nick Mathewson
5253ba3184
Make not even macros use test_fail_msg.
2014-09-15 21:22:36 -04:00
Nick Mathewson
0243895792
Use coccinelle scripts to clean up our unit tests
...
This should get rid of most of the users of the old test_*
functions. Some are in macros and will need manual cleanup, though.
This patch is for 13119, and was automatically generated with these
scripts. The perl scripts are there because coccinelle hates
operators as macro arguments.
------------------------------
s/==,/_X_EQ_,/g;
s/!=,/_X_NE_,/g;
s/<,/_X_LT_,/g;
s/>,/_X_GT_,/g;
s/>=,/_X_GEQ_,/g;
s/<=,/_X_LEQ_,/g;
------------------------------
@@
expression a;
identifier func;
@@
func (...) {
<...
-test_fail_msg
+TT_DIE
(
+(
a
+)
)
...>
}
@@
identifier func;
@@
func (...) {
<...
-test_fail()
+TT_DIE(("Assertion failed."))
...>
}
@@
expression a;
identifier func;
@@
func (...) {
<...
-test_assert
+tt_assert
(a)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_eq
+tt_int_op
(a,
+_X_EQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_neq
+tt_int_op
(a,
+_X_NEQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_streq
+tt_str_op
(a,
+_X_EQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_strneq
+tt_str_op
(a,
+_X_NEQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_eq_ptr
+tt_ptr_op
(a,
+_X_EQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func() {
<...
-test_neq_ptr
+tt_ptr_op
(a,
+_X_NEQ_,
b)
...>
}
@@
expression a, b, len;
identifier func;
@@
func (...) {
<...
-test_memeq
+tt_mem_op
(a,
+_X_EQ_,
b, len)
...>
}
@@
expression a, b, len;
identifier func;
@@
func (...) {
<...
-test_memneq
+tt_mem_op
(a,
+_X_NEQ_,
b, len)
...>
}
------------------------------
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a < b
+a, _X_LT_, b
)
...>
}
------------------------------
s/_X_NEQ_/!=/g;
s/_X_NE_/!=/g;
s/_X_EQ_/==/g;
s/_X_GT_/>/g;
s/_X_LT_/</g;
s/_X_GEQ_/>=/g;
s/_X_LEQ_/<=/g;
s/test_mem_op\(/tt_mem_op\(/g;
2014-09-15 21:18:21 -04:00
Nick Mathewson
0bd220adcb
Don't pass invalid memory regions to digestmap_set/get in test_routerlist
...
Fixes bug in c887e20e6a5a2c17c65; bug in no released Tor version.
2014-09-15 14:04:19 -04:00
Nick Mathewson
53a94c4b4b
Clear up another clangalyzer issue
...
"The NULL pointer warnings on the return value of
tor_addr_to_in6_addr32() are incorrect. But clang can't work this
out itself due to limited analysis depth. To teach the analyser that
the return value is safe to dereference, I applied tor_assert to the
return value."
Patch from teor. Part of 13157.
2014-09-15 13:52:13 -04:00
George Kadianakis
bc80b0a50c
Write some unittests for Tor2webRendezvousPoints.
2014-09-15 16:07:48 +03:00
George Kadianakis
a72b92676e
Fix up testhelper to be used by the entryguard unittests.
2014-09-15 16:07:48 +03:00
George Kadianakis
532ab7e13c
Move some useful unittest functions to a testhelper.c file.
...
This commit only moves code.
2014-09-15 16:07:48 +03:00
Nick Mathewson
89e32c7c08
One more whitespace fix
2014-09-11 14:40:24 -04:00
Nick Mathewson
32f75c870e
Whitespace cleanups in test_util
2014-09-11 14:37:12 -04:00
Nick Mathewson
6d66e9068b
Whitespace cleanups in transports/test_pt
2014-09-11 14:36:51 -04:00
Nick Mathewson
43a47ae726
Use tor_malloc_zero() in pt tests
...
Fixes for PT tests merged with 8402; patch from Yawning.
2014-09-11 09:17:13 -04:00
Nick Mathewson
121f4a9ca4
Merge remote-tracking branch 'public/bug13104_025'
2014-09-11 08:30:41 -04:00
Nick Mathewson
d02937a203
Fix "comparison is always false" warnings in new test_util_di_ops
...
Having a constant zero means that unsigned < 0 is always false.
2014-09-11 08:28:46 -04:00
Nick Mathewson
48558ed1aa
Merge remote-tracking branch 'public/bug13104_025'
2014-09-11 00:11:26 -04:00
Nick Mathewson
2491eadf00
C90 compliance for #13104 fixes
2014-09-11 00:10:53 -04:00
Nick Mathewson
284cc9a224
Avoid an overflow on negation in format_helper_exit_status
...
Part of 13104; patch from teor.
2014-09-11 00:00:13 -04:00
Nick Mathewson
59f9a5c786
Avoid divide by zero and NaNs in scale_array_elements_to_u64
...
Patch from teor; part of 13104
2014-09-10 23:59:21 -04:00
Nick Mathewson
5126bc2ebd
Extra tests for tor_memeq and memcmp
...
(Patch from teor; part of 13104)
2014-09-10 23:58:02 -04:00
Nick Mathewson
d2463c0cfe
Avoid overflows and underflows in sscanf and friends
...
(Patch from teor on 13104)
2014-09-10 23:57:31 -04:00
Nick Mathewson
e07206afea
Merge remote-tracking branch 'yawning/bug_8402'
2014-09-10 23:41:55 -04:00
Nick Mathewson
93dfb12037
Remember log messages that happen before logs are configured
...
(And replay them once we know our first real logs.)
This is an implementation for issue 6938. It solves the problem of
early log mesages not getting sent to log files, but not the issue of
early log messages not getting sent to controllers.
2014-09-10 23:34:43 -04:00
George Kadianakis
01800ea1e4
Add unittests for finding the third quartile of a set.
2014-09-09 12:28:15 -04:00
Sebastian Hahn
607724c696
Remove support for naming directory authorities
...
This implements the meat of #12899 . This commit should simply remove the
parts of Tor dirauths used to check whether a relay was supposed to be
named or not, it doesn't yet convert to a new mechanism for
reject/invalid/baddir/badexiting relays.
2014-09-09 11:50:21 -04:00
Nick Mathewson
c4d0d30bf3
Fix some 'dereference-before-null-check' warnings in test_circuitlist.c
...
Found by Coverity Scan.
[CID 1234704, 1234705, 1234706]
2014-09-03 10:59:10 -04:00
Nick Mathewson
0e66edb254
Fix the leaks that valgrind found in the new routerset tests.
...
(We have a tests-shouldn't-leak policy so that we won't accidentally
ignore true-positives.)
2014-09-03 09:51:14 -04:00
Nick Mathewson
bce32e0a35
Fix more (void*)11 warnings in the tests
2014-09-02 15:40:47 -04:00
David Stainton
6e4efb559d
Fix white space
2014-09-02 18:08:57 +00:00
Nick Mathewson
44f0dfa53b
Use real pointers in unit tests, not (void*)101 etc
...
The clangalyzer hates (void*)101 etc
2014-09-02 13:56:54 -04:00
Nick Mathewson
32b88d2565
Don't include a backtrace test for dereferencing 0 under analyzers
...
They hate this.
2014-09-02 13:56:31 -04:00
Nick Mathewson
07a16b3372
Add an assertion to read_file_to_str_until_eof
...
The clangalyzer doesn't believe our math here. I'm pretty sure our
math is right. Also, add some unit tests.
2014-09-02 13:29:11 -04:00
meejah
ae18c0812e
fix two typos
2014-08-30 15:23:05 -06:00
David Stainton
227b65924b
Clean up patch
...
Here I clean up anon's patch with a few of nickm's suggestions from comment 12:
https://trac.torproject.org/projects/tor/ticket/11291#comment:12
I did not yet completely implement all his suggestions.
2014-08-30 15:23:05 -06:00
anonymous
c13db1f614
Ticket #11291 : patch from "anon":
...
test-11291-group-redable-hsdirs-wtests-may8.patch
2014-08-30 15:23:05 -06:00
Nick Mathewson
573d62748a
Fix some coverity warnings in new routerset tests
2014-08-29 15:09:27 -04:00
dana koch
c887e20e6a
Introduce full coverage tests for module routerset.c.
...
This is using the paradigm introduced for test_status.c.
2014-08-29 12:55:28 -04:00
Nick Mathewson
9b2d8c4e20
Rename secret_to_key to secret_to_key_rfc2440
2014-08-28 11:20:31 -04:00
Nick Mathewson
9f9b19ed7b
Initialize crash handler in unit tests
...
This way, we don't get locking failures when we hit an assertion in
the unit tests. Also, we might find out about unit test bugs from
folks who can't do gdb.
2014-08-27 20:03:00 -04:00
Nick Mathewson
fdb7fc70d0
Merge remote-tracking branch 'public/bug10163'
2014-08-26 09:44:16 -04:00
Nick Mathewson
9222707e5c
Use the ARRAY_LENGTH macro more consistently.
2014-08-24 13:35:48 -04:00
Nick Mathewson
b6a725c67e
Fix memory leaks in test_entrynodes.c
...
[Coverity CID 1232087 and 1232088]
2014-08-21 10:18:17 -04:00
Nick Mathewson
916fba2243
Merge branch 'bug12205_take2_squashed'
2014-08-20 15:32:48 -04:00
Nick Mathewson
2994f00199
Whitespace fixes
2014-08-20 15:32:35 -04:00
Nick Mathewson
a5fe84b5a6
Small cleanups to test_entry_is_time_to_retry
2014-08-20 15:31:25 -04:00
rl1987
8b539cc276
Unit testing entry_is_time_to_retry().
2014-08-20 15:29:56 -04:00
Nick Mathewson
01a0ab02a3
Merge branch 'bug10116_squashed'
2014-08-20 14:52:24 -04:00
Nick Mathewson
82d4b60b91
fix remaining compilation problems
2014-08-20 14:50:37 -04:00
George Kadianakis
d28670c94f
Fix entrynodes test fails because of outdated test vectors.
2014-08-20 10:25:27 -04:00
Nick Mathewson
d38aa5545f
Remove implementation code for all pre-13 consensus methods.
...
Also remove a test for the way that we generated parameter votes
before consensus method 12.
2014-08-15 18:11:26 -04:00
Nick Mathewson
33fab2846a
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-15 10:07:04 -04:00
Nick Mathewson
0cb028b7c0
Remove stale printfs from buffer/zlib_fin_at_chunk_end test
...
These got committed by mistake.
2014-08-15 09:34:10 -04:00
Nick Mathewson
283730ad1c
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-13 15:11:52 -04:00
Nick Mathewson
789c8d8573
Apply an MSVC compilation fix from Gisle Vanem
...
This fixes a double-define introduced in 28538069b2
2014-08-13 15:11:00 -04:00
Nick Mathewson
2bfd92d0d1
Apply coccinelle script to replace malloc(a*b)->calloc(a,b)
2014-08-13 10:39:56 -04:00
Andrea Shepard
4a5164fd86
Replace all calls to parse_client_transport_line() or parse_server_transport_line() with new parse_transport_line() stub
2014-07-28 19:32:23 -07:00
Peter Palfrader
f8cbba7a33
Cast long long arguments to (int) for tt_int_op()
2014-07-28 15:42:20 -04:00
Andrea Shepard
5d81fd25a0
Add unit test for ClientTransportPlugin/ServerTransportPlugin config line parsing
2014-07-25 21:42:12 -07:00
Nick Mathewson
e7e92fb2f9
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-07-21 14:01:00 -04:00
Sathyanarayanan Gunasekaran
3af2a5d00e
Fix warning on building with bufferevents
...
Fixes #11578
2014-07-21 13:58:14 -04:00
Nick Mathewson
7259e3f604
Move test_descriptors.txt to an include file
...
Making the text file work out-of-tree didn't work on windows.
Maybe we can get it working that way later.
2014-07-16 22:37:00 +02:00
Nick Mathewson
facecce176
Fix tests when building out-of-tree
...
(This was too hard. Silly autoconf.)
2014-07-16 21:07:22 +02:00
Nick Mathewson
5690284559
Fix wide lines, make entry_is_live() non-inline
2014-07-16 16:52:16 +02:00
Nick Mathewson
368ff2291b
Merge remote-tracking branch 'asn/bug12202'
2014-07-16 16:49:07 +02:00
Nick Mathewson
d8705ec720
Merge remote-tracking branch 'asn/bug12207_second_draft'
2014-07-16 15:33:00 +02:00
Nick Mathewson
867f5e6a76
Add a tor_ftruncate to replace ftruncate.
...
(Windows doesn't have ftruncate, and some ftruncates do not move the
file pointer to the start of the file.)
2014-07-16 13:58:55 +02:00
Arlo Breault
15e170e01b
Add an option to overwrite logs
...
* Issue #5583
2014-07-16 12:16:49 +02:00
Nick Mathewson
3f683aadcd
When making a tempdir for windows unit tests, avoid an extra backslash
...
The extra \ is harmless, but mildly unpleasant.
Fixes 12392; bugfix on 0.2.2.25-alpha where we started using
GetTempDir(). Based on a patch by Gisle Vanem.
2014-07-16 11:39:03 +02:00
cypherpunks
6150741791
Fixed fgets_eagain unit test.
...
On a non-blocking pipe fgets sets EAGAIN when it encounters partial lines. No
error is set on full lines or EOF. EOF is reached when the writing end of the
pipe is closed. Partial lines and full lines are both returned by fgets, EOF
results in NULL.
Mention of this behaviour can be found in #1903 and #2045 .
2014-07-16 09:50:09 +02:00
George Kadianakis
b74442db94
Change interface of router_descriptor_is_too_old().
2014-07-09 19:20:41 +03:00
George Kadianakis
8bbb217964
Change the interface of entry_is_live() to take a bitmap.
2014-06-25 15:44:36 -04:00
George Kadianakis
46d41e6e9b
Basic entry_is_live() unittest.
2014-06-25 15:39:00 -04:00
George Kadianakis
a8fcdbf4a0
Add the entrynodes.c unit tests.
2014-06-24 14:22:52 -04:00
Nick Mathewson
58f4200789
Thread support is now required
...
Long ago we supported systems where there was no support for
threads, or where the threading library was broken. We shouldn't
have do that any more: on every OS that matters, threads exist, and
the OS supports running threads across multiple CPUs.
This resolves tickets 9495 and 12439. It's a prerequisite to making
our workqueue code work better, since sensible workqueue
implementations don't split across multiple processes.
2014-06-20 10:20:10 -04:00
Nick Mathewson
5b4ee475aa
Remove code for Windows CE support
...
As far as I know, nobody has used this in ages. It would be a
pretty big surprise if it had worked.
Closes ticket 11446.
2014-06-20 09:49:36 -04:00
George Kadianakis
727ed5448a
Add some test descriptors to src/test/.
2014-06-15 19:03:38 -07:00
Nick Mathewson
a7cafb1ea9
Merge branch 'bug8746_v2_squashed'
...
Conflicts:
src/common/include.am
2014-06-14 11:46:38 -04:00
Nick Mathewson
a5c092b34b
refactor win/nix handling for test_spawn_background*()
...
Instead of having a #if ... for every function, just define
TEST_CHILD to the right patch and EOL to the expected line terminator.
2014-06-14 11:40:28 -04:00
Nick Mathewson
e3833193af
More unit tests for process spawning
...
Try killing a running process; try noticing that a process has
exited without checking its output; verify that waitpid_cb (when
present) is set to NULL when you would expect it to be.
2014-06-14 11:40:27 -04:00
Nick Mathewson
1a73e17801
Merge remote-tracking branch 'andrea/bug11476'
2014-05-22 16:27:29 -04:00
Yawning Angel
7a18ac7454
Fixed the test build with --enable-gcc-warnings
2014-05-21 08:14:38 +00:00
Yawning Angel
41d2b4d3af
Allow ClientTransportPlugins to use proxies
...
This change allows using Socks4Proxy, Socks5Proxy and HTTPSProxy with
ClientTransportPlugins via the TOR_PT_PROXY extension to the
pluggable transport specification.
This fixes bug #8402 .
2014-05-21 08:14:38 +00:00
Andrea Shepard
39d4e67be8
Add --disable-mempools configure option
2014-05-12 18:23:34 -07:00
Nick Mathewson
6267d4f97a
fix whitespace
2014-05-11 23:40:48 -04:00
dana koch
d6e6c63baf
Quench clang's complaints with -Wshorten-64-to-32 when time_t is not long.
...
On OpenBSD 5.4, time_t is a 32-bit integer. These instances contain
implicit treatment of long and time_t as comparable types, so explicitly
cast to time_t.
2014-05-11 23:36:00 -04:00
Nick Mathewson
de2010e9c2
One more 64->32
2014-05-08 14:10:30 -04:00
Nick Mathewson
28538069b2
Fix numerous 64->32 errors in the unit tests
...
Before the 11825 fix, these were all silently ignored.
2014-05-08 14:01:17 -04:00
Nick Mathewson
df68478938
Fix unearthed problems in unit tests
2014-05-08 13:16:08 -04:00
Nick Mathewson
5bb6172367
Fix numerous type errors in the unit tests
...
Remove tinytest casts that were suppressing them.
Fix for #11825 .
2014-05-08 13:08:13 -04:00
Nick Mathewson
1f11be2170
Fix test_util_max_mem on 32-bit CPUs
2014-05-08 12:48:41 -04:00
Nick Mathewson
891d239e01
More unit tests for #11648-related stuff
...
These are actually tests for #311 . It appears to me that we didn't
fix #311 properly when we thought we did in 475eb5d6; instead, the
real fix was 05eff35ac6
, a few minutes earlier.
2014-05-08 12:41:01 -04:00
Nick Mathewson
8a2e66b623
Fix test_pick_circid on 32-bit platforms
2014-05-07 03:27:49 -04:00
Nick Mathewson
499e77663e
Basic tests for get_unique_circ_id_by_chan.
2014-05-07 02:57:50 -04:00
Nick Mathewson
e198faa633
Quick-and-dirty test for packed_cell_is_destroy
2014-05-07 02:05:35 -04:00
Nick Mathewson
ba5069b310
Remove a spurious variable.
2014-05-06 20:46:26 -04:00
Nick Mathewson
4a740451ac
Merge remote-tracking branch 'public/bug11750'
2014-05-06 20:44:41 -04:00
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