Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 4 additions & 73 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,79 +75,14 @@ jobs:
-DENABLE_MQTT=OFF \
-DCMAKE_C_FLAGS="--coverage -fprofile-update=atomic" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
make -j$(nproc) \
test_storage_pressure \
test_storage_pressure_extended \
test_detection_result_structures \
test_stream_frame_rate \
test_recording_video_params \
test_mp4_segment_boundaries \
test_storage_retention_sqlite \
test_storage_manager_retention \
test_storage_target_pressure_cleanup \
test_storage_migration \
test_storage_archive \
test_authorization \
test_api_handlers_recordings_playback \
test_db_storage_targets \
test_db_storage_policies \
test_api_handlers_storage_targets \
test_api_handlers_storage_policies \
test_sqlite_migration_boundaries \
test_config \
test_logger \
test_strings \
test_memory \
test_request_response \
test_shutdown_coordinator \
test_system_health_startup \
test_detection_config \
test_detection_model_motion \
test_db_streams \
test_db_camera_favorites \
test_api_handlers_camera_favorites \
test_db_backup \
test_mp4_failed_open_memory \
test_db_recordings_extended \
test_db_detections \
test_db_zones \
test_db_events \
test_db_auth \
test_db_transactions \
test_db_maintenance \
test_db_query_builder \
test_logger_json \
test_batch_delete_progress \
test_db_recordings_sync \
test_httpd_utils \
test_zone_filter \
test_onvif_soap_fault \
test_faac_encoder \
test_audio_transcoder \
test_mp4_audio_recovery \
test_mp4_forced_reconnect \
test_mp4_recovery_watchdog \
test_audio_voice_enhancement \
test_audio_voice_filter_faults \
test_udt_recording \
test_detection_current_frame \
test_detection_io_recovery \
test_hls_cleanup \
test_stream_manager \
test_stream_state \
test_packet_buffer \
test_timestamp_manager \
test_motion_trigger_parse \
test_motion_max_area \
test_url_utils
cmake --build . --parallel "$(nproc)" --target ci-unit-tests
echo "Unity test binaries built:"
ls -la bin/test_*

- name: Run Unity tests
run: |
cd build
ctest --output-on-failure -V \
-R "test_sqlite_migration_boundaries|test_storage_pressure$|test_storage_pressure_extended|test_detection_result_structures|test_stream_frame_rate|test_recording_video_params|test_mp4_segment_boundaries|test_storage_retention_sqlite|test_storage_manager_retention|test_storage_target_pressure_cleanup|test_storage_migration|test_storage_archive_s3|test_storage_archive_operator|test_authorization|test_api_handlers_recordings_playback|test_db_storage_targets|test_db_storage_policies|test_api_handlers_storage_targets|test_api_handlers_storage_policies|test_config|test_logger|test_strings|test_memory|test_request_response|test_shutdown_coordinator|test_detection_config|test_detection_model_motion|test_db_streams|test_db_camera_favorites|test_api_handlers_camera_favorites|test_db_backup|test_mp4_failed_open_memory|test_db_recordings_extended|test_db_detections|test_db_zones|test_db_events|test_db_auth|test_db_transactions|test_db_maintenance|test_db_query_builder|test_logger_json|test_batch_delete_progress|test_db_recordings_sync|test_httpd_utils|test_zone_filter|test_onvif_soap_fault|test_faac_encoder|test_audio_transcoder|test_mp4_audio_recovery|test_mp4_forced_reconnect|test_mp4_recovery_watchdog|test_audio_voice_enhancement|test_audio_voice_filter_faults|test_udt_recording|test_detection_current_frame|test_detection_io_recovery|test_hls_cleanup|test_stream_manager|test_stream_state|test_packet_buffer|test_timestamp_manager|test_motion_trigger_parse|test_motion_max_area|test_url_utils|test_system_health_startup$"
ctest --output-on-failure --no-tests=error -V -L '^ci-unit$'

- name: Generate coverage report
if: always()
Expand Down Expand Up @@ -606,13 +541,9 @@ jobs:
npm ci
npx playwright install --with-deps chromium

