Skip to content

Commit 19e7ece

Browse files
committed
Add comprehensive coverage tests for database inventory and scan rules
- Introduced `database_inventory_coverage_tests.cpp` to validate project inventory repository functionality, including error handling for invalid project IDs and missing payload keys. - Implemented tests for persisting and pruning files, autoloads, classes, and unknown entries in the project inventory. - Added `scan_rules_coverage_tests.cpp` to cover various scenarios for scan rules, including classification, hint detection, and dirty state detection. - Enhanced existing functionality with additional checks for file types, extensions, and type hints. - Updated binary object files for native scan rules and script parser.
1 parent 614b896 commit 19e7ece

21 files changed

Lines changed: 3841 additions & 2720 deletions

.sconsign.dblite

61 Bytes
Binary file not shown.

SConstruct

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ NATIVE_TEST_FILES = [
2020
"tests/native/scanner_benchmark.cpp",
2121
"tests/native/schema_v2_tests.cpp",
2222
"tests/native/scanner_native_tests.cpp",
23+
"tests/native/database_inventory_coverage_tests.cpp",
24+
"tests/native/scan_rules_coverage_tests.cpp",
2325
]
2426

2527
FUZZ_SCRIPT_PARSER_SOURCES = [
@@ -446,29 +448,33 @@ if build_extension:
446448
if build_doctest:
447449
require_source_files(NATIVE_TEST_FILES)
448450

449-
native_test_sources = (
450-
NATIVE_TEST_FILES
451-
+ collect_native_testable_production_sources()
452-
)
451+
native_test_sources = (
452+
NATIVE_TEST_FILES
453+
+ collect_native_testable_production_sources()
454+
)
453455

454-
sqlite_test_env = env.Clone()
455-
configure_sqlite_c_flags(sqlite_test_env, platform)
456+
sqlite_test_env = env.Clone()
457+
configure_sqlite_c_flags(sqlite_test_env, platform)
456458

457-
sqlite_test_object = sqlite_test_env.Object(
458-
target=(object_dir / "sqlite3_native_tests").as_posix(),
459-
source=SQLITE_SOURCE.as_posix(),
460-
)
459+
sqlite_test_object = sqlite_test_env.Object(
460+
target=(object_dir / "sqlite3_native_tests").as_posix(),
461+
source=SQLITE_SOURCE.as_posix(),
462+
)
461463

462-
native_test_binary = env.Program(
463-
target=native_test_target,
464-
source=native_test_sources + sqlite_test_object,
465-
)
464+
native_test_target = (
465+
Path("build") / "tests" / platform / build_target / arch / "gotool_native_tests"
466+
).as_posix()
467+
468+
native_test_binary = env.Program(
469+
target=native_test_target,
470+
source=native_test_sources + sqlite_test_object,
471+
)
466472

467-
default_targets.append(native_test_binary)
468-
compilation_database_inputs.append(native_test_binary)
473+
default_targets.append(native_test_binary)
474+
compilation_database_inputs.append(native_test_binary)
469475

470-
env.Alias("doctest", native_test_binary)
471-
env.Alias("tests", native_test_binary)
476+
env.Alias("doctest", native_test_binary)
477+
env.Alias("tests", native_test_binary)
472478

473479
if build_fuzz:
474480
require_source_files(FUZZ_SCRIPT_PARSER_SOURCES)

compile_commands.json

Lines changed: 2223 additions & 2271 deletions
Large diffs are not rendered by default.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)