Skip to content

Added more sanitizer tests#1309

Merged
mickem merged 6 commits into
mainfrom
added_more_sanitizer_tests
Jun 5, 2026
Merged

Added more sanitizer tests#1309
mickem merged 6 commits into
mainfrom
added_more_sanitizer_tests

Conversation

@mickem
Copy link
Copy Markdown
Owner

@mickem mickem commented Jun 4, 2026

No description provided.

Signed-off-by: Michael Medin <michael@medin.name>
@mickem mickem force-pushed the added_more_sanitizer_tests branch from 6005f76 to 1ad3453 Compare June 4, 2026 18:01
mickem added 5 commits June 5, 2026 03:29
…ability

Signed-off-by: Michael Medin <michael@medin.name>
…execution

Signed-off-by: Michael Medin <michael@medin.name>
Signed-off-by: Michael Medin <michael@medin.name>
…l functions with sanitizers

Signed-off-by: Michael Medin <michael@medin.name>
Signed-off-by: Michael Medin <michael@medin.name>
@mickem mickem force-pushed the added_more_sanitizer_tests branch from 1ad3453 to 3c83be7 Compare June 5, 2026 02:16
@mickem mickem requested a review from Copilot June 5, 2026 03:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the sanitizer test surface by adding protobuf-free Lua acceptance tests (run via ctest) and by improving the Lua runtime bindings/concurrency so those tests can safely drive in-process module code paths (NRPE/NSCA/Scheduler/etc.) under ASan/UBSan/LSan. It also makes the web backend build behavior more robust by conditionally building nscp_mongoose and providing clearer CMake diagnostics when dependencies are missing.

Changes:

  • Add NSCP_ADD_LUA_TEST() and register multiple lua_*_test ctests guarded by relevant module build flags.
  • Introduce Lua-side acceptance tests plus an updated Lua test harness (test_helper.lua) compatible with Lua 5.4 / current NSClient++ Lua API.
  • Add Lua core bindings (query_target, query_forward) and a process-wide Lua “GIL” to avoid cross-thread lua_State corruption, while releasing it around blocking/re-entrant core calls.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/CMakeLists.txt Guard mongoose wrapper tests behind TARGET nscp_mongoose; register Lua acceptance tests as *_test for sanitizer runs.
scripts/lua/test_uptime.lua New Lua acceptance test for check_uptime timezone/threshold parsing behaviors.
scripts/lua/test_selfcheck.lua Minimal Lua self-check script to validate unit-test harness wiring.
scripts/lua/test_scheduler.lua New Lua acceptance test exercising Scheduler execution + submit path.
scripts/lua/test_nsca.lua New Lua acceptance test for NSCA client/server in-process round trip.
scripts/lua/test_nrpe.lua Replace old protobuf-based NRPE test with protobuf-free query_forward-based round-trip matrix.
scripts/lua/test_nrpe_relay.lua New protobuf-free NRPE relay smoke test using query_target.
scripts/lua/test_log_file.lua New Lua acceptance test for CheckLogFile filter engine and boundary behavior.
scripts/lua/test_ext_script.lua Replace stale content with real CheckExternalScripts acceptance coverage (args/nasty char gating).
scripts/lua/test_checks.lua New minimal CheckHelpers smoke test through simple_query().
scripts/lua/test_check_helpers.lua New broader CheckHelpers integration test suite (aliases, wrappers, multi, negate, timeout).
scripts/lua/lib/test_helper.lua Modernize Lua test helper (no module(...), no require('nscp')), add assertions, return module table.
modules/WEBServer/CMakeLists.txt Fail early with a targeted error if WEBServer is enabled but nscp_mongoose isn’t built.
modules/LUAScript/LUAScript.h Add execute_script() helper declaration.
modules/LUAScript/LUAScript.cpp Fix Lua runtime base path for require(); refactor CLI execution into execute_script().
libs/mongoose-cpp/CMakeLists.txt Skip building nscp_mongoose when backend deps aren’t satisfied; validate backend selection.
libs/lua_nscp/lua_script.cpp Release Lua GIL around blocking core calls; add query_target/query_forward bindings.
libs/lua_nscp/lua_core.cpp Add global Lua GIL and guard Lua entry points; fix submit handler argument counting.
include/scripts/script_nscp.hpp Extend core provider API with targeted query and forward-query support.
include/scripts/script_nscp.cpp Implement targeted simple_query(target,...) and query_forward(...) request building.
include/scripts/script_interface.hpp Add core provider virtuals for targeted query and forward-query.
include/lua/lua_script.hpp Expose query_target and query_forward in the Lua C API surface.
include/lua/lua_core.hpp Define the process-wide Lua GIL guard/release helpers.
CMakeLists.txt Remove unused ALL_LIB_NAMES accumulation.
build/cmake/functions.cmake Add NSCP_ADD_LUA_TEST() helper to register Lua acceptance tests under sanitizer env.
build/cmake/dependencies.cmake Make web backend dependency detection non-fatal; gate extra Boost components on availability.
build.md Document that sanitizer runs include Lua acceptance tests and exclude Python tests due to ASan incompatibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/lua/test_selfcheck.lua
Comment thread scripts/lua/test_selfcheck.lua
Comment thread scripts/lua/test_log_file.lua
@mickem mickem merged commit d6ac83d into main Jun 5, 2026
29 checks passed
@mickem mickem deleted the added_more_sanitizer_tests branch June 5, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants