Commit Graph

991 Commits

Author SHA1 Message Date
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
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
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
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