# Tests for Strawberry Security Scanner test_deps = common_deps + strawberry_feature_deps # Basic hash utils test test_hash = executable('test_hash_utils', 'test_hash_utils.cpp', '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: test_deps, ) test('hash_utils', test_hash) test_fleet = executable('test_fleet', 'test_fleet.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps) test('fleet', test_fleet) test_features = executable('test_features', 'test_features.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps) test('features', test_features) test_fleet_export = executable('test_fleet_export', 'test_fleet_export.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps) test('fleet_export', test_fleet_export) test_fleet_merge = executable('test_fleet_merge', 'test_fleet_merge.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps) test('fleet_merge', test_fleet_merge) test_fleet_overlay = executable('test_fleet_overlay', 'test_fleet_overlay.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps) test('fleet_overlay', test_fleet_overlay) # RepeatAggregator (header-only) test_repeat_aggregator = executable('test_repeat_aggregator', 'test_repeat_aggregator.cpp', include_directories: inc_dirs, dependencies: test_deps, ) test('repeat_aggregator', test_repeat_aggregator) # Config test test_config = executable('test_config', 'test_config.cpp', '../src/config.cpp', include_directories: inc_dirs, dependencies: test_deps, ) test('config', test_config) # Database test test_database = executable('test_database', 'test_database.cpp', database_sources, include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('database', test_database) test_incident_report = executable('test_incident_report', 'test_incident_report.cpp', '../src/incident_report.cpp', database_sources, include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('incident_report', test_incident_report) test_correlation_engine = executable('test_correlation_engine', 'test_correlation_engine.cpp', '../src/correlation_engine.cpp', database_sources, '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('correlation_engine', test_correlation_engine) test_correlation_incremental = executable('test_correlation_incremental', 'test_correlation_incremental.cpp', '../src/correlation_engine.cpp', database_sources, '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('correlation_incremental', test_correlation_incremental, timeout: 120) test_process_query = executable('test_process_query', 'test_process_query.cpp', '../src/process_query.cpp', database_sources, include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('process_query', test_process_query) # Process monitor test (procfs polling backend and event ingestion) test_process_monitor = executable('test_process_monitor', 'test_process_monitor.cpp', '../src/process_monitor.cpp', '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_monitor_deps, ) test('process_monitor', test_process_monitor) runtime_pipeline_deps = strawberry_runtime_deps if yara_dep.found() runtime_pipeline_deps += yara_dep endif if libbpf_dep.found() runtime_pipeline_deps += libbpf_dep endif test_runtime_pipeline = executable('test_runtime_pipeline', 'test_runtime_pipeline.cpp', '../src/detection_pipeline.cpp', '../src/redact.cpp', '../src/telemetry.cpp', '../src/resource_governor.cpp', '../src/policy.cpp', '../src/exec_guard.cpp', '../src/crash_safety.cpp', '../src/installed_files.cpp', '../src/behavior_engine.cpp', '../src/file_watch.cpp', '../src/opensnitch.cpp', '../src/ioc_set.cpp', '../src/correlation_engine.cpp', '../src/process_monitor.cpp', '../src/yara_scanner.cpp', database_sources, '../src/hash_utils.cpp', '../src/config.cpp', include_directories: inc_dirs, dependencies: runtime_pipeline_deps, ) test('runtime_pipeline', test_runtime_pipeline) test_daemon_runtime = executable('test_daemon_runtime', 'test_daemon_runtime.cpp', '../src/daemon_app.cpp', '../src/tracker_set.cpp', '../src/ioc_list.cpp', '../src/opensnitch_events.cpp', '../src/retro_hunt.cpp', '../src/doctor.cpp', '../src/inspection_executor.cpp', learn_sources, '../src/thread_priority.cpp', '../src/control_server.cpp', '../src/opensnitch.cpp', '../src/exec_guard.cpp', '../src/crash_safety.cpp', '../src/installed_files.cpp', '../src/behavior_engine.cpp', '../src/file_watch.cpp', '../src/correlation_engine.cpp', '../src/detection_pipeline.cpp', '../src/redact.cpp', '../src/telemetry.cpp', '../src/resource_governor.cpp', '../src/policy.cpp', '../src/ioc_set.cpp', '../src/daemon_states.cpp', '../src/process_monitor.cpp', '../src/yara_scanner.cpp', database_sources, '../src/hash_utils.cpp', '../src/config.cpp', include_directories: inc_dirs, dependencies: runtime_pipeline_deps, ) test('daemon_runtime', test_daemon_runtime) process_monitor_live_smoke = executable('process_monitor_live_smoke', 'process_monitor_live_smoke.cpp', '../src/process_monitor.cpp', '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_monitor_deps, ) live_bpf_pipeline_smoke = executable('live_bpf_pipeline_smoke', 'live_bpf_pipeline_smoke.cpp', '../src/detection_pipeline.cpp', '../src/redact.cpp', '../src/telemetry.cpp', '../src/resource_governor.cpp', '../src/policy.cpp', '../src/exec_guard.cpp', '../src/crash_safety.cpp', '../src/installed_files.cpp', '../src/behavior_engine.cpp', '../src/file_watch.cpp', '../src/opensnitch.cpp', '../src/ioc_set.cpp', '../src/correlation_engine.cpp', '../src/process_monitor.cpp', '../src/yara_scanner.cpp', database_sources, '../src/hash_utils.cpp', '../src/config.cpp', include_directories: inc_dirs, dependencies: runtime_pipeline_deps, ) live_bpf_daemon_smoke = executable('live_bpf_daemon_smoke', 'live_bpf_daemon_smoke.cpp', '../src/daemon_app.cpp', '../src/tracker_set.cpp', '../src/ioc_list.cpp', '../src/opensnitch_events.cpp', '../src/retro_hunt.cpp', '../src/doctor.cpp', '../src/inspection_executor.cpp', learn_sources, '../src/thread_priority.cpp', '../src/control_server.cpp', '../src/opensnitch.cpp', '../src/exec_guard.cpp', '../src/crash_safety.cpp', '../src/installed_files.cpp', '../src/behavior_engine.cpp', '../src/file_watch.cpp', '../src/correlation_engine.cpp', '../src/detection_pipeline.cpp', '../src/redact.cpp', '../src/telemetry.cpp', '../src/resource_governor.cpp', '../src/policy.cpp', '../src/ioc_set.cpp', '../src/daemon_states.cpp', '../src/process_monitor.cpp', '../src/yara_scanner.cpp', database_sources, '../src/hash_utils.cpp', '../src/config.cpp', include_directories: inc_dirs, dependencies: runtime_pipeline_deps, ) # YARA scanner test (real scans when libyara is present, graceful fallback otherwise) test_yara_scanner = executable('test_yara_scanner', 'test_yara_scanner.cpp', '../src/yara_scanner.cpp', include_directories: inc_dirs, dependencies: strawberry_yara_deps, ) test('yara_scanner', test_yara_scanner) # Direct submodule persistence/transaction test test_control_server = executable('test_control_server', 'test_control_server.cpp', '../src/control_server.cpp', include_directories: inc_dirs, dependencies: common_deps, ) test('control_server', test_control_server) test_policy = executable('test_policy', 'test_policy.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('policy', test_policy) if strawberry_updater_available and yara_dep.found() test_rule_updater = executable('test_rule_updater', 'test_rule_updater.cpp', '../src/rule_updater.cpp', '../src/ioc_list.cpp', '../src/yara_scanner.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep, updater_feature_dep, yara_dep, yara_feature_dep], ) test('rule_updater', test_rule_updater) # Property (invariant) tests over parsers and decision logic. Seeded; # reproduce a failure with STRAWBERRY_PROPERTY_SEED=. test_invariants = executable('test_invariants', 'test_invariants.cpp', '../src/rule_updater.cpp', '../src/ioc_list.cpp', '../src/yara_scanner.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep, updater_feature_dep, yara_dep, yara_feature_dep], ) test('invariants', test_invariants, timeout: 120) endif test_opensnitch = executable('test_opensnitch', 'test_opensnitch.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('opensnitch', test_opensnitch) test_exec_guard = executable('test_exec_guard', 'test_exec_guard.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('exec_guard', test_exec_guard) # Live fanotify check (root only): scripts/run_exec_guard_live_docker.sh exec_guard_live = executable('exec_guard_live', 'exec_guard_live.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test_behavior_engine = executable('test_behavior_engine', 'test_behavior_engine.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('behavior_engine', test_behavior_engine) # Live fanotify persistence watcher check (root only) file_watch_live = executable('file_watch_live', 'file_watch_live.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) # Live Endpoint Security check (macOS; root + ES entitlement): make macos-live-tests if host_machine.system() == 'darwin' and strawberry_es_available foreach payload : [['es_live_evil', 'EVIL-MARKER'], ['es_live_clean', 'CLEAN'], ['es_live_slow', 'SLOW-MARKER']] executable(payload[0], 'es_live_payload.cpp', cpp_args: ['-DMARKER="' + payload[1] + '"']) endforeach macos_es_live = executable('macos_es_live', 'macos_es_live.cpp', '../src/process_monitor.cpp', '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) endif # Live eBPF behavior telemetry check (root + BPF object; Linux ptrace API) if host_machine.system() == 'linux' behavior_live = executable('behavior_live', 'behavior_live.cpp', '../src/process_monitor.cpp', '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_monitor_deps, ) endif test_resource_governor = executable('test_resource_governor', 'test_resource_governor.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('resource_governor', test_resource_governor) test_platform_process = executable('test_platform_process', 'test_platform_process.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('platform_process', test_platform_process) test_crash_safety = executable('test_crash_safety', 'test_crash_safety.cpp', include_directories: inc_dirs, dependencies: strawberry_core_dep, ) test('crash_safety', test_crash_safety) # Static source invariants (lessons the dynamic tests missed; see the script). python3_prog = find_program('python3') test('source_invariants', python3_prog, args: ['-I', meson.project_source_root() / 'tests' / 'source_invariants.py', meson.project_source_root()]) test('source_invariants_selftest', python3_prog, args: ['-I', meson.project_source_root() / 'tests' / 'source_invariants.py', '--self-test', meson.project_source_root()]) # Fault-injection properties: these sources are compiled with the I/O seam's # injector enabled (STRAWBERRY_FAULT_INJECTION=1). Production objects never are. test_fault_injection = executable('test_fault_injection', 'test_fault_injection.cpp', '../src/detection_pipeline.cpp', '../src/redact.cpp', '../src/telemetry.cpp', '../src/resource_governor.cpp', '../src/policy.cpp', '../src/exec_guard.cpp', '../src/crash_safety.cpp', '../src/installed_files.cpp', '../src/behavior_engine.cpp', '../src/file_watch.cpp', '../src/opensnitch.cpp', '../src/ioc_set.cpp', '../src/correlation_engine.cpp', '../src/process_monitor.cpp', '../src/yara_scanner.cpp', database_sources, '../src/hash_utils.cpp', '../src/config.cpp', include_directories: inc_dirs, cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'], dependencies: runtime_pipeline_deps, ) test('fault_injection', test_fault_injection, timeout: 300) # Event-store codec (varint, fields, records, CRC32C, zstd blocks): properties. test_store_codec = executable('test_store_codec', 'test_store_codec.cpp', '../src/store/codec.cpp', include_directories: inc_dirs, dependencies: [zstd_dep], ) test('store_codec', test_store_codec, timeout: 120) # Segment writer/reader/recovery under injected I/O faults (S1-S4). Compiled # with the fault injector, so it builds its own copies of the store sources. test_store_segment = executable('test_store_segment', 'test_store_segment.cpp', '../src/store/codec.cpp', '../src/store/segment.cpp', include_directories: inc_dirs, cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'], dependencies: [zstd_dep], ) test('store_segment', test_store_segment, timeout: 300) # MANIFEST encoding and crash-atomic publish under injected faults (M1-M3). test_store_manifest = executable('test_store_manifest', 'test_store_manifest.cpp', '../src/store/codec.cpp', '../src/store/segment.cpp', '../src/store/manifest.cpp', include_directories: inc_dirs, cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'], dependencies: [zstd_dep], ) test('store_manifest', test_store_manifest, timeout: 300) # LogStore (store directory: lock, manifest, recovery, rolls, orphans) under # injected faults and crashes (L1-L6). test_store_log = executable('test_store_log', 'test_store_log.cpp', '../src/store/codec.cpp', '../src/store/segment.cpp', '../src/store/manifest.cpp', '../src/store/log_store.cpp', include_directories: inc_dirs, cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'], dependencies: [zstd_dep], ) test('store_log', test_store_log, timeout: 300) # Differential: the event-store Database answers every query exactly as the # old (unqlite-format) store did (writes, transactions, rollbacks, reopens, read-only). test_store_differential = executable('test_store_differential', 'test_store_differential.cpp', database_sources, include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('store_differential', test_store_differential, timeout: 300) # EvidenceStore (app/MCP read-only view) over the event store. test_evidence_store = executable('test_evidence_store', 'test_evidence_store.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('evidence_store', test_evidence_store) # Legacy (unqlite-format) database import (I1-I5). test_store_import = executable('test_store_import', 'test_store_import.cpp', database_sources, include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('store_import', test_store_import, timeout: 300) # Installed-files manifest (installer-written unit files recorded as evidence). test_installed_files = executable('test_installed_files', 'test_installed_files.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('installed_files', test_installed_files) # Store maintenance: disk floor, retention, eviction, compaction, verify (L7-L11). test_store_maintenance = executable('test_store_maintenance', 'test_store_maintenance.cpp', store_sources, include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('store_maintenance', test_store_maintenance, timeout: 300) # Telemetry sink (lock-free bounded queue) and records (C1). test_telemetry = executable('test_telemetry', 'test_telemetry.cpp', '../src/telemetry.cpp', '../src/store/codec.cpp', include_directories: inc_dirs, dependencies: [zstd_dep, threads_dep], ) test('telemetry', test_telemetry, timeout: 120) test_redact = executable('test_redact', 'test_redact.cpp', '../src/redact.cpp', include_directories: inc_dirs, ) test('redact', test_redact, timeout: 120) test_learn = executable('test_learn', 'test_learn.cpp', '../src/learn/tokenize.cpp', '../src/learn/rarity.cpp', '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: test_deps, ) test('learn', test_learn, timeout: 120) test_tracker_set = executable('test_tracker_set', 'test_tracker_set.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('tracker_set', test_tracker_set, timeout: 60) test_opensnitch_events = executable('test_opensnitch_events', 'test_opensnitch_events.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('opensnitch_events', test_opensnitch_events, timeout: 60) test_replay = executable('test_replay', 'test_replay.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('replay', test_replay, timeout: 120) test_trace = executable('test_trace', 'test_trace.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], cpp_args: ['-DSTRAWBERRY_SOURCE_ROOT="' + meson.project_source_root() + '"'], ) test('trace', test_trace, timeout: 60) test_retro_hunt = executable('test_retro_hunt', 'test_retro_hunt.cpp', '../src/retro_hunt.cpp', '../src/doctor.cpp', '../src/inspection_executor.cpp', learn_sources, '../src/thread_priority.cpp', '../src/detection_pipeline.cpp', '../src/redact.cpp', '../src/telemetry.cpp', '../src/resource_governor.cpp', '../src/policy.cpp', '../src/exec_guard.cpp', '../src/crash_safety.cpp', '../src/installed_files.cpp', '../src/behavior_engine.cpp', '../src/file_watch.cpp', '../src/opensnitch.cpp', '../src/ioc_set.cpp', '../src/correlation_engine.cpp', '../src/process_monitor.cpp', '../src/yara_scanner.cpp', database_sources, '../src/hash_utils.cpp', '../src/config.cpp', include_directories: inc_dirs, dependencies: runtime_pipeline_deps, ) test('retro_hunt', test_retro_hunt, timeout: 120) test_doctor = executable('test_doctor', 'test_doctor.cpp', '../src/doctor.cpp', '../src/inspection_executor.cpp', learn_sources, '../src/retro_hunt.cpp', '../src/correlation_engine.cpp', database_sources, '../src/hash_utils.cpp', include_directories: inc_dirs, dependencies: strawberry_runtime_deps, ) test('doctor', test_doctor, timeout: 60) test_cli = executable('test_cli', 'test_cli.cpp', '../src/cli_commands.cpp', include_directories: inc_dirs, ) test('cli', test_cli, timeout: 30) # Non-installed writer + actual binary probes; isolated synthetic stores only. cli_replay_fixture = executable('cli_replay_fixture', 'cli_replay_fixture.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('cli_replay', python3_prog, args: [meson.current_source_dir() / 'test_cli_replay.py', strawberry_exe, cli_replay_fixture], timeout: 120, ) test_model = executable('test_model', 'test_model.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('model', test_model, timeout: 120) test_train = executable('test_train', 'test_train.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('train', test_train, timeout: 300) test_shadow = executable('test_shadow', 'test_shadow.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('shadow', test_shadow, timeout: 120) test_inspection_executor = executable('test_inspection_executor', 'test_inspection_executor.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep], ) test('inspection_executor', test_inspection_executor, timeout: 120) # Dev tool (build-only, not a test, not installed): deterministic synthetic telemetry store. fleet_seed = executable('strawberry-fleet-seed', 'fleet_seed.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps, install: false) fleet_inspect = executable('strawberry-fleet-inspect', 'fleet_inspect.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps, install: false) # Dev tool (build-only, not installed): applies a trained model to an export bundle's per-window features. model_score = executable('strawberry-model-score', 'model_score.cpp', include_directories: inc_dirs, dependencies: [strawberry_core_dep] + test_deps, install: false)