summaryrefslogtreecommitdiff
path: root/libc/test/IntegrationTest
AgeCommit message (Collapse)Author
2025-11-05[libc] Make errno asserts noop on gpu targets (#166606)Marcell Leleszi
This patch defines errno unit and integration test asserts as noop on GPU targets. Checking for errnos is tests has caused build breakages in previous patches.
2025-09-11[libc] Update errno usage in integration tests. (#158147)Alexey Samsonov
Instead of using libc_errno directly, include <errno.h> and use regular "errno" in the code. (to verify that errno-as-an-interface works properly). This is the recipe prescribed in the libc/src/__support/libc_errno.h header - let's actually follow it in the integration tests.
2025-08-06[libc] Fix integration tests on w64 amdgpu targets (#152303)Joseph Huber
Summary: We need `malloc` to return a larger size now that it's aligned properly and we use a bunch of threads. Also the `match_any` test was wrong because it assumed a 32-bit lanemask.
2025-08-05Reland "[libc] make integration test malloc work properly when threaded" ↵Schrodinger ZHU Yifan
(#152236) Reverts llvm/llvm-project#152096
2025-08-05Revert "[libc] make integration test malloc work properly when threaded" ↵Jan Patrick Lehr
(#152096) Reverts llvm/llvm-project#151622 This broke our libc on GPU bot: https://lab.llvm.org/buildbot/#/builders/10/builds/10864
2025-08-04[libc] make integration test malloc work properly when threaded (#151622)Schrodinger ZHU Yifan
Make the simple bump allocation backed by atomic operations.
2025-07-23[libc][NFC] Add stdint.h proxy header to fix dependency issue with ↵lntue
<stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2024-08-11Revert "libc: Remove `extern "C"` from main declarations" (#102827)Schrodinger ZHU Yifan
Reverts llvm/llvm-project#102825
2024-08-11libc: Remove `extern "C"` from main declarations (#102825)David Blaikie
This is invalid in C++, and clang recently started warning on it as of #101853
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-06-17[libc] Fix getauxval being defined in a namespaceJoseph Huber
2024-06-17[libc] Only include getauxval on AARCH64 targets (#95844)Joseph Huber
Summary: Not all platforms support this function or header, but it was being included by every test. Move it inside of the `ifdef` for the only user, which is aarch64.
2024-06-13Reland "[libc] fix aarch64 linux full build (#95358)" (#95423)Schrodinger ZHU Yifan
Reverts llvm/llvm-project#95419 and Reland #95358. This PR is full of temporal fixes. After a discussion with @lntue, it is better to avoid further changes to the cmake infrastructure for now as a rework to the cmake utilities will be landed in the future.
2024-06-13Revert "[libc] fix aarch64 linux full build (#95358)" (#95419)Schrodinger ZHU Yifan
2024-06-13[libc] fix aarch64 linux full build (#95358)Schrodinger ZHU Yifan
2024-05-31[libc] added quick_exit function (#93620)RoseZhang03
- In /libc/src/__support/ OSUtil, changed quick_exit to just exit, and put in namespace LIBC_NAMESPACE::internal. - In /libc/src/stdlib added quick_exit - Added test files for quick_exit
2024-02-22[libc] Rework the GPU build to be a regular target (#81921)Joseph Huber
Summary: This is a massive patch because it reworks the entire build and everything that depends on it. This is not split up because various bots would fail otherwise. I will attempt to describe the necessary changes here. This patch completely reworks how the GPU build is built and targeted. Previously, we used a standard runtimes build and handled both NVPTX and AMDGPU in a single build via multi-targeting. This added a lot of divergence in the build system and prevented us from doing various things like building for the CPU / GPU at the same time, or exporting the startup libraries or running tests without a full rebuild. The new appraoch is to handle the GPU builds as strict cross-compiling runtimes. The first step required https://github.com/llvm/llvm-project/pull/81557 to allow the `LIBC` target to build for the GPU without touching the other targets. This means that the GPU uses all the same handling as the other builds in `libc`. The new expected way to build the GPU libc is with `LLVM_LIBC_RUNTIME_TARGETS=amdgcn-amd-amdhsa;nvptx64-nvidia-cuda`. The second step was reworking how we generated the embedded GPU library by moving it into the library install step. Where we previously had one `libcgpu.a` we now have `libcgpu-amdgpu.a` and `libcgpu-nvptx.a`. This patch includes the necessary clang / OpenMP changes to make that not break the bots when this lands. We unfortunately still require that the NVPTX target has an `internal` target for tests. This is because the NVPTX target needs to do LTO for the provided version (The offloading toolchain can handle it) but cannot use it for the native toolchain which is used for making tests. This approach is vastly superior in every way, allowing us to treat the GPU as a standard cross-compiling target. We can now install the GPU utilities to do things like use the offload tests and other fun things. Some certain utilities need to be built with `--target=${LLVM_HOST_TRIPLE}` as well. I think this is a fine workaround as we will always assume that the GPU `libc` is a cross-build with a functioning host. Depends on https://github.com/llvm/llvm-project/pull/81557
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.
2024-02-05[libc] Refactor _build_gpu_objects cmake function. (#80631)lntue
2024-01-26[libc][NFC] Use specific ASSERT macros to test errno (#79573)Guillaume Chatelet
This patch provides specific test macros to deal with `errno`. This will help abstract away the differences between unit test and integration/hermetic tests in #79319. In one case we use `libc_errno` which is a struct, in the other case we deal directly with `errno`.
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-09-11[libc] Manually set the AMDGPU code object version (#65986)Joseph Huber
Summary: There is currently effort to change over the default AMDGPU code object version https://github.com/llvm/llvm-project/pull/65410. However, this unfortunately causes problems in the LLVM LibC test suite that leads to a hang while executing. This is most likely a bug to do with indirect call optimization, as it can be avoided without optimizations or with manually preventing inlining in the AMDGPU startup code. This patch sets the AMDGPU code object version to be four explicitly on the LibC test suite. This should unblock the efforts to move the default to 5 without breaking the test suite. This isn't a great solution, but there is currently some time pressure to get COV5 landed and this seems to be the easiest solution.
2023-05-15[libc] Make the bump pointer explicitly return null on buffer oveerrunJoseph Huber
We use a simple bump ptr in the `libc` tests. If we run out of data we can currently return other static memory and have weird failure cases. We should fail more explicitly here by returning a null pointer instead. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D150529
2023-05-04[libc] Support global constructors and destructors on NVPTXJoseph Huber
This patch adds the necessary hacks to support global constructors and destructors. This is an incredibly hacky process caused by the primary fact that Nvidia does not provide any binary tools and very little linker support. We first had to emit references to these functions and their priority in D149451. Then we dig them out of the module once it's loaded to manually create the list that the linker should have made for us. This patch also contains a few Nvidia specific hacks, but it passes the test, albeit with a stack size warning from `ptxas` for the callback. But this should be fine given the resource usage of a common test. This also adds a dependency on LLVM to the NVPTX loader, which hopefully doesn't cause problems with our CUDA buildbot. Depends on D149451 Reviewed By: tra Differential Revision: https://reviews.llvm.org/D149527
2023-04-05[libc] Search for the CUDA patch explicitly when testingJoseph Huber
The packaged version of the `libc` library does not depend on the CUDA installation because it only uses `clang` and emits LLVM-IR. However, for testing we directly need the CUDA toolkit to emit and execute the files. This patch explicitly passes `--cuda-path` to the relevant compilations for NVPTX testing. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D147653
2023-03-17[libc] Enable integration tests targeting the GPUJoseph Huber
This patch enables integration tests running on the GPU. This uses the RPC interface implemented in D145913 to compile the necessary dependencies for the integration test object. We can then use this to compile the objects for the GPU directly and execute them using the AMD HSA loader combined with its RPC server. For example, the compiler is performing the following actions to execute the integration tests. ``` $ clang++ --target=amdgcn-amd-amdhsa -mcpu=gfx1030 -nostdlib -flto -ffreestanding \ crt1.o io.o quick_exit.o test.o rpc_client.o args_test.o -o image $ ./amdhsa_loader image 1 2 5 args_test.cpp:24: Expected 'my_streq(argv[3], "3")' to be true, but is false ``` This currently only works with a single threaded client implementation running on AMDGPU. Further work will implement multiple clients for AMD and the ability to run on NVPTX as well. Depends on D145913 Reviewed By: sivachandra, JonChesterfield Differential Revision: https://reviews.llvm.org/D146256
2023-03-15[libc] Add missing return statements to wrapper functionsJoseph Huber
Summary: I forgot to add return statements to these memory comparison functions. This should hopefully resolve some BB errors.
2023-03-15[libc] Add aliases to C memory functions for integration testsJoseph Huber
The integration tests require the C memory functions as the compiler may emit calls to them directly. The tests normally use the `__internal__` variant that is built for testing, but these memory functions were linked directly to preserve the entrypoint. Instead, we forward delcare the internal versions and map the entrypoints to them manually inside the integration test. This allows us to use the internal versions of these files like the rest of the test objects. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D146177
2023-03-13[libc] Declare __dso_handle in the integration test instead of startup.Siva Chandra Reddy
Fixes #61355. The __dso_handle decl was introduced incorrectly into the startup objects during the integration test cleanup which moved the integration tests away from using an artificial sysroot to using -nostdlib. Having it in the startup creates the duplicate symbol error when one does not use -nostdlib. Since this is an integration test only problem, it is meaningful to keep it in the integration test anyway. Differential Revision: https://reviews.llvm.org/D145898
2023-03-05[libc][NFC] Remove allocator definition in the api-test.Siva Chandra Reddy
The integration tests already have allocators so we will get all of them from there.
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.