aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_confparse.c
AgeCommit message (Collapse)Author
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-11-11Merge remote-tracking branch 'tor-github/pr/1338'Nick Mathewson
2019-11-07Stop using "config_suite_offset=-1" to indicate "no config suite."Nick Mathewson
Instead, create a separate "has_config_suite" boolean, so that only top-level formats with config_suites need to declare an offset at all.
2019-10-28Check memunit parsing for overflow in confparseJosé M. Guisado
Before, when parsing memunits, if overflow occured it failed silently. Use nowrap u64 math to detect overflow, compare to INT64_MAX and if greater tell user and fail accordingly. 15000000.5 TB fails double check as it a greater floating number than (double)INT64_MAX 8388608.1 TB passes double check because it falls in the same value as (double)INT64_MAX (which is 2^63), but will fail the int check because (uint64_t)d, which is 2^63, is strictly greater than 2^63-1 (INT64_MAX). Fixes #30920 Signed-off-by: José M. Guisado <guigom@riseup.net>
2019-10-26Rename confparse.[ch] identifiers to confmgt.[ch] identifiers.Nick Mathewson
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ confparse.h confmgt.h \ confparse.c confmgt.c \ CONFPARSE_PRIVATE CONFMGT_PRIVATE \ TOR_CONFPARSE_H TOR_CONFMGT_H
2019-10-24Rename validate_fn{,_t} to start with "legacy_".Nick Mathewson
The current API of this callback mixes responsibilities, including: * validation * transition checking * processing (modifying) the configuration object. These will have to be disentangled piece by piece, so for now, we'll have "legacy" validate functions as well. This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ validate_fn_t legacy_validate_fn_t \ validate_fn legacy_validate_fn
2019-10-24Use named-member syntax for initializing config_format_t objectsNick Mathewson
I'm about to mess with their lists of callbacks, and I don't want to proliferate lists where we say "NULL, NULL, NULL, ..."
2019-10-24Merge remote-tracking branch 'tor-github/pr/1447'teor
2019-10-22config validation: make the "old_options" argument const.Nick Mathewson
We can't do this with the "options" argument yet, since several places in the code change those right now.
2019-10-22validate_fn(): remove now-unused defaults and from_setconf.Nick Mathewson
These arguments were only used by options_validate, and are now ignored even there.
2019-10-22Re-run make autostyle.Nick Mathewson
2019-10-22Merge branch 'ticket31705_v2' into ticket31705_v2_mergedNick Mathewson
Conflicts: src/feature/dirparse/authcert_parse.c src/feature/dirparse/ns_parse.c src/feature/hs/hs_service.c src/lib/conf/conftesting.h src/lib/log/log.h src/lib/thread/threads.h src/test/test_options.c These conflicts were mostly related to autostyle improvements, with one or two due to doxygen fixes.
2019-10-22test: Hide some test-declaration macro definitions to COCCI.Nick Mathewson
(These ones cause parsing failures.)
2019-09-16Merge branch 'tor-github/pr/1316'George Kadianakis
2019-09-13Detect overflow or underflow on double config values.Nick Mathewson
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-11Update #includes to point to confparse.h in its new location.Nick Mathewson
This commit was automatically generated by running scripts/maint/rectify_include_paths.py .
2019-09-10Use strtod, not atof, for parsing doubles in the configuration.Nick Mathewson
This lets us detect erroneous doubles, which previously we could not do. Fixes bug 31475; bugfix on commit 00a9e3732e88, a.k.a svn:r136.
2019-09-04Update routerset reset test to use new mgr API.Nick Mathewson
2019-09-04Merge branch 'ticket31240v2_merged_2' into ticket31240v2_merged_2_mergedNick Mathewson
2019-08-28test_confparse: verify that clearing a routerset sets it to NULL.Nick Mathewson
2019-08-28Tests for config_find_option_name()Nick Mathewson
Fix a bug in config_find_option_name() where it did not consider the abbreviations table.
2019-08-28Add tests for variable-listing functions.Nick Mathewson
This discovered a bug related to an extra & in config_mgr_list_deprecated_vars(): fix that.
2019-08-28Make a config_suite_t type to hold multiple config sub-objectsNick Mathewson
Right now, it doesn't do anything; this patch is meant to make sure that we're doing memory management correctly.
2019-08-28Refactor config free logic to use a single path.Nick Mathewson
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-28Use special magic to enforce manager/object connection.Nick Mathewson
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-07-24Sort variables in config_mgr_t.all_vars alphabeticallyNick Mathewson
2019-07-24Make config_var and config_fmt const.Nick Mathewson
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-24Add a "freeze" function for config_mgr_t objects.Nick Mathewson
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-24Add a config_mgr_t type to wrap config_format_tNick Mathewson
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-06-25Extend macros to allow flag arguments.Nick Mathewson
2019-06-25Add a "flags" member to config_var_tNick Mathewson
Additionally, adjust the macros so that we can add new members like this more easily.
2019-06-25Move responsibility for config var macrosNick Mathewson
The testing-only parts now live in a conftesting.h; the shared parts of the macros live in confmacros.h
2019-06-25A few more test cases and unreachable linesNick Mathewson
2019-06-25Use struct_magic_decl to verify magic numbers in config objectsNick Mathewson
2019-06-25Port confparse to use struct_var in place of typed_var.Nick Mathewson
This requires changes to config_var_t, causing corresponding changes throughout its users.
2019-06-24Add unit tests for the unitparse.c module.Nick Mathewson
2019-06-24Add a "typed_var" abstraction to implement lvalue access in C.Nick Mathewson
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-15Add more unit tests for confparse.c, so we can refactor.Nick Mathewson
This set of tests gets the line coverage to 100%.