Commit Graph

35038 Commits

Author SHA1 Message Date
Nick Mathewson
23c77f79fd Remove all usage of the NS*() macros in test*.c
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-09 11:09:22 -05:00
Nick Mathewson
c9855f23c1 Replace various NS_MODULE/SUBMODULE vals with shorter names.
This will help avoid wide lines in our output.
2020-01-09 11:08:18 -05:00
Nick Mathewson
e2fcfc6e52 Put all NS_DECL invocations on single lines.
This is going to make my script happier; these lines will soon
disappear.
2020-01-09 10:06:35 -05:00
Nick Mathewson
1ffba2f121 Always define NS_MODULE and NS_SUBMODULE when NS is used.
When these macros aren't defined, the expansions of the NS macros
can get particularly ugly.
2020-01-09 09:56:41 -05:00
Nick Mathewson
e45810113b Merge branch 'pre_formatter_cleanups_squashed' 2020-01-09 07:32:39 -05:00
Nick Mathewson
8b2041c343 changes file for 32764. 2020-01-09 07:30:35 -05:00
Nick Mathewson
3ad518cd97 process.h: include stdbool.h
We use bool, so we should include stdbool.
2020-01-09 07:30:35 -05:00
Nick Mathewson
ca9d605fa7 conscache.h: declare config_line_t structure.
This frees us from a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
09f03e6e3f Turn authdir_mode_v3() into a non-inline function
This change means that authmode.h no longer needs to see
or_options_t, and frees us from an ordering dependency.
2020-01-09 07:30:35 -05:00
Nick Mathewson
2f7a2c42d2 Include ht.h in all headers that use HT_ENTRY()
Without this change, compilation success depends on include order in
several tricky ways.
2020-01-09 07:30:35 -05:00
Nick Mathewson
afa36682f9 consdiffmgr.h: use struct declarations for several types
This prevents a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
06d977b569 hs_circuitmap.h: use a struct declaration
This fixes a case where our compilation would depend on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
887bf05c24 routerparse.h: include parsecommon.h when exposing token table.
Without this include, our compilation depends more on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
774d1092fd process.h: add a struct declaration for buf_t.
This lets us avoid a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
dd5dda78f6 timers.h: add declaration for timeval.
This frees us from some dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
25354171b5 lib/conf: include torint.h in files that use it.
This frees us from some dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
8d4b4aa932 control_hs.h: use a couple of struct delcarations
Doing this frees us from some assumptions about include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
8b7eeea39d connection.h: new includes and struct declarations
Using these frees us from several dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
c4ac5adc4a siphash.h: include stdint.
Doing this gives us a valid uint64_t type, freeing us from
dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
6a6486a7bf hs_circuit: use struct declaration.
This frees us from a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
d7b8377c28 or_options_st.h: Add an include and a struct declaration.
This frees us from some dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
8bb686d8a0 Include x509.h in tortls_internal.h.
This gives us the definition of tor_x509_cert_impl_t, and makes us
less dependent on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
b1dceeca5a Include sys/types.h in fdio.h, for "off_t".
Otherwise our compilation depends on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
7b0d8834f2 Use raw_assert in ht.h
Also, include torerr.h from ht.h if we are using raw_assert.

Otherwise, our includes need to be ordered so that ht.h comes after
util_log.h.
2020-01-09 07:30:35 -05:00
Nick Mathewson
73b83b8f1a Remove extra ; from tt_assert() macro definition.
We were actually omitting the semicolon in a few places, leading to
confusing indentation and some cocci failures.
2020-01-09 07:30:35 -05:00
Nick Mathewson
3ce2304c6d Use new ENABLE/DISABLE_GCC_WARNING
This is an automated commit, generated by:

perl -i -pe 'next if /define/; s/((?:ENABLE|DISABLE)_GCC_WARNING)\(([A-Za-z0-9_\-]+)\)/$1(\"-W$2\")/' src/*/*/*.[ch] src/*/*.[ch]
2020-01-09 07:30:35 -05:00
Nick Mathewson
792e5b2403 Replace DISABLE/ENABLE_GCC_WARNING with something that will confuse clang-format less 2020-01-09 07:30:35 -05:00
Nick Mathewson
a48cb9fa43 core/include.am: spelling fix 2020-01-08 20:50:02 -05:00
Nick Mathewson
4f02812242 It's 2020. Update the copyright dates with "make update-copyright" 2020-01-08 18:39:17 -05:00
Nick Mathewson
2d27a3ecc0 Run "make autostyle"; add an endif comment 2020-01-08 18:38:24 -05:00
teor
a58cffe195
router: Improve port search function comments 2020-01-08 17:47:08 +10:00
Roger Dingledine
81fd8aad24 speaking of utf-8, remove strange char from comment 2020-01-07 18:25:17 -05:00
Nick Mathewson
e231cd5b61 Merge branch 'ticket32845_squashed' 2020-01-07 10:16:15 -05:00
teor
1fd27155d4 changes: file for 32845 2020-01-07 10:16:08 -05:00
teor
0e3fd4df99 string: Check UTF-8 string pointer and length
If they are inconsistent, output a raw bug log.

Part of 32845.
2020-01-07 10:16:08 -05:00
Nick Mathewson
17a1ae025a Merge remote-tracking branch 'tor-github/pr/1640' 2020-01-07 08:59:31 -05:00
Nick Mathewson
c48068ece3 test_helpers: add a missing free for CID 1457527. 2020-01-07 08:22:02 -05:00
Nick Mathewson
f2aeaaf71d Add new state to connection_proxy_state_to_string()
Also, add a CTASSERT() to make sure that we don't let this array get
out-of-sync again.

Found by coverity; this is CID 1457528.
2020-01-07 08:09:27 -05:00
teor
d62dbb6762 string: Add extra UTF-8 test cases
These test cases are validated differently by some
programming languages, because those languages have
incorrect UTF-8 implementations.

We want to make sure that tor validates them correctly.

Closes ticket 32845.
2020-01-07 17:05:48 +10:00
Neel Chauhan
ee015d36f8 Space the a-d unsigned ints in tor_inet_aton() 2020-01-06 20:20:38 -08:00
Nick Mathewson
1b63eea66c Merge branch 'haxxpop/tcp_proxy_squashed' into tcp_proxy_squshed_and_merged 2020-01-06 13:41:20 -05:00
Suphanat Chunhapanya
14d781fff6 circuit: Add change file 2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
4264717ca3 test: HTTP CONNECT protocol 2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
de58a49a2d test: HAPRoxy protocol 2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
41b9dca07b test: Implement haproxy 2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
119004e87d circuit: Implement haproxy 2020-01-06 13:39:10 -05:00
Nick Mathewson
9276c07a91 Merge remote-tracking branch 'tor-github/pr/1615' 2020-01-06 13:32:33 -05:00
Nick Mathewson
e08d07692f Add documentation about building a TAGS file.
Patch from opara.  Closes ticket 32779.
2020-01-06 13:31:30 -05:00
Nick Mathewson
1f498220bd Merge remote-tracking branch 'tor-github/pr/1620' 2020-01-06 13:28:10 -05:00
Nick Mathewson
48f7341783 Merge branch 'maint-0.4.2' 2020-01-06 13:24:01 -05:00