-
-
Notifications
You must be signed in to change notification settings - Fork 349
Using NIT (NUT Integration Test suite) sandbox
As with any other well-behaved code base, when building NUT from source, it is possible to make check
the program and resource files (e.g. documentation).
One special feature of NUT v2.8.x is that you can make check-NIT
to run the NUT Integration Tests with upsd
talking to some dummy-ups
instances and different scenarios such as about having and not having configuration files, as well as testing the Python/C++/etc. client implementations (if enabled). This is the same scenario that NUT CI farm runs on various platforms to detect significant regressions in core code/behaviors, as well as to help with porting NUT to new OS platforms and tool sets.
Notably, the NIT suite would run your freshly built NUT programs (right from the build workspace) with a dedicated temporary configuration and state directory, and communicate on a random TCP/IP port, so should not conflict with the normally running NUT daemons which monitor your actual UPS.
With make check-NIT-sandbox
you can further prepare an environment to run other built NUT programs against these upsd + dummy-ups
, or to edit the generated config files in tests/NIT/tmp/etc/
directory and e.g. test a freshly built drivers/usbhid-ups
program. The sandbox initialization will log some progress and ultimately suggest you to source
a generated NIT.env
file with environment variables for the random $NUT_PORT
, NUT user names and passwords, configuration paths and stuff, etc. into your current shell.
- NOTE: Currently for NUT client programs, including
nut-scanner
anddummy-ups
, you would have to alsoexport LD_LIBRARY_PATH_CLIENT="${TOP_BUILDDIR}/clients:${TOP_BUILDDIR}/clients/.libs"
with your definition ofTOP_BUILDDIR
, to use the freshly builtlibupsclient.so
file and not the system-installed one.
Note that depending on tooling, your actual libraries and programs may be in .libs
sub-directories, so e.g. drivers/.libs/usbhid-ups
and the filenames near the sources being GNU libtool wrappers to set up paths and debugging. For tracing or gdb
stepping, you need the actual binaries (and manually reproduce the path setup that libtool does).
- it might work or not to try forking support (so the debugger does start the wrapper script and then does see the actual NUT program) - I did not have much success in that generally.
Welcome to the Network UPS Tools (NUT) project Wiki, and feel free to contribute tricks and insights.
While there are several good entries in the menu, ones referenced most frequently in issue discussions include:
- Building NUT for in-place upgrades or non-disruptive tests and Using NIT (NUT Integration Test suite) sandbox
- Technicalities: Customizing (NUT) config files and scripts delivered by packaging
- Links to distribution packaging recipes and repository sections
- Troubleshooting
upsdrvctl
drivers not starting ("insufficient permissions on everything") possibly due to nut-driver-enumerator (NDE) services having been there before you with NUT 2.8.x - Changing NUT daemon debug verbosity
- Building NUT integration for Home Assistant
- Running NUT in an LXC container
- Troubleshooting eventual disconnections (Data stale) and CyberPower Systems (CPS) know-how
- NUT for Windows
- NUT HCL and DDL
- Code contributions, PRs, PGP and DCO
- NUT CI farm
Also keep in mind the documentation links from NUT website and the FAQ in particular.