mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-01-09 00:50:17 +00:00
b10348c576
Instead of unconditionally attempting to clone from a fixed location (GitHub) during the build / test process, honor the following two configuration variables: TOML11_LANGSPEC_GIT_REPOSITORY Can be set to override the URL from which the repository is cloned. This allows using a local mirror, including file:// URLs for working offline or reducing network traffic. TOML11_LANGSPEC_SOURCE_DIR Can be set to configure the location at which the repository is expected. If it already exists no download will be attempted. This allows avoiding the additional git-clone(1) altogether and use an existing directory as-is. This offers two new possibilities: (1) The same checkout can be reused for building multiple configurations (e.g. Debug versus Release) saving a little bit of time and disk space. (2) Experimental changes can easily be applied to the local source tree without having them destroyed by the build process. In order for this flexible location to work, the unit tests which attempt to read files from the repository had to be adjusted. They now honor an environment variable TOMLDIR which can be set to point to an alternate root directory. All defaults are set such that the previous behavior is maintained. Instead of introducing the TOMLDIR environment variable, an alternative solution would have been to set the WORKING_DIRECTORY of the tests to the TOML11_LANGSPEC_SOURCE_DIR and leave the relative paths in these tests hard-coded. Alas, some tests also expect that they can /write/ into the current working directory which isn't desirable if it is potentially pointing outside the build tree. I personally prefer to mount the source directory read-only and build in a fast tempfs, so this would e a problem. To be perfectly honest, I don't quite understand why these tests need to write to the file system in the first place, though. It seems to me that refactoring them to serialize to a std::ostrstream instead of a std::ofstream would not only simplify but also speed up the unit tests and avoid file system problems. But there might have been a hidden reason why actually using the real file system was considered necessary for these tests, so I didn't went ahead with that change yet. |
||
---|---|---|
.. | ||
check_serialization.cpp | ||
check_toml_test.cpp | ||
check.cpp | ||
CMakeLists.txt | ||
test_comments.cpp | ||
test_datetime.cpp | ||
test_error_detection.cpp | ||
test_expect.cpp | ||
test_extended_conversions.cpp | ||
test_find_or_recursive.cpp | ||
test_find_or.cpp | ||
test_find.cpp | ||
test_format_error.cpp | ||
test_get_or.cpp | ||
test_get.cpp | ||
test_lex_aux.hpp | ||
test_lex_boolean.cpp | ||
test_lex_datetime.cpp | ||
test_lex_floating.cpp | ||
test_lex_integer.cpp | ||
test_lex_key_comment.cpp | ||
test_lex_string.cpp | ||
test_literals.cpp | ||
test_multiple_translation_unit_1.cpp | ||
test_multiple_translation_unit_2.cpp | ||
test_parse_array.cpp | ||
test_parse_aux.hpp | ||
test_parse_boolean.cpp | ||
test_parse_datetime.cpp | ||
test_parse_file.cpp | ||
test_parse_floating.cpp | ||
test_parse_inline_table.cpp | ||
test_parse_integer.cpp | ||
test_parse_key.cpp | ||
test_parse_string.cpp | ||
test_parse_table_key.cpp | ||
test_parse_table.cpp | ||
test_parse_unicode.cpp | ||
test_result.cpp | ||
test_serialize_file.cpp | ||
test_string.cpp | ||
test_traits.cpp | ||
test_utility.cpp | ||
test_value.cpp | ||
test_windows.cpp |