summaryrefslogtreecommitdiff
path: root/libc/test/src/sys/random/linux
AgeCommit message (Collapse)Author
2025-08-27[libc][NFC] Fix Implicit Conversion Warning in getrandom Test (#155732)Aiden Grossman
getrandom returns a ssize_t, but the error codes are defined as integers. We need to use the builtin cast in the Fails matcher to ensure that everything is the same type. clang will warn about this in a bootstrapping build. Originally found in \#155627.
2025-05-28[libc] Migrate sys/ tests to ErrnoCheckingTest. (#141871)Alexey Samsonov
See PR #132823 for a previous change to sys/epoll tests, and prior changes before that. ErrnoCheckingTest ensures that errno is properly reset at the beginning of the test case, and is validated at the end of it. This change removes many instances of manual errno manipulation.
2025-03-14[libc] Fix implicit conversion warnings in tests. (#131362)lntue
2024-04-05[libc] Add proxy header math_macros.h. (#87598)lntue
Context: https://github.com/llvm/llvm-project/pull/87017 - Add proxy header `libc/hdr/math_macros.h` that will: - include `<math.h>` in overlay mode, - include `"include/llvm-libc-macros/math-macros.h"` in full build mode. - Its corresponding CMake target `libc.hdr.math_macros` will only depend on `libc.include.math` and `libc.include.llvm-libc-macros.math_macros` in full build mode. - Replace all `#include "include/llvm-libc-macros/math-macros.h"` with `#include "hdr/math_macros.h"`. - Add dependency to `libc.hdr.math_macros` CMake target when using `add_fp_unittest`. - Update the remaining dependency. - Update bazel overlay: add `libc:hdr_math_macros` target, and replacing all dependency on `libc:llvm_libc_macros_math_macros` with `libc:hdr_math_macros`.
2024-02-06[libc] Move libc_errno inside of LIBC_NAMESPACE (#80774)michaelrj-google
Having libc_errno outside of the namespace causes versioning issues when trying to link the tests against LLVM-libc. Most of this patch is just moving libc_errno inside the namespace in tests. This isn't necessary in the function implementations since those are already inside the namespace.
2023-11-03[libc] Cleanup ErrnoSetterMatcher target (#71240)michaelrj-google
The ErrnoSetterMatcher target was renamed in a previous patch, but not all uses were caught. This patch fixes those that remain.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-05-26[libc] Make ErrnoSetterMatcher handle logging floating point values.Siva Chandra Reddy
Along the way, couple of additional things have been done: 1. Move `ErrnoSetterMatcher.h` to `test/UnitTest` as all other matchers live there now. 2. `ErrnoSetterMatcher` ignores matching `errno` on GPUs. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D151129
2023-05-24[libc] simplify test for getrandomGuillaume Chatelet
`getrandom` is implemented as a syscall. We don't want to test linux implementation of the syscall. We just want to verify that it reacts as expected to sensible values. Runtime before ``` [ RUN ] LlvmLibcGetRandomTest.InvalidFlag [ OK ] LlvmLibcGetRandomTest.InvalidFlag (took 0 ms) [ RUN ] LlvmLibcGetRandomTest.InvalidBuffer [ OK ] LlvmLibcGetRandomTest.InvalidBuffer (took 0 ms) [ RUN ] LlvmLibcGetRandomTest.ReturnsSize [ OK ] LlvmLibcGetRandomTest.ReturnsSize (took 83 ms) [ RUN ] LlvmLibcGetRandomTest.PiEstimation [ OK ] LlvmLibcGetRandomTest.PiEstimation (took 9882 ms) ``` Runtime after ``` [ RUN ] LlvmLibcGetRandomTest.InvalidFlag [ OK ] LlvmLibcGetRandomTest.InvalidFlag (took 0 ms) [ RUN ] LlvmLibcGetRandomTest.InvalidBuffer [ OK ] LlvmLibcGetRandomTest.InvalidBuffer (took 0 ms) [ RUN ] LlvmLibcGetRandomTest.ReturnsSize [ OK ] LlvmLibcGetRandomTest.ReturnsSize (took 0 ms) [ RUN ] LlvmLibcGetRandomTest.CheckValue [ OK ] LlvmLibcGetRandomTest.CheckValue (took 0 ms) ``` Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D151336
2023-04-24[libc] Run all unit tests, irrespective of whether they belong to a test suite.Siva Chandra Reddy
Previously, only those unit tests which belonged to a suite were run as part of libc-unit-tests. It meant that unit tests not part of any suite were not being tested. This change makes all unit tests run as part of libc-unit-tests. The convenience function to add a libc unit test suite has been removed and add_custom_target is used in its place. One of the bit-rotting test has along been fixed. Math exhaustive and differential tests are skipped under full build. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D148784
2023-04-12[LIBC] Fix `getrandom` success return valueNoah Goldstein
`getrandom` should return the number of bytes successfully set on success, not `0`. Reviewed By: sivachandra, michaelrj Differential Revision: https://reviews.llvm.org/D147981
2023-03-13[libc][NFC] Switch sys/*.h tests over to libc_errno.Siva Chandra Reddy
2023-02-07[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.Siva Chandra Reddy
This part of the effort to make all test related pieces into the `test` directory. This helps is excluding test related pieces in a straight forward manner if LLVM_INCLUDE_TESTS is OFF. Future patches will also move the MPFR wrapper and testutils into the 'test' directory.
2022-10-10Implement `getrandom` function for linux targets.Schrodinger ZHU Yifan
Reviewed By: michaelrj, sivachandra Differential Revision: https://reviews.llvm.org/D134665