net/content_disposition — total parser for the mojibake-prone header: RFC 6266 filename (quoted/token), RFC 5987 filename* ext-values (charset'lang'pct-encoded, incl. RFC 2231 continuations), legacy RFC 2047 encoded-words (=?UTF-8?B?..?= / ?Q?), and raw Latin-1 bytes; prefers filename* over filename; strips path components AFTER decoding (a base64 payload can hold '/'). 22-case test table. net/text_codec (internal) — percent-decode, UTF-8 validation, Latin-1-> UTF-8, base64, RFC 2047 — shared by the CD parser and the URL splitter. net/url — a small total URL splitter (scheme/userinfo/host/port/path/ query/fragment, http(s) validity) and url_filename() for the last path segment; used for the filename fallback. net/probe — HEAD then a ranged GET bytes=0-0 that PROVES resumability (206 + matching Content-Range + a validator), rather than trusting Accept-Ranges which servers lie about; the ranged GET is also the HEAD- refused (403/405/501) fallback. 401/407 -> success result with requires_auth, not an error. Runs on its own pool (max_concurrent, default 4) outside the segment budget per ADR 0011 §5. suggest_filename() does the resolution order (explicit -> disposition -> URL -> download.bin) with a light strip; rules/ (stage 9) owns the authoritative sanitize. tools/fuzz — libFuzzer targets for the CD parser and the URL splitter, compiling the parser sources directly so they're fully instrumented; self-guards on VELOX_BUILD_FUZZ + Clang (the top-level CMake adds every tools/* unconditionally). Seed corpora included. Fixed on the way: a p -> Transfer -> State -> cbs -> p reference cycle in Prober that leaked every probe (drop the stored Transfer; the worker keeps State alive). Tests green under ASan/UBSan and TSan. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HPPSGhiArbvQgwC2DNiURS
44 lines
1.9 KiB
CMake
44 lines
1.9 KiB
CMake
# CORE unit tests.
|
|
#
|
|
# Harness is the provisional header-only vtest (support/vtest.hpp); PKG owns the final
|
|
# framework choice (core/docs/pkg-requests-m1.md P2). vdm_add_test() is the only thing
|
|
# test files touch, so swapping harnesses is a one-function edit.
|
|
|
|
add_library(vtest_main STATIC support/vtest_main.cpp)
|
|
target_include_directories(vtest_main PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/support)
|
|
target_compile_features(vtest_main PUBLIC cxx_std_23)
|
|
|
|
function(vdm_add_test name)
|
|
add_executable(${name} ${ARGN})
|
|
target_link_libraries(${name} PRIVATE veloxcore vtest_main)
|
|
target_compile_options(${name} PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
add_test(NAME ${name} COMMAND ${name})
|
|
endfunction()
|
|
|
|
vdm_add_test(veloxcore_result_test util/result_test.cpp)
|
|
vdm_add_test(veloxcore_event_bus_test util/event_bus_test.cpp)
|
|
vdm_add_test(veloxcore_thread_pool_test util/thread_pool_test.cpp)
|
|
vdm_add_test(veloxcore_bytes_test util/bytes_test.cpp)
|
|
vdm_add_test(veloxcore_log_test util/log_test.cpp)
|
|
|
|
# net/ integration tests drive tools/testserver (lane PKG/QA). Skip cleanly if it isn't
|
|
# in the tree yet (lanes merge independently).
|
|
vdm_add_test(veloxcore_content_disposition_test net/content_disposition_test.cpp)
|
|
vdm_add_test(veloxcore_url_test net/url_test.cpp)
|
|
|
|
set(_testserver ${CMAKE_SOURCE_DIR}/tools/testserver/testserver.py)
|
|
foreach(net_it http_client probe)
|
|
vdm_add_test(veloxcore_${net_it}_test net/${net_it}_test.cpp)
|
|
target_include_directories(veloxcore_${net_it}_test
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/net)
|
|
if(EXISTS ${_testserver})
|
|
target_compile_definitions(veloxcore_${net_it}_test
|
|
PRIVATE VDM_TESTSERVER_PY="${_testserver}")
|
|
set_tests_properties(veloxcore_${net_it}_test PROPERTIES TIMEOUT 120)
|
|
endif()
|
|
endforeach()
|
|
if(NOT EXISTS ${_testserver})
|
|
message(STATUS "veloxcore: tools/testserver not present; net integration tests will "
|
|
"skip their server-backed cases.")
|
|
endif()
|