Skip to content

Commit 2825698

Browse files
committed
Skip part of the test for __BIONIC__
1 parent 9fe61c2 commit 2825698

File tree

1 file changed

+4
-17
lines changed
  • libcxx/test/std/input.output/file.streams/fstreams/filebuf.members

1 file changed

+4
-17
lines changed

libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@
1919
#include "test_macros.h"
2020
#include "platform_support.h"
2121

22-
// If we're building for a lower __ANDROID_API__, the Bionic versioner will
23-
// omit the function declarations from fdsan.h. We might be running on a newer
24-
// API level, though, so declare the API function here using weak.
25-
#if defined(__BIONIC__)
26-
#include <android/fdsan.h>
27-
enum android_fdsan_error_level android_fdsan_set_error_level(enum android_fdsan_error_level new_level)
28-
__attribute__((weak));
29-
#endif
30-
3122
int main(int, char**)
3223
{
3324
std::string temp = get_temp_file_name();
@@ -41,14 +32,10 @@ int main(int, char**)
4132
assert(f.close() == nullptr);
4233
assert(!f.is_open());
4334
}
44-
#if defined(__BIONIC__)
45-
// Starting with Android API 30+, Bionic's fdsan aborts a process that
46-
// attempts to close a file descriptor belonging to something else. Disable
47-
// fdsan to allow closing the FD belonging to std::filebuf's FILE*.
48-
if (android_fdsan_set_error_level != nullptr)
49-
android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
50-
#endif
51-
#if defined(__unix__)
35+
// Starting with Android API 30+, Bionic's fdsan aborts a process that calls
36+
// close() on a file descriptor tagged as belonging to something else (such
37+
// as a FILE*).
38+
#if defined(__unix__) && !defined(__BIONIC__)
5239
{
5340
std::filebuf f;
5441
assert(!f.is_open());

0 commit comments

Comments
 (0)