[libc++][Android] Disable fdsan in filebuf close.pass.cpp (#102412)

fdsan is Bionic's "File Descriptor Sanitizer". Starting in API 30+, it
aborts this close.pass.cpp test, because it closes the FD belonging to
std::filebuf's FILE*. For `__BIONIC__`, disable that part of the test.
This commit is contained in:
Ryan Prichard 2025-05-07 12:27:19 -07:00 committed by GitHub
parent 13c464be84
commit 93aba1e240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,11 +10,6 @@
// basic_filebuf<charT,traits>* close();
// This test closes an fd that belongs to a std::filebuf, and Bionic's fdsan
// detects this and aborts the process, starting in Android R (API 30).
// See D137129.
// XFAIL: LIBCXX-ANDROID-FIXME && !android-device-api={{2[1-9]}}
#include <fstream>
#include <cassert>
#if defined(__unix__)
@ -37,7 +32,10 @@ int main(int, char**)
assert(f.close() == nullptr);
assert(!f.is_open());
}
#if defined(__unix__)
// Starting with Android API 30+, Bionic's fdsan aborts a process that calls
// close() on a file descriptor tagged as belonging to something else (such
// as a FILE*).
#if defined(__unix__) && !defined(__BIONIC__)
{
std::filebuf f;
assert(!f.is_open());