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
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ set(TOOL_NAMESPACE "coretrace" CACHE STRING "CMake namespace for ALIAS targets")

# Library sources (add/remove files here)
set(TOOL_SOURCES
src/cli_args.cpp
src/events.cpp
src/findings.cpp
src/process.cpp
src/runtime_analyzer.cpp
Expand Down Expand Up @@ -270,6 +272,13 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
target_link_libraries(shipped_toolchain_test PRIVATE ${TOOL_NAME}_lib)
add_test(NAME shipped_toolchain_unit COMMAND shipped_toolchain_test)

foreach(_unit cli_args events sarif)
add_executable(${_unit}_test unittests/${_unit}_test.cpp)
target_include_directories(${_unit}_test PRIVATE src)
target_link_libraries(${_unit}_test PRIVATE ${TOOL_NAME}_lib)
add_test(NAME ${_unit}_unit COMMAND ${_unit}_test)
endforeach()

# The library API as a consumer links it: Run and RunBatch on real programs.
add_executable(api_test unittests/api_test.cpp)
target_link_libraries(api_test PRIVATE ${TOOL_NAME}_lib)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ ctest --test-dir build --output-on-failure
| Test | Checks |
|---|---|
| `findings_unit`, `process_unit` | the report parser and the process runner (`unittests/`) |
| `cli_args_unit` | argument parsing, every option and every invalid spelling, the compiler's `-o`, the compile-only and `-x` flags, the C-as-C++ and `DEBUG` heuristics, the compiler arguments of a run, the artifact names of a batch (`src/cli_args.hpp`) |
| `events_unit` | the CoreTrace event lines of a run and their summary, ANSI colours stripped, and the verdict drawn from a result (`src/events.hpp`) |
| `sarif_unit` | the SARIF writer against the exact log a consumer reads: empty, an error with its locations, a warning without one |
| `api_unit` | the library API: `Run` and `RunBatch` on real programs, a heap overflow, a compile-only run, a hang against the timeout, a batch, the refused and empty cases |
| `consumer` | a project fetching this repository the way ctrace does (`unittests/consumer/`) configures, builds, links `coretrace::runtime-analyzer_lib` and analyzes a program |
| `fixtures` | every source under `test/` states what it proves in its header (`// args:`, `// expect:`), and the analyzer proves it: findings with rule, CWE, level, faulting line and allocation site, or none; the program's exit status and output when stated. A fixture without an expectation fails (`test/check_fixtures.py`) |
Expand Down
Loading
Loading