Skip some BIO_gets tests if tmpfile fails on Android

On Android, when running from an APK, |tmpfile| does not work. See
b/36991167#comment8.

Change-Id: I1415471907e61da5e8c8d1530a2b915fcd991d53
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58845
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
This commit is contained in:
David Benjamin 2023-04-17 17:27:49 -04:00 committed by Boringssl LUCI CQ
parent 6e1e367021
commit c466222feb

View File

@ -427,7 +427,18 @@ TEST(BIOTest, Gets) {
using ScopedFILE = std::unique_ptr<FILE, decltype(&fclose)>;
ScopedFILE file(tmpfile(), fclose);
#if defined(OPENSSL_ANDROID)
// On Android, when running from an APK, |tmpfile| does not work. See
// b/36991167#comment8.
if (!file) {
fprintf(stderr, "tmpfile failed: %s (%d). Skipping file-based tests.\n",
strerror(errno), errno);
continue;
}
#else
ASSERT_TRUE(file);
#endif
if (!t.bio.empty()) {
ASSERT_EQ(1u,
fwrite(t.bio.data(), t.bio.size(), /*nitems=*/1, file.get()));