Commit Graph

34383 Commits

Author SHA1 Message Date
George Kadianakis 5ec751b38b Merge branch 'tor-github/pr/1324' 2019-09-16 15:21:28 +03:00
George Kadianakis a1192b6b4a Merge branch 'tor-github/pr/1273' 2019-09-16 15:20:25 +03:00
George Kadianakis bdd17da9fd Merge branch 'tor-github/pr/1318' 2019-09-16 15:19:38 +03:00
Nick Mathewson 11cf4d9c3a test_parseconf.sh: On --dump-config failure, --verify-config 2019-09-14 19:00:41 -04:00
Nick Mathewson 7e9ee3a58d Add a test with many non-default options. 2019-09-14 19:00:41 -04:00
Nick Mathewson 617679df42 Add a few error test cases 2019-09-14 19:00:41 -04:00
Nick Mathewson 80e858e3e6 Add an integration test for %include. 2019-09-14 19:00:41 -04:00
Nick Mathewson 28025698a1 test_parseconf: run each test from inside its directory.
We need this to test includes and relative paths.
2019-09-14 19:00:41 -04:00
Nick Mathewson 98ab3817a8 Add a changes file for ticket 31637. 2019-09-14 19:00:41 -04:00
Nick Mathewson 850a00dc07 Add test for +Option, /Option, and Option
Here we use these directives to replace, extend, or clear values in
torrc.defaults and in torrc.
2019-09-14 19:00:41 -04:00
Nick Mathewson 2f7be9620b Move our first 3 example conf_examples to named directories
I'm not planning to use "example" as the name for all of them, but
these first three _are_ simple examples.
2019-09-14 19:00:41 -04:00
Nick Mathewson 7c7e8402b5 Add a test script to try parsing and encoding Tor configurations
This script takes a set of example torrcs and command-lines from
src/test/conf_examples.  If a success is expected, it runs "tor
--dump-config" and compares the result with the one we expect.  If a
failure is expected, it runs "tor --verify-config" and greps for the
error we expect.
2019-09-14 19:00:41 -04:00
Nick Mathewson bfc5f09979 Detect overflow or underflow on double config values.
Any floating point value too positive or negative to distinguish
from +/-Inf, or too small to distinguish from +/-0, is an
over/underflow.
2019-09-13 18:26:16 -04:00
David Goulet 286b129b09 Merge branch 'tor-github/pr/1319' 2019-09-12 13:53:59 -04:00
David Goulet c39c9ce26b Merge branch 'tor-github/pr/1285' 2019-09-12 13:47:09 -04:00
George Kadianakis 028733e8b6 Merge branch 'tor-github/pr/1303' 2019-09-12 18:09:35 +03:00
George Kadianakis 3aaa4d416b Merge branch 'tor-github/pr/1299' 2019-09-12 18:08:00 +03:00
Nick Mathewson c3b1a25d46 Workaround for GCC "note" about "variable tracking size limit"
GCC complains that we are using too many variables here, probably
because of the sheer number of locals used for our tinytest macros.
Eventually we should fix that (see 30968), but this commit just
makes the "note" go away by splitting the test function into two.
2019-09-12 18:07:47 +03:00
Nick Mathewson 261ec900db Remove variable declarations from macros in test_addr_parse()
Instead, put them in the function itself.

This is an attempt to fix the gcc warning about the "variable
tracking size limit exceeded".
2019-09-12 18:07:47 +03:00
Nick Mathewson 34bab120df Ticket 31687: fix for tor_isinf() as well
tor_isinf() was new in 0.4.0, and also needs to look at the
same rules as clamp_double_to_i64()
2019-09-12 09:53:13 -04:00
Nick Mathewson 0327f9a075 Merge branch 'ticket31687_035' into ticket31687_040 2019-09-12 09:51:04 -04:00
Nick Mathewson 87944cecfc Merge remote-tracking branch 'tor-github/pr/1300' 2019-09-12 08:50:09 -04:00
Nick Mathewson a2bd93456f Changes file for coccinelle scripts 2019-09-11 18:50:43 -04:00
Nick Mathewson ded6d9fcb4 Run test_operator_cleanup on our unit tests
Coccinelle doesn't understand it when we use "==" and "!=" and so on as
arguments to macros.  To solve this, we prefer OP_EQ, OP_NE, and so
on.

