aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2018-12-17Use run_main_loop_until_done() for process_t tests.Alexander Færøy
This patch changes the slow process_t tests to use run_main_loop_until_done() instead of do_main_loop() since do_main_loop() initializes a lot of subsystem callbacks that we don't need to run in our tests. See: https://bugs.torproject.org/28179
2018-12-17Fix tests on kqueue() based platforms.Alexander Færøy
This patch disables fork()'ing of the slow process tests. This fixes the tests on the MacOS and other kqueue() based platforms. Without this patch the main loop exits eearly with EBADF as error. See: https://bugs.torproject.org/28179
2018-12-17Move remaining code from subprocess.{h,c} to more appropriate places.Alexander Færøy
This patch moves the remaining code from subprocess.{h,c} to more appropriate places in the process.c and process_win32.c module. We also delete the now empty subprocess module files. See: https://bugs.torproject.org/28179
2018-12-17Delete old process_handle_t code.Alexander Færøy
This patch removes the old process_handle_t code. Everything should by now be using the process_t interface. See: https://bugs.torproject.org/28179
2018-12-17Add tests for process environment functionality of process_t.Alexander Færøy
This patch adds tests for the process_environment_t interaction in process_t. See: https://bugs.torproject.org/28179
2018-12-17Add slow test for process_t for main loop interaction.Alexander Færøy
This patch adds test cases for process_t which uses Tor's main loop. This allows us to test that the callbacks are actually invoked by the main loop when we expect them. See: https://bugs.torproject.org/28179
2018-12-17Add support for logging messages from pluggable transports.Alexander Færøy
This patch adds support for the "LOG" protocol message from a pluggable transport. This allows pluggable transport developers to relay log messages from their binary to Tor, which will both emit them as log messages from the Tor process itself, but also pass them on via the control port. See: https://bugs.torproject.org/28180 See: https://bugs.torproject.org/28181 See: https://bugs.torproject.org/28182
2018-12-17Use process_t for managed proxies.Alexander Færøy
This patch makes the managed proxy subsystem use the process_t data structure such that we can get events from the PT process while Tor is running and not just when the PT process is being configured. See: https://bugs.torproject.org/28179
2018-12-17Add process_get_pid() to the Process subsystem.Alexander Færøy
This patch adds support for getting the unique process identifier from a given process_t. This patch implements both support for both the Unix and Microsoft Windows backend. See: https://bugs.torproject.org/28179
2018-12-17Add Windows backend for the Process subsystem.Alexander Færøy
This patch adds support for Microsoft Windows in the Process subsystem. Libevent does not support mixing different types of handles (sockets, named pipes, etc.) on Windows in its core event loop code. This have historically meant that Tor have avoided attaching any non-networking handles to the event loop. This patch uses a slightly different approach to roughly support the same features for the Process subsystem as we do with the Unix backend. In this patch we use Windows Extended I/O functions (ReadFileEx() and WriteFileEx()) which executes asynchronously in the background and executes a completion routine when the scheduled read or write operation have completed. This is much different from the Unix backend where the operating system signals to us whenever a file descriptor is "ready" to either being read from or written to. To make the Windows operating system execute the completion routines of ReadFileEx() and WriteFileEx() we must get the Tor process into what Microsoft calls an "alertable" state. To do this we execute SleepEx() with a zero millisecond sleep time from a main loop timer that ticks once a second. This moves the process into the "alertable" state and when we return from the zero millisecond timeout all the outstanding I/O completion routines will be called and we can schedule the next reads and writes. The timer loop is also responsible for detecting whether our child processes have terminated since the last timer tick. See: https://bugs.torproject.org/28179
2018-12-17Add Unix backend for the Process subsystem.Alexander Færøy
This patch adds the Unix backend for the Process subsystem. The Unix backend attaches file descriptors from the child process's standard in, out and error to Tor's libevent based main loop using traditional Unix pipes. We use the already available `waitpid` module to get events whenever the child process terminates. See: https://bugs.torproject.org/28179
2018-12-17Add new Process subsystem.Alexander Færøy
This patch adds a new Process subsystem for running external programs in the background of Tor. The design is focused around a new type named `process_t` which have an API that allows the developer to easily write code that interacts with the given child process. These interactions includes: - Easy API for writing output to the child process's standard input handle. - Receive callbacks whenever the child has output on either its standard output or standard error handles. - Receive callback when the child process terminates. We also support two different "protocols" for handling output from the child process. The default protocol is the "line" protocol where the process output callbacks will be invoked only when there is complete lines (either "\r\n" or "\n" terminated). We also support the "raw" protocol where the read callbacks will get whatever the operating system delivered to us in a single read operation. This patch does not include any operating system backends, but the Unix and Windows backends will be included in separate commits. See: https://bugs.torproject.org/28179
2018-11-26Merge remote-tracking branch 'tor-github/pr/539'Nick Mathewson
2018-11-26Merge branch 'dormant_v2_squashed'Nick Mathewson
2018-11-26Test for check_network_participation_callback()Nick Mathewson
2018-11-26Test netstatus.c tracking of user participation statusNick Mathewson
2018-11-26Add options to control dormant-client feature.Nick Mathewson
The DormantClientTimeout option controls how long Tor will wait before going dormant. It also provides a way to disable the feature by setting DormantClientTimeout to e.g. "50 years". The DormantTimeoutDisabledByIdleStreams option controls whether open but inactive streams count as "client activity". To implement it, I had to make it so that reading or writing on a client stream *always* counts as activity. Closes ticket 28429.
2018-11-23Create a temporary directory for tor's DataDirectory in test_rebind.Taylor R Campbell
Fixes #28562. While here, put the argument count test and usage message _before_ we attempt to read from sys.argv.
2018-11-22Fix a comment typo in test_hs_common.cteor
2018-11-19Merge branch 'ticket27359_v2_squashed'Nick Mathewson
2018-11-19Test new functions in nodelist.cNick Mathewson
2018-11-19Aim for 100% test coverage on nodefamily.cNick Mathewson
2018-11-19Use nodefamily_t in microdescriptors.Nick Mathewson
Closes ticket 27359.
2018-11-19Backend for compact node-family representation.Nick Mathewson
This representation is meant to save memory in microdescriptors -- we can't use it in routerinfo_t yet, since those families need to be encoded losslessly for directory voting to work. This representation saves memory in three ways: 1. It uses only one allocation per family. (The old way used a smartlist (2 allocs) plus one strdup per entry.) 2. It stores identity digests in binary, not hex. 3. It keeps families in a canonical format, memoizes, and reference-counts them. Part of #27359.
2018-11-15Make the NET_PARTICIPANT role dependent on user activityNick Mathewson
This patch implements all of 28337, except for the part where we turn off the role if we've been idle for a long time.
2018-11-15Move control_per_second_events() into a callback with its own roleNick Mathewson
Part of making extra-dormant mode work; closes ticket 28421.
2018-11-15Add new "ALL" and "NET_PARTICIPANT" roles for periodic eventsNick Mathewson
The previous "ALL" role was the OR of a bunch of other roles, which is a mistake: it's better if "ALL" means "all". The "NET_PARTICIPANT" role refers to the anything that is actively building circuits, downloading directory information, and participating in the Tor network. For now, it is set to !net_is_disabled(), but we're going to use it to implement a new "extra dormant mode". Closes ticket 28336.
2018-11-09Merge branch 'subsystems'Nick Mathewson
2018-11-07Merge remote-tracking branch 'tor-github/pr/271'Nick Mathewson
2018-11-06Merge remote-tracking branch 'tor-github/pr/464'Nick Mathewson
2018-11-05Turn "compress" into a subsystem.Nick Mathewson
2018-11-05Move monotonic time setup into a subsystemNick Mathewson
2018-11-05Move prefork, postfork, and thread-exit hooks into subsysNick Mathewson
So far, crypto is the only module that uses them, but others are likely to do so in the future.
2018-11-05Add crypto module as a subsystem.Nick Mathewson
2018-11-05Move networking startup/cleanup logic into a subsystem.Nick Mathewson
2018-11-05Use subsystems manager for subsystems used in tests.Nick Mathewson
2018-11-05Move the code that knows our tor version into a lowest-level libNick Mathewson
2018-11-05In count_acceptable_nodes(), count direct and indirect nodes with ↵Neel Chauhan
node_has_preferred_descriptor()
2018-11-02Update address tests to avoid offending coverity.Nick Mathewson
2018-11-02Merge branch 'maint-0.3.5'Nick Mathewson
2018-11-02Merge branch 'bug27968_squashed' into maint-0.3.5Nick Mathewson
2018-11-02Sort the imports in test_rebind.pyteor
Cleanup after #27968.
2018-11-02Make test_rebind.py timeout when waiting for a log messageteor
Closes #27968.
2018-11-02Refactor test_rebind.py to consistently print FAIL on failureteor
Part of #27968.
2018-11-02Avoid a race condition in test_rebind.pyteor
If tor terminates due to SIGNAL HALT before test_rebind.py calls tor_process.terminate(), an OSError 3 (no such process) is thrown. Fixes part of bug 27968 on 0.3.5.1-alpha.
2018-11-01Add tests for the string_is_utf8_no_bom() function.George Kadianakis
2018-10-31Merge branch 'ticket24393_036_01_squashed'Nick Mathewson
2018-10-31Add test for nodes_in_same_family()Neel Chauhan
2018-10-31Merge branch 'maint-0.3.4' into maint-0.3.5Nick Mathewson
2018-10-31Merge branch 'maint-0.3.3' into maint-0.3.4Nick Mathewson