summaryrefslogtreecommitdiff
path: root/libc/test/src/__support/File/file_test.cpp
AgeCommit message (Collapse)Author
2025-08-19[libc] Fix missing close at the end of file test (#154392)Michael Jones
The test added by #150802 was missing a close at the end.
2025-08-19[libc] Fix copy/paste error in file.cpp (#150802)codefaber
Fix using wrong variable due to copy/paste error. --------- Co-authored-by: codefaber <codefaber>
2024-11-01[libc] Remove the #include <stdlib.h> header (#114453)Job Henandez Lara
2024-10-01[libc][stdio] Use proxy headers of stdio.h in src and test folders. (#110067)lntue
https://github.com/llvm/llvm-project/issues/60481
2024-07-08[libc][NFC] Adjust use of off_t internally (#68269)Mikhail R. Gadelha
This patch includes changes related to the use of off_t in libc, targeted at 32-bit systems: in several places, the offset is used either as a long or an off_t (64-bit signed int), but in 32-bit systems a long type is only 32 bits long. Fix a warning in mmap where a long offset is expected, but we were passing an off_t. A static_cast and a comment were added to explain that we know we are ignoring the upper 32-bit of the off_t in 32-bit systems. The code in pread and pwrite was slightly improved to remove a #ifdef LIBC_TARGET_ARCH_IS_RISCV32; we are using an if constexpr now. The Linux file operations were changed to use off_t instead of a long where applicable. No changes were made to the standard API, e.g., ftell returns the offset as an int so we added a static_cast and a comment explaining that this will cause a loss of integer precision in 32-bit systems.
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-06-21[libc] Make close function of the internal File class cleanup the file object.Siva Chandra Reddy
Before this change, a separate static method named cleanup was used to cleanup the file. Instead, now the close method cleans up the full file object using the platform's close function. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D153377
2023-06-19[libc] Remove the requirement of a platform-flush operation in File abstraction.Siva Chandra Reddy
The libc flush operation is not supposed to trigger a platform level flush operation. See "Notes" on this Linux man page: https://man7.org/linux/man-pages/man3/fflush.3.html Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D153182
2023-06-10[libc][NFC] Clean up matchers namespaceGuillaume Chatelet
This is a follow up to https://reviews.llvm.org/D152503 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D152533
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-12-22[libc][NFC] Use operator delete to cleanup a File object.Siva Chandra Reddy
The File API has been refactored to allow cleanup using operator delete. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D140574
2022-12-22[libc] Handle allocation failures gracefully in FILE related API.Siva Chandra Reddy
Few uses of free have not yet been replaced by the custom operator delete yet. They will be done in a follow up patch. Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D140526
2022-12-12[libc] move errno out of file internalsMichael Jones
Now errno is only set by the terminal entrypoints, and not the internal implementations. This patch is part of the larger effort to not set errno in libc internal code: https://github.com/llvm/llvm-project/issues/59278 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D139576
2022-11-07[libc] Add implementations of ftell.Siva Chandra Reddy
Reviewed By: michaelrj, lntue Differential Revision: https://reviews.llvm.org/D137395
2022-06-16[libc] fix line buffered empty file writesMichael Jones
Previously, any line buffered write of size 0 would cause an error. The variable used to track the index of the last newline started at the size of the write - 1, which underflowed. Now it's handled properly, and a test has been added to prevent regressions. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D127914
2022-06-10[libc] add buffering to FILE writesMichael Jones
Previously all FILE objects were fully buffered, this patch adds line buffering and unbuffered output, as well as applying them to stdout and stderr. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D126829
2022-03-23[libc][File] Fix a bug under fseek(..., SEEK_CUR).Siva Chandra Reddy
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D122284
2022-03-16[libc][NFC] Keep the mutex with the base File data structure.Siva Chandra Reddy
This is now possible because we have a platform independent abstraction for mutexes. Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D121773
2022-02-15[libc] Add a platform independent buffered file IO data structure.Siva Chandra Reddy
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D119458