summaryrefslogtreecommitdiff
path: root/libc/test/src/stdio/fileop_test.cpp
AgeCommit message (Collapse)Author
2025-11-18[libc] Fix -Wshorten-64-to-32 in fileop_test. (#168451)Alexey Samsonov
Explicitly cast 0 to size_t type to match fread() return type. This follows the pattern used elsewhere in this file, and fixes -Wshorten-64-to-32 warnings when building the test.
2025-10-22Revert "[libc] Add -Werror for libc tests" (#164684)lntue
Reverts llvm/llvm-project#160413
2025-10-22[libc] Add -Werror for libc tests (#160413)Vinay Deshmukh
Relates to https://github.com/llvm/llvm-project/issues/119281 Note: 1) As this PR enables `-Werror` for `libc` tests, it's very likely some downstream CI's may fail / start failing, so it's very likely this PR may need to be reverted and re-applied. P.S. I do not have merge permissions, so I will need one of the reviews to merge it for me. Thank you!
2025-07-21[libc][stdio] Separate temporary files for unit test and hermetic test in ↵lntue
stdio test suite. (#149740)
2025-06-17Fix/reapply "[libc] Migrate stdio tests to ErrnoCheckingTest. (#144134)Alexey Samsonov
This reverts commit 92a116c4ef822950f8c57eaa5164c844c73a1f7e with a fix for fgets test - convert nullptr to fgets return type (char*), since the matcher is pedantic.
2025-06-13Revert "Fix/reapply "[libc] Migrate stdio tests to ErrnoCheckingTest."" ↵Alexey Samsonov
(#144129) Reverts llvm/llvm-project#143972 - matcher seems to be pedantic for fgets tests, reverting to verify and fix.
2025-06-13Fix/reapply "[libc] Migrate stdio tests to ErrnoCheckingTest." (#143972)Alexey Samsonov
This reverts commit a93e55e57ed00a55f822c64e3520c7c732b58480 and fixes build and test failures: * Proper include added to setvbuf_test.cpp * fgetc/fgetc_unlocked/fgets tests are ported to ErrnoSetterMatcher and are made more precise. This fixes inconsistencies between expectations in regular and GPU builds - ErrnoSetterMatcher is configured to omit errno matching on GPUs, as fgetc implementation on GPU doesn't set errno, in contrast to Linux.
2025-06-11Revert "[libc] Migrate stdio tests to ErrnoCheckingTest." (#143829)Alexey Samsonov
Reverts llvm/llvm-project#143802. Follow-up fix 3c7af175e51c3ab08ac3c442146c2b822f38c01e wasn't robust enough and itself got reverted.
2025-06-11[libc] Migrate stdio tests to ErrnoCheckingTest. (#143802)Alexey Samsonov
Reduce the direct use of libc_errno in stdio unit tests by adopting ErrnoCheckingTest where appropriate. Also removes the libc_errno.h inclusions from stdlib.h tests that were accidentally added in d87eea35fac5a34a841c637db8908128409a184e
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
2025-03-14[libc] Fix implicit conversion warnings in tests. (#131362)lntue
2025-02-06[libc][minor] Fix assertion in LlvmLibcFILETest.SimpleFileOperations (#126109)Alan Zhao
The file descriptor of the first opened file is not necessarily 3, so we change the assertion so that it's >= 0 (i.e. not an error.) Fixes #126106
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-03-18[libc] fix up fileno tests (#85660)Nick Desaulniers
Fixes #85628
2024-03-18[libc] Implement fileno (#85628)Shourya Goel
fixes: #85150
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-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-22[libc][NFC] Extend ErrnoSetterMatcher to test expected inequalities. (#67153)Siva Chandra
Before this change, ErrnoSetterMatcher only allowed testing for equality of the expected return and errno values. This change extends it to allow testing for expected inequalities of the return and errno values. The test libc.test.src.stdio.fileop_test has been updated to use the ErrnoSetterMatcher with tests for inequalities.
2023-03-03[libc] move stdlib and stdio to new errno patternMichael Jones
Fixes https://github.com/llvm/llvm-project/issues/61071 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D145191
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-12[libc] remove use after free in tests.Michael Jones
There were some tests added that attempted to access files after they were closed to test errno behavior, this caused sanitizer issues. Those portions of the tests have been disabled. Differential Revision: https://reviews.llvm.org/D139878
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-10-29[libc] Fix the return value of fread and fwrite.Siva Chandra Reddy
They were previously returning the number of bytes read. They should instead be returning the number of objects read.
2022-09-21[libc] add fputs and putsMichael Jones
add fputs, puts, and the EOF macro that they use. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D134328
2022-04-29[libc] Add implementations of feof, ferror and clearerr.Siva Chandra Reddy
The corresponding _unlocked functions have also been added. Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D124311
2022-04-20[libc] Add the implementation of the fflush function.Siva Chandra Reddy
Note that the underlying flush implementation does not yet fully implement the POSIX standard. It is complete with respect to the C standard however. A future change will add the POSIX behavior. It should not affect the implementation of the fflush function however as the POSIX behavior will be added in a lower layer. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D124073
2022-03-24[libc] Add implementations of fopen, flose, fread, fwrite and fseek.Siva Chandra Reddy
A follow up patch will add feof and ferror. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D122327