-
-
Notifications
You must be signed in to change notification settings - Fork 413
Enable build of libconf/nutconf features by default #2290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jimklimov
merged 247 commits into
networkupstools:master
from
jimklimov:libconf-nutconf-enable-build
Feb 15, 2024
Merged
Enable build of libconf/nutconf features by default #2290
jimklimov
merged 247 commits into
networkupstools:master
from
jimklimov:libconf-nutconf-enable-build
Feb 15, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just parse tokens.
Rename NutConfParser in NutParser. Implement the abstract class NutConfParser based on NutParser for configuration file parsing. Remove old C sample code.
Add stubs for the default configuration file parser. Basic implementation will follow.
…w specialized versions of config class.
Add UT for GenericConfiguration (validate GenericConfigParser and all the stack). Fix some errors found with UT.
Test pending. A bug is pending: IPv6 format must be in quoted string because of ':'.
Add parsing option to NutParser. Add a first option OPTION_IGNORE_COLON to parse ':' as a normal character and not as token. Use it to allow parsing "::1" IPv6-like as string without having to quote them (upsd.conf).
nut::NutMemory (memory-based stream) nut::NutFile (file-stream) nut::NutSocket with nut::NutSocket::Address (UNIX domain, IPv4, IPv6)
Basic unit tests plus a few minor changes and updates to the code
General serialisers implemented Several TBDs and TODOs left for review tbc...
Getters/setters for all UPS config. attributes added The getters/setters need further checking for type correctness Generic support for the above implemented in GenericConfiguration class
The special serialiser is needed because of the [upsmon]::upsmon directive (which doesn't use the standard = key/ value separator). Also, serialisation of section entry value list was fixed (so that multiple entries are produced rather than a list of values).
All existing NUT configuration classes now implement Serialisable interface (parseFrom and writeTo methods). Note that the parseFrom implementations are very naive (they simply read whole source stream to memory and call existing parseFromString method). That's enough for now, however, in future the parsres should directly use NutStream interface.
UTs with focus on basic configuration settings and serialisation were added for nut.conf, upsmon.conf, upsd.conf ups.conf and upsd.users. Note that the tests are not exhaustive; they only parse configuration files samples, change a few randomly selected parameters, serialise the result back and check it.
A non-complete implementation of NUT IPC support module. Certain functions are just outlined, for now. Deals with signal handling and execution of external commands. I commit this partial implementation because I'll be on holiday for certain amount of time and it's IMO better to have the code comitted.
e616f15 to
b833cc0
Compare
…II char variants of Windows path related methods Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…nt to maybe call later Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…y default Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
… both POSIX and WIN32 code Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…_dir and filename (if known) in theexception (so far WIN32 code path) Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
❌ Build nut 2.8.1.1418-master failed (commit 1bef019865 by @jimklimov) |
…ngw builds Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
❌ Build nut 2.8.1.1420-master failed (commit 9b6dbc5223 by @jimklimov) |
… listen_sock.bind() a few times; freeze/thaw the writer PID Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…larly on WIN32 Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…s writeable by WIN32 system methods (e.g. not mangled by mingw/msys) Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ch was problematic Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…T directly on Windows agents Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…nable-build Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
❌ Build nut 2.8.1.1423-master failed (commit 2dd58331f6 by @jimklimov) |
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…se of access() check Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…path concerns Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…WIN32 (absolute) path concerns Copied from tests, but would hopefully evaporate there eventually as that particular acute issue gets resolved. Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…pe them! Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
❌ Build nut 2.8.1.1426-master failed (commit 5d21df6074 by @jimklimov) |
…onfig file parsing tests Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
✅ Build nut 2.8.1.1427-master completed (commit 0d2c08e8b0 by @jimklimov) |
34 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature
nutconf
NUT configuration library and tool
portability
We want NUT to build and run everywhere possible
refactor/fightwarn
PR or issue proposal to improve code maintainability without functional changes, or to fix warnings
Windows
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #2283 which aims to enable builds (and tests) of
(lib)nutconfcodebase by default (where C++11 is available, optionally CPPUNIT to test the results).This iteration softens some rough edges for WIN32 codebase, and for (way too many) other complications it just disables parts of the originally POSIX-oriented implementation that would need to be remade for Windows (got quite a few precedents for named pipe use instead of Unix sockets and signals in other NUT programs).
Closes: #2295 along the way
By side effect (from making CI pass), this PR also fixes CI builds with standards other than C11/C++11 (requests were there... typos in scripting also...), and NUT Integration Tests (NIT) detection of available ports for
upsdto listen on.