Commit Graph

4193 Commits

Author SHA1 Message Date
Nick Mathewson a3e99c5f1e Add a test for clear_fn support in handling non-managed fields 2019-08-28 09:42:17 -04:00
Nick Mathewson c967b5c9ba Add a test for dumping a compound configuration 2019-08-28 09:42:17 -04:00
Nick Mathewson 8db3859cc6 Simple tests for nested configuration formats
One test makes sure that the toplevel magic numbers are distinct.

One test makes sure that we can parse a configuration object
with two sub-objects.
2019-08-28 09:42:17 -04:00
Nick Mathewson d9fe9f5ede Confmgr tests: test deprecations and abbreviations. 2019-08-28 09:42:17 -04:00
Nick Mathewson e4162cdb38 Start on test cases for the multi-object feature of confmgr.
This test case, at this point, only constructs the confmgr object.
More code to come.
2019-08-28 09:42:17 -04:00
Nick Mathewson cb5f8ace79 Tests for config_find_option_name()
Fix a bug in config_find_option_name() where it did not consider
the abbreviations table.
2019-08-28 09:42:17 -04:00
Nick Mathewson aa3f0c4788 Add tests for variable-listing functions.
This discovered a bug related to an extra & in
config_mgr_list_deprecated_vars(): fix that.
2019-08-28 09:42:17 -04:00
Nick Mathewson 38b770bbbb Make a config_suite_t type to hold multiple config sub-objects
Right now, it doesn't do anything; this patch is meant to make sure
that we're doing memory management correctly.
2019-08-28 09:40:53 -04:00
Nick Mathewson 47654d3249 Refactor config free logic to use a single path.
The right way to free a config object is now to wrap config_free(),
always.  Instead of creating an alternative free function, objects
should provide an alternative clear callback to free any fields that
the configuration manager doesn't manage.

This lets us simplify our code a little, and lets us extend the
confparse.c code to manage additional fields in config_free.
2019-08-28 09:40:53 -04:00
Nick Mathewson 3d1f9f583a Use special magic to enforce manager/object connection.
Every time we finalize a config manager, we now generate a new magic
number for it, so that we'll get an assertion failure if we ever try
to use an object with a different configuration manager than the one
that generated it.
2019-08-28 09:40:46 -04:00
Nick Mathewson 57e87cc86c Use config_new() to construct configuration objects.
We'll need to do it this way once the objects become more complex.
2019-07-24 15:21:56 -04:00
Nick Mathewson a1b2817abe Sort variables in config_mgr_t.all_vars alphabetically 2019-07-24 15:21:56 -04:00
Nick Mathewson dde091ebc7 Add a "freeze" function for config_mgr_t objects.
It's important to make sure that we don't change a config_mgr_t
after we start using it to make objects, or we could get into
inconsistent states.  This feature is the start of a safety
mechanism to prevent this problem.
2019-07-24 15:21:56 -04:00
Nick Mathewson e8dc513bd0 Add a config_mgr_t type to wrap config_format_t
Remember that our goal in the present refactoring is to allow each
subsystem to declare its own configuration structure and
variables.  To do this, each module will get its own
config_format_t, and so we'll want a different structure that wraps
several config_format_t objects.  This is a "config_mgr_t".
2019-07-24 15:21:56 -04:00
Nick Mathewson f8b193a74a Make config_var and config_fmt const.
Now that we have a reasonable implementation for overriding the
default options for TestingTorNetwork, we don't need to modify
config_var_t structs any more.  And therefore, we can have constant
format options, like reasonable people.
2019-07-24 15:21:56 -04:00
Nick Mathewson b6457d4c08 Extend macros to allow flag arguments. 2019-06-25 12:51:25 -04:00
Nick Mathewson 5b252d31ed Add a "flags" member to config_var_t
Additionally, adjust the macros so that we can add new members like
this more easily.
2019-06-25 12:51:25 -04:00
Nick Mathewson c553750e32 Move responsibility for config var macros
The testing-only parts now live in a conftesting.h; the shared parts
of the macros live in confmacros.h
2019-06-25 12:51:25 -04:00
Nick Mathewson c390efe84f A few more test cases and unreachable lines 2019-06-25 12:51:25 -04:00
Nick Mathewson 59317c8a23 Use struct_magic_decl to verify magic numbers in config objects 2019-06-25 12:51:25 -04:00
Nick Mathewson 3a4d67cf45 Port confparse to use struct_var in place of typed_var.
This requires changes to config_var_t, causing corresponding changes
throughout its users.
2019-06-25 12:51:25 -04:00
Nick Mathewson 705bda859e Add unit tests for the unitparse.c module. 2019-06-24 17:50:43 -04:00
Nick Mathewson c60a85d22a Add a "typed_var" abstraction to implement lvalue access in C.
Right now, this has been done at a high level by confparse.c, but it
makes more sense to lower it.

This API is radically un-typesafe as it stands; we'll be wrapping it
in a safer API as we do #30914 and lower the struct manipulation
code as well.

Closes ticket 30864.
2019-06-24 17:50:43 -04:00
David Goulet e6579d801f Merge branch 'tor-github/pr/1113' 2019-06-19 07:47:03 -04:00
Nick Mathewson 26436fb1b6 Add more unit tests for confparse.c, so we can refactor.
This set of tests gets the line coverage to 100%.
2019-06-15 16:49:18 -04:00
George Kadianakis 319ce22581 Merge branch 'bug30806' 2019-06-14 13:28:32 +03:00
Nick Mathewson 990b434c4f Make evloop into a subsystem.
Note that the event base object is _not_ created from the initialize
function, since it is configuration-dependent.  This will wait until
configuration is integrated into subsystems.

Closes ticket 30806.
2019-06-14 13:28:10 +03:00
George Kadianakis 96fade0a7d Merge branch 'tor-github/pr/1088' 2019-06-12 13:01:53 +03:00
David Goulet f7e8b3b68c Merge branch 'tor-github/pr/1040' 2019-06-11 11:59:39 -04:00
Taylor Yu 0bce0c339d Rework origin circuit tracking to use pubsub
Part of ticket 29976.
2019-06-11 11:59:30 -04:00
Taylor Yu a8c0f4ddfe Rework orconn tracking to use pubsub
Part of ticket 29976.
2019-06-11 11:59:30 -04:00
David Goulet 8e112cecd8 Merge branch 'tor-github/pr/1031' 2019-06-11 11:46:38 -04:00
George Kadianakis 646f7a9a94 Merge branch 'ticket30687_042_01' 2019-06-11 14:02:33 +03:00
David Goulet 7cf9d54e6d token-bucket: Implement a single counter object
Closes #30687.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-06-11 14:02:22 +03:00
George Kadianakis eab9dc06af Merge branch 'tor-github/pr/1065' into maint-0.4.1 2019-06-11 13:48:10 +03:00
Nick Mathewson 6a72cc2598 Merge branch 'maint-0.4.0' into maint-0.4.1 2019-06-10 18:33:26 -04:00
teor b9041e8a63 test: fix a typo in test_rebind.sh
Closes 30821.
2019-06-10 20:56:40 +10:00
teor 430dd2da6e Merge branch 'bug30713_035' into bug30713_040 2019-06-10 20:50:53 +10:00
teor be0a4be276 Travis: Skip test_rebind on macOS builds
Skip test_rebind when the TOR_SKIP_TEST_REBIND environmental variable
is set.

Skip test_rebind on macOS in Travis builds, because it is unreliable
on macOS on Travis.

Fixes bug 30713; bugfix on 0.3.5.1-alpha.
2019-06-10 20:49:59 +10:00
Nick Mathewson c46e99c43c Tolerate net-unreachable failures in util/socketpair_ersatz
This can happen when we have no network stack configured. Fixes bug
30804; bugfix on 0.2.5.1-alpha.
2019-06-07 13:52:03 -04:00
Nick Mathewson 2300a619a5 Merge remote-tracking branch 'tor-github/pr/1039' into maint-0.4.0 2019-06-05 16:13:53 -04:00
Mike Perry a42131bf48 Revert "test: Add test_hs_circ.c for HS circuit testing"
This reverts commit 41b94722e5.
2019-06-05 11:37:32 -07:00
Nick Mathewson 60213a3621 Run "make autostyle." 2019-06-05 09:33:35 -04:00
Nick Mathewson b39a8d315d Merge remote-tracking branch 'tor-github/pr/1053' 2019-06-05 09:04:09 -04:00
David Goulet 41b94722e5 test: Add test_hs_circ.c for HS circuit testing
For now, only tests HS circuit repurpose function.

Part of #29034

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-05-31 10:43:01 -04:00
Nick Mathewson 3c3158f182 Fix some tests for CL_PORT_NO_STREAM_OPTIONS
The comment in the tests was correct: this option _was_ inverted wrt
SessionGroup=.
2019-05-31 09:03:20 -04:00
George Kadianakis d8bd98b2fd Merge branch 'tor-github/pr/1032' 2019-05-29 21:28:04 +03:00
George Kadianakis 650bdca97f Merge branch 'maint-0.4.0' 2019-05-29 21:20:02 +03:00
George Kadianakis 00108b75d4 Merge branch 'tor-github/pr/924' into maint-0.4.0 2019-05-29 21:19:56 +03:00
David Goulet ff9aa32143 Merge branch 'tor-github/pr/1047' 2019-05-28 14:59:07 -04:00