Commit Graph

1209 Commits

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