[compiler-rt] Log errno (or fuchsia equivalent) on map failures (PR #95391)
Fabio D'Urso via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 08:32:12 PDT 2024
================
@@ -0,0 +1,24 @@
+//===-- utilities.cpp -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gwp_asan/utilities.h"
+#include "gwp_asan/tests/harness.h"
+
+using gwp_asan::Check;
+using gwp_asan::checkWithErrorCode;
+
+TEST(UtilitiesDeathTest, CheckPrintsAsExpected) {
+ EXPECT_DEATH({ Check(false, "Hello world"); }, "Hello world");
+ Check(true, "Should not crash");
+ EXPECT_DEATH(
+ { checkWithErrorCode(false, "Hello world", 1337); },
+ "Hello world \\(Error Code: 1337\\)");
----------------
fabio-d wrote:
It's unfortunate that we can't test the exact output string on Fuchsia, but this is a [known limitation](https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/gwp_asan/tests/harness.h#L18-L23) of zxtest, so I think PR is ok.
https://github.com/llvm/llvm-project/pull/95391
More information about the llvm-commits
mailing list