mirror-llvm-project/libc/test/UnitTest
Alexey Samsonov 2e838bf84d
[libc] Fix aligned_alloc used in hermetic tests. (#213041)
Use the provided alignment for the pointer to the returned
memory chunk instead of the size.

This fixes occasional segfaults in `hsearch` tests after
ce62aab97e, since
hash-table bitmask implementation uses SSE2 intrinsics with 16-byte
alignment.
2026-07-30 10:29:38 -07:00
..
BazelFilePath.cpp [libc][bazel] Append '/' to TEST_UNDECLARED_OUTPUTS_DIR (#207710) 2026-07-09 09:47:55 +02:00
CmakeFilePath.cpp
CMakeLists.txt Reapply "[libc] Port process utilities to hermetic mode and enable some tests" (#211484) 2026-07-24 08:53:10 +02:00
ConstraintHandlerCheckingTest.h [libc] Annex K: Add constraint handler unit test class (#197707) 2026-07-15 10:40:25 +01:00
ErrnoCheckingTest.h [libc] Make errno asserts noop on gpu targets (#166606) 2025-11-05 11:17:13 -08:00
ErrnoSetterMatcher.h [libc] Update some syscall tests to be more tolerance to QEMU behaviors. (#208920) 2026-07-13 15:17:07 -04:00
ExecuteFunction.h [libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) 2025-07-23 20:19:52 -04:00
ExecuteFunctionUnix.cpp Reapply "[libc] Port process utilities to hermetic mode and enable some tests" (#211484) 2026-07-24 08:53:10 +02:00
FEnvSafeTest.cpp [libc] Add missing functions in FEnvImpl.h under LIBC_MATH_USE_SYSTEM_FENV config. (#211303) 2026-07-22 14:44:54 -04:00
FEnvSafeTest.h [libc] Migrate FEnvSafeTest and FPTest to ErrnoCheckingTest. (#152633) 2025-08-07 21:49:57 -07:00
FPExceptMatcher.cpp [libc] Add missing functions in FEnvImpl.h under LIBC_MATH_USE_SYSTEM_FENV config. (#211303) 2026-07-22 14:44:54 -04:00
FPExceptMatcher.h [libc] Add -Wextra for libc tests (#153321) 2025-09-22 12:56:38 -04:00
FPMatcher.h [libc] Add missing functions in FEnvImpl.h under LIBC_MATH_USE_SYSTEM_FENV config. (#211303) 2026-07-22 14:44:54 -04:00
GTest.h
HermeticTestUtils.cpp [libc] Fix aligned_alloc used in hermetic tests. (#213041) 2026-07-30 10:29:38 -07:00
LibcDeathTestExecutors.cpp [libc] Move test macro implementations out of the Test class (#212783) 2026-07-30 15:46:44 +02:00
LibcTest.cpp [libc] Move test macro implementations out of the Test class (#212783) 2026-07-30 15:46:44 +02:00
LibcTest.h [libc] Move test macro implementations out of the Test class (#212783) 2026-07-30 15:46:44 +02:00
LibcTestMain.cpp
MemoryMatcher.cpp [libc] Migrate ctype_utils to use char instead of int where applicable. (#166225) 2025-11-05 11:02:28 -08:00
MemoryMatcher.h
PrintfMatcher.cpp [libc] Migrate printf_core from stdio/ to __support/. (#208303) 2026-07-21 14:35:24 -07:00
PrintfMatcher.h [libc] Migrate printf_core from stdio/ to __support/. (#208303) 2026-07-21 14:35:24 -07:00
README.md
RoundingModeUtils.cpp [libc] Add missing functions in FEnvImpl.h under LIBC_MATH_USE_SYSTEM_FENV config. (#211303) 2026-07-22 14:44:54 -04:00
RoundingModeUtils.h [libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) 2025-07-23 20:19:52 -04:00
ScanfMatcher.cpp [libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) 2025-07-23 20:19:52 -04:00
ScanfMatcher.h
SIMDMatcher.h [libc][mathvec] Initial commit for LIBC vector math component (#173058) 2026-02-19 14:54:28 -05:00
StringUtils.h
Test.h [libc] Move ASSERT_ERRNO_* macro to ErrnoCheckingTest.h (#158727) 2025-09-15 14:33:33 -07:00
TestLogger.cpp Reapply "[libc] Finetune libc.src.__support.OSUtil.osutil dependency." (#190033) (#190065) 2026-04-01 18:38:32 -04:00
TestLogger.h
ZxTest.h

The LLVM libc unit test framework

This directory contains a lightweight implementation of a gtest like unit test framework for LLVM libc.

Why not gtest?

While gtest is great, featureful and time tested, it uses the C and C++ standard libraries. Hence, using it to test LLVM libc (which is also an implementation of the C standard libraries) causes various kinds of mixup/conflict problems.

How is it different from gtest?

LLVM libc's unit test framework is much less featureful as compared to gtest. But, what is available strives to be exactly like gtest.

Will it be made as featureful as gtest in future?

It is not clear if LLVM libc needs/will need every feature of gtest. We only intend to extend it on an as needed basis. Hence, it might never be as featureful as gtest.