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