The unified validator is a refactored C++ framework with template-based architecture and a registry for dynamic dispatch. It covers additional test cases beyond the legacy validator, including:
Zero-size edge cases: Validates correct behavior with size=0 and NULL pointers for all function categories (copy, fill, compare, search, length, concat).
Page-boundary tests: Validates correctness when source/destination buffers cross page boundaries.
Page-overrun tests: Ensures functions do not read/write beyond allocated page boundaries.
Overlap tests: Verifies forward and backward overlap correctness for memmove and in-place copy scenarios.
Extended ASCII validation: Tests all 256 byte values at every position.
Multi-null tests: Validates behavior with embedded null characters in buffers.
Command Line Interface
$ ./tools/validator/libmem_validator_unified <function> <size> [src_align] [dst_align] [all_alignments]
Arguments:
function: memcpy, mempcpy, memmove, memset, memcmp, memchr, strcpy, strncpy, strcmp, strncmp, strlen, strcat, strncat, strstr, strchr, strnlen, strspnsize: Size parameter for the functionsrc_align: Source alignment offset (default: 0)dst_align: Destination alignment offset (default: 0)all_alignments: 1 to test all src/dst alignment combinations
Options:
--list-functions: List all supported functions--list-tests <function>: List tests available for a function--help: Show usage
Usage Examples:
# Test all alignment combinations (last arg = 1)
$ ./tools/validator/libmem_validator_unified memcpy 1024 0 0 1
# Test specific alignment (src=0, dst=0)
$ ./tools/validator/libmem_validator_unified memcpy 1024 0 0 0
# List supported functions
$ ./tools/validator/libmem_validator_unified --list-functions
# Show registered tests for a function
$ ./tools/validator/libmem_validator_unified --list-tests memcpy
CTest Utility (Unified)
LibMem CTest can execute unified validator tests using the unified_ prefix.
The following test categories are supported:
Iterator testing (increments by 1B till Page_Size) [0B-4KB]
Shift testing (Tests for standard sizes) [1B,2B,4B…32MB]
Alignment testing (Modifies the src and dst alignment) [0B-4KB] src [0-63] dst [0-63]
Threshold testing (AMD-specific) for L2/NT boundaries
ZEN5 aligned vector threshold testing (when applicable)
CTest Examples:
# Unified tests for memcpy (all modes)
$ ctest -R "unified_memcpy" -j $(nproc)
# Unified iterator tests across all functions
$ ctest -R "unified_.*_iter" -j $(nproc)
# Unified alignment tests for memcmp
$ ctest -R "unified_memcmp_align" -j $(nproc)
# Unified threshold checks
$ ctest -R "unified_memcpy_thresholdL2|unified_memcpy_threshold_nt"
# Unified shift tests with timestamped logs
$ ctest -R "unified_memcpy_shift" -O ctest_results_$(date +%Y_%m_%d_%H%M%S).log
Note
By default, CTest will run both legacy and unified framework tests unless the unified_ keyword is specified in the regex filter (e.g., ctest -R "unified_memcpy").