This commit is automatically generated by running
./scripts/coccinelle/test_operator_cleanup over all of the source
code in src.
2019-09-11 18:47:19 -04:00
Nick Mathewson 25ed698fb8 Add some more of our trickier macros to tor-coccinelle.h
Note that this header file behaves a bit strangely.  It is used by
coccinelle just for the purpose of knowing how to parse
difficult-to-parse stuff.  It doesn't need to produce good C -- just
grammatical C.
2019-09-11 18:45:52 -04:00
Nick Mathewson c6191983e9 Add a script to tell whether a file can be perfectly parsed by spatch
spatch can let us know whether a file has parsed "perfectly" or
not.  The more perfect it parses, the likelier any semantic patches
are to apply.  I've used this script to identify problem areas in
our code.
2019-09-11 18:44:10 -04:00
Nick Mathewson 9a101c2c0f Add a script to run spatch with appropriate arguments
It's a bit tricky to remember the right incantation to get the
proper include paths and incantations for coccinelle, but without
it, coccinelle is less effective at parsing our C.
2019-09-11 18:43:16 -04:00
Nick Mathewson c7cbe64463 Changes file for ticket31626 (confparse.[ch] move) 2019-09-11 10:25:27 -04:00
Nick Mathewson ae6e60281c Update include.am files to refer to new location of confparse.[ch]
Tests should now pass again.
2019-09-11 10:22:01 -04:00
Nick Mathewson a90d1918af Update #includes to point to confparse.h in its new location.
This commit was automatically generated by running
scripts/maint/rectify_include_paths.py .
2019-09-11 10:17:20 -04:00
Nick Mathewson 87ca9e4d2a Move confparse.[ch] into src/lib/confmgt/
This commit only does code movement, and does not clean up after
itself.  As such, it will break compilation.  I'm separating it for
ease of review.
2019-09-11 10:16:10 -04:00
Nick Mathewson bf8c3164b6 Add new entries to lib/confmgt ".may_include" file
confparse.[ch] will need these; checkIncludes confirms that we have
not introduced a cycle.
2019-09-11 10:13:57 -04:00
David Goulet 41261c3b5c Merge branch 'tor-github/pr/1296' 2019-09-11 09:42:31 -04:00
Nick Mathewson 478141e617 Document inconsistent usage of config_var_is_listable()
See also ticket 31654.
2019-09-11 09:42:19 -04:00
Nick Mathewson e61bfd0bfd Extract common list of flags to use for obsolete variables. 2019-09-11 09:42:19 -04:00
Nick Mathewson fe5033d3b0 Clarify documentation on config_var_is_listable()
Here we make it clear we're only looking at listable variable names,
not at whether the variables themselves are gettable.

Also, remove an extraneous h.

(This commit is not a fixup, because of rebase conflicts.)
2019-09-11 09:42:19 -04:00
Nick Mathewson 14f48cb083 Add test_cmdline.sh to distribution. 2019-09-11 09:42:19 -04:00
Nick Mathewson 7a8ea0d3c3 integration test for --list-torrc-options
(This option tests our existing behavior, not necessarily the most
sensible behavior.)
2019-09-11 09:42:19 -04:00
Nick Mathewson 5ffe6ec0e3 Test: Make sure NOLIST options are not listed. 2019-09-11 09:42:19 -04:00
Nick Mathewson d545fe1992 Changes file for 31625 (config flag refactor) 2019-09-11 09:42:19 -04:00
Nick Mathewson bbd40e690e Revise documentation on CFLG_* flags 2019-09-11 09:42:19 -04:00
Nick Mathewson 0d6d96396c Remove all CVFLAG_* usage. 2019-09-11 09:42:19 -04:00
Nick Mathewson 5ca5d196ac Remove all VTFLAG_* usage. 2019-09-11 09:42:19 -04:00
Nick Mathewson 9b571d4729 confparse, conftypes: Replace flags with their new names.
The old names remain as #defines that cause variables to get one or
more flags.

Now every flag-testing function in confparse.c tests exactly one flag.
2019-09-11 09:42:19 -04:00
Nick Mathewson 1b3b6d9f2d Replace low-level {var_type,struct_var}_is_*() with flag inspection
Since the flags are now stored with compatible numbering, we can
just OR them together and see whether the flag we want is in the
result.

(Net code removal!)
2019-09-11 09:42:19 -04:00
Nick Mathewson 4b92f4c83a Re-number VTFLAG_* values so they don't conflict with CVFLAG_* 2019-09-11 09:42:19 -04:00
Nick Mathewson c650ab8061 Move VTFLAG_* declarations to conftypes.h 2019-09-11 09:42:19 -04:00
Nick Mathewson 03e4183043 typed_var: Make flags into an unsigned OR of bits.
Using a bitfield here will enable us to unify the var_type_def_t flags
with the config_var_t flags.

(This commit does not yet do that unification, and does not yet
rename or refactor any flags.  It only changes booleans into bits.)
2019-09-11 09:42:19 -04:00
Nick Mathewson 4f6b592691 struct_var: refactor struct_var_is*() functions to delegate
Previously they checked the individual flags inside var_type_def_t;
now they call the appropriate var_type_is_*() functions.

(These functions will be removed entirely by the end of this branch.)
2019-09-11 09:42:19 -04:00
Nick Mathewson 7171ce2a2a config: make config_var_is_dumpable static. 2019-09-11 09:42:19 -04:00