- name: Bulk tag reconciliation regression
if: ${{ matrix.shard == 1 }}
run: npm --prefix web run test:e2e -- --testPathPatterns=bulkTagsReconciliation

- name: Zone Editor checkbox regression
- name: Component browser regressions
if: ${{ matrix.shard == 1 }}
run: npm --prefix web run test:e2e -- --testPathPatterns=zoneEditorCheckbox
run: npm --prefix web run test:e2e -- --testPathPatterns='\.browser\.spec\.js$'

- name: Run Playwright UI tests
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ jobs:
run: |
cd build
echo "Running tests with ASan + UBSan enabled..."
ctest --output-on-failure -V \
-R "test_sqlite_migration_boundaries|test_config|test_logger|test_strings|test_memory|test_request_response|test_shutdown_coordinator|test_detection_config|test_detection_model_motion|test_db_streams|test_db_recordings_extended|test_db_detections|test_db_zones|test_db_events|test_db_auth|test_db_transactions|test_db_maintenance|test_db_query_builder|test_logger_json|test_batch_delete_progress|test_db_recordings_sync|test_httpd_utils|test_zone_filter|test_faac_encoder|test_audio_transcoder|test_audio_voice_enhancement|test_audio_voice_filter_faults|test_udt_recording|test_detection_current_frame|test_detection_io_recovery|test_stream_manager|test_stream_state|test_packet_buffer|test_timestamp_manager|test_storage_pressure$|test_storage_pressure_extended|test_detection_result_structures|test_stream_frame_rate|test_recording_video_params|test_mp4_segment_boundaries|test_storage_retention_sqlite|test_audit_log|test_audit_summary"
ctest --output-on-failure --no-tests=error -V -L '^ci-sanitizer$'

- name: Smoke test - start and stop service
run: |
Expand Down
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Tests CMakeLists.txt

include(cmake/CiSuites.cmake)

# Get the ENABLE_SOD option from parent
if(NOT DEFINED ENABLE_SOD)
option(ENABLE_SOD "Enable SOD library for object detection" ON)
Expand Down Expand Up @@ -136,6 +138,7 @@ set_target_properties(test_db_backup

# Add database backup test to CTest
add_test(NAME test_db_backup COMMAND test_db_backup)
lightnvr_ci_test(test_db_backup CI_UNIT)

# Add stream detection test
add_executable(test_stream_detection test_stream_detection.c)
Expand Down
30 changes: 30 additions & 0 deletions tests/cmake/CiSuites.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# CI suite membership lives beside each test registration. For example:
# add_layer2_test(test_example CI_UNIT CI_SANITIZER)
# Both the aggregate build target and CTest label come from that declaration.
add_custom_target(ci-unit-tests)
add_custom_target(ci-sanitizer-tests)

function(lightnvr_ci_test TEST_TARGET)
cmake_parse_arguments(ARG "CI_UNIT;CI_SANITIZER" "" "TESTS" ${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown CI test options: ${ARG_UNPARSED_ARGUMENTS}")
endif()
if(NOT TARGET ${TEST_TARGET})
message(FATAL_ERROR "Missing CI test target: ${TEST_TARGET}")
endif()
if(NOT ARG_TESTS)
set(ARG_TESTS ${TEST_TARGET})
endif()
foreach(SUITE IN ITEMS UNIT SANITIZER)
if(ARG_CI_${SUITE})
string(TOLOWER "${SUITE}" SUITE_LABEL)
add_dependencies(ci-${SUITE_LABEL}-tests ${TEST_TARGET})
foreach(TEST_NAME IN LISTS ARG_TESTS)
if(NOT TEST ${TEST_NAME})
message(FATAL_ERROR "Missing CI test registration: ${TEST_NAME}")
endif()
set_property(TEST ${TEST_NAME} APPEND PROPERTY LABELS ci-${SUITE_LABEL})
endforeach()
endif()
endforeach()
endfunction()
Loading
Loading