aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_status.c
AgeCommit message (Collapse)Author
2020-08-07Log number of inbound/outbound ipv4/6 conns as part of heartbeatNick Mathewson
Closes #29113
2020-08-07Revise test_status to use log testing helpers.Nick Mathewson
This change lets us make these tests much shorter and easier to maintain.
2020-01-09Fix wide lines from NS() removal fallout.Nick Mathewson
2020-01-09Remove all usage of the NS*() macros in test*.cNick Mathewson
This is an automatically generated commit, made with the following kludgey perl script. It results in a number of wide lines, which I'll clean up in a subsequent commit. #/usr/bin/perl -w -i $mod = "NS_MODULE"; $submod = "NS_SUBMODULE"; $last_was_empty = 0; while (<>) { s/\bASPECT\(\s*(\w+)\s*,\s*(\w+)\s*\)/$1_$2/; if (/# *define +NS_MODULE +(\w+)/) { $mod = $1; next; } elsif (/# *define +NS_SUBMODULE +(\w+)/) { $submod = $1; next; } next if (/#undef NS_(SUB)?MODULE/); s/NS\(\s*test_main\s*\)/test_${mod}_${submod}/; s/NS\(\s*(\w+)\s*\)/${mod}_${submod}_$1/g; s/NS_FULL\(\\s*(\w+)\s*,\s*(\w+),\s*(\w+)\s*\)/$1_$2_$3/; s/^(\s*)NS_MOCK\(\s*(\w+)\s*\)/$1MOCK($2,\n$1 ${mod}_${submod}_$2)/; s/NS_UNMOCK\(\s*(\w+)\s*\)/UNMOCK($1)/; s/TEST_CASE\(\s*(\w+)\s*\)/{ "$1", test_${mod}_$1, TT_FORK, NULL, NULL }/; s/TEST_CASE_ASPECT\(\s*(\w+)\s*,\s*(\w+)\s*\)/{ "$1_$2", test_${mod}_$1_$2, TT_FORK, NULL, NULL }/; s/NS_DECL\(\s*([^,]+)\s*,\s*([^,]+)\s*,\s*(\(.*)\);/static $1 ${mod}_${submod}_$2$3;\nATTR_UNUSED static int ${mod}_${submod}_$2_called = 0;/; s/\bCALLED\(\s*(\w+)\s*\)/${mod}_${submod}_$1_called/; if (/^$/) { print if (! $last_was_empty); $last_was_empty = 1; } else { $last_was_empty = 0; print; } if (eof) { $mod = "NS_MODULE"; $submod = "NS_SUBMODULE"; $last_was_empty = 0; } } # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Thu Jan 9 10:26:10 2020 -0500 # # On branch disable_ns_macro # Changes to be committed: # modified: src/test/test_accounting.c # modified: src/test/test_compat_libevent.c # modified: src/test/test_dir.c # modified: src/test/test_dir_handle_get.c # modified: src/test/test_dns.c # modified: src/test/test_options.c # modified: src/test/test_procmon.c # modified: src/test/test_rendcache.c # modified: src/test/test_router.c # modified: src/test/test_routerset.c # modified: src/test/test_status.c # modified: src/test/test_tortls.c # modified: src/test/test_tortls_openssl.c # modified: src/test/test_util_format.c # modified: src/test/test_util_process.c # # Untracked files: # experiments/ # locate_options.sh # un_ns.pl # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Thu Jan 9 10:26:10 2020 -0500 # # On branch disable_ns_macro # Changes to be committed: # modified: src/test/test_accounting.c # modified: src/test/test_compat_libevent.c # modified: src/test/test_dir.c # modified: src/test/test_dir_handle_get.c # modified: src/test/test_dns.c # modified: src/test/test_options.c # modified: src/test/test_procmon.c # modified: src/test/test_rendcache.c # modified: src/test/test_router.c # modified: src/test/test_routerset.c # modified: src/test/test_status.c # modified: src/test/test_tortls.c # modified: src/test/test_tortls_openssl.c # modified: src/test/test_util_format.c # modified: src/test/test_util_process.c # # Untracked files: # experiments/ # locate_options.sh # un_ns.pl #
2020-01-09Replace various NS_MODULE/SUBMODULE vals with shorter names.Nick Mathewson
This will help avoid wide lines in our output.
2020-01-09Put all NS_DECL invocations on single lines.Nick Mathewson
This is going to make my script happier; these lines will soon disappear.
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-11-06test: Fix DoS heartbeat unit test after adding INTRO2David Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-07-25Fix more 32-bit errors with domain and tt_int_opNick Mathewson
2019-01-16Bump copyright date to 2019Nick Mathewson
2018-09-25Extract all the "am I a server" functions from router.cNick Mathewson
2018-09-21Split main.c into main.c and mainloop.cNick Mathewson
The main.c code is responsible for initialization and shutdown; the mainloop.c code is responsible for running the main loop of Tor. Splitting the "generic event loop" part of mainloop.c from the event-loop-specific part is not done as part of this patch.
2018-07-10Rename torlog.[ch] to log.[ch]Nick Mathewson
Fun fact: these files used to be called log.[ch] until we ran into conflicts with systems having a log.h file. But now that we always include "lib/log/log.h", we should be fine.
2018-07-05Fix every include path changed in the previous commit (automated)Nick Mathewson
I am very glad to have written this script.
2018-07-03Merge remote-tracking branch 'github/ticket26626'Nick Mathewson
2018-07-03Replace U64_LITERAL with the standard UINT64_CNick Mathewson
2018-07-01Extract or_state_t to its own header.Nick Mathewson
Fewer modules needed this than I had expected.
2018-07-01Remove needless includes from or.hNick Mathewson
or.h should really include only the minimum of stuff from or/*, common/*, and lib/*.
2018-06-22Automated fixup of include paths after torlog.h movement.Nick Mathewson
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-15Extract routerinfo_t into its own header.Nick Mathewson
I was expecting this to be much worse.
2018-06-15Extract {or,origin}_circuit_t into their own headersNick Mathewson
2018-04-17heartbeat: Log the number of circuits killed because too many cellsDavid Goulet
We recently merged a circuit cell queue size safeguard. This commit adds the number of killed circuits that have reached the limit to the DoS heartbeat. It now looks like this: [notice] DoS mitigation since startup: 0 circuits killed with too many cells. 0 circuits rejected, 0 marked addresses. 0 connections closed. 0 single hop clients refused. Second thing that this patch does. It makes tor always print the DoS mitigation heartbeat line (for a relay) even though no DoS mitigation have been enabled. The reason is because we now kill circuits that have too many cells regardless on if it is enabled or not but also it will give the operator a chance to learn what is enabled with the heartbeat instead of suddenly appearing when it is enabled by let say the consensus. Fixes #25824 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-10-27Make sure all C files have copyright/license noticesNick Mathewson
2017-08-24Fix operator usage in src/test/*.cAlexander Færøy
This patch fixes the operator usage in src/test/*.c to use the symbolic operators instead of the normal C comparison operators. This patch was generated using: ./scripts/coccinelle/test-operator-cleanup src/test/*.[ch]
2016-09-11Merge remote-tracking branch 'public/solaris_warnings_028'Nick Mathewson
2016-07-28Fix a large pile of solaris warnings for bug 19767.Nick Mathewson
In nearly all cases, this is a matter of making sure that we include orconfig.h before we include any standard c headers.
2016-06-11Add -Wmissing-variable-declarations, with attendant fixesNick Mathewson
This is a big-ish patch, but it's very straightforward. Under this clang warning, we're not actually allowed to have a global variable without a previous extern declaration for it. The cases where we violated this rule fall into three roughly equal groups: * Stuff that should have been static. * Stuff that was global but where the extern was local to some other C file. * Stuff that was only global when built for the unit tests, that needed a conditional extern in the headers. The first two were IMO genuine problems; the last is a wart of how we build tests.
2016-01-12Stop log_heartbeat test from failing in timezones with non-integer offsetsFergus Dall
Instead of comparing the end of the time string against a constant, compare it to the output of format_local_iso_time when given the correct input.
2016-01-08Added AccountRule in and AccountingRule out optionsunixninja92
2015-03-12Merge remote-tracking branch 'public/feature15212_026' into maint-0.2.6Nick Mathewson
2015-03-10Fix check-spacesNick Mathewson
2015-03-10Add link protocol version counts to the heartbeat messageNick Mathewson
Closes ticket 15212
2015-02-24Update test_status.c to accommodate changes in heartbeat messagesNick Mathewson
Fixes #15012; bug not in any released Tor
2015-02-16Fix a few coverity "Use after NULL check" warningsNick Mathewson
Also remove the unit test mocks that allowed get_options() to be NULL; that's an invariant violation for get_options().
2014-11-12Fix wide lines (from 13172)Nick Mathewson
2014-11-12Replace operators used as macro arguments with OP_XX macrosNick Mathewson
Part of fix for 13172
2014-08-20fix remaining compilation problemsNick Mathewson
2014-04-29Fix memory leaks in test_status.cNick Mathewson
2014-04-15Fix compiler warning on test_status.cNick Mathewson
2014-04-15Uplift status.c unit test coverage with new test cases and macros.dana koch
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.