glibc Validator (glibc_validator.sh) - glibc Validator (glibc_validator.sh) - 5.3 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2026-05-13
Version
5.3 English

The glibc validator validates AOCL-LibMem implementations against glibc’s official test suite. The glibc_validator.sh script automates downloading, patching, compiling, and running glibc test files with LD_PRELOAD to test LibMem implementations.

Prerequisites:

  • GCC compiler

  • curl (for downloading test files)

  • AOCL-LibMem built and installed (shared library available under <build_dir>/lib/)

Running All Tests:

After building and installing AOCL-LibMem, run the script from the build directory:

$ cd <build_dir>
$ ./tools/validator/glibc/glibc_validator.sh

The script will:

  • Download test files for all supported functions from the official glibc repository

  • Apply minimal patches to make tests compile standalone

  • Compile all tests into <build_dir>/test/glibc-functionality-tests/bin/

  • Run each test with LD_PRELOAD

  • Display a summary of passed/failed tests

Running Individual Tests:

After running the validator script once, individual tests can be run manually:

# Run a specific test with AOCL-LibMem
$ LD_PRELOAD=<build_dir>/lib/libaocl-libmem.so <build_dir>/test/glibc-functionality-tests/bin/test-strlen

# Run a specific test without AOCL-LibMem (system glibc)
$ <build_dir>/test/glibc-functionality-tests/bin/test-strlen

Supported Functions:

  • Memory: memcpy, mempcpy, memmove, memset, memcmp, memchr

  • String: strcpy, strncpy, strcmp, strncmp, strlen, strcat, strncat, strstr, strchr, strnlen, strspn

Note

Tests are downloaded from the official glibc git repository (sourceware.org). Minimal patches are applied to make tests compile standalone. Tests use LD_PRELOAD to intercept function calls and redirect to AOCL-LibMem. The script detects if test files already exist and skips downloading; remove <build_dir>/test/glibc-functionality-tests/ to force a fresh download.