CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
70 lines
2.6 KiB
C++
70 lines
2.6 KiB
C++
//===-- llvm/unittest/Support/SignalsTest.cpp - Signals unit tests --------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// This file contains unit tests for Signals.cpp and Signals.inc.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Support/Signals.h"
|
|
#include "llvm/ADT/ScopeExit.h"
|
|
#include "llvm/Config/config.h"
|
|
#include "gmock/gmock.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::sys;
|
|
using testing::MatchesRegex;
|
|
using testing::Not;
|
|
|
|
#define TAG_BEGIN "\\{\\{\\{"
|
|
#define TAG_END "\\}\\}\\}"
|
|
// %p in the Symbolizer Markup Format spec
|
|
#define P_REGEX "(0+|0x[0-9a-fA-F]+)"
|
|
// %i in the Symbolizer Markup Format spec
|
|
#define I_REGEX "(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)"
|
|
|
|
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES && \
|
|
(defined(__linux__) || defined(__FreeBSD__) || \
|
|
defined(__FreeBSD_kernel__) || defined(__NetBSD__))
|
|
// Test relies on the binary this test is linked into having a GNU build ID
|
|
// note, which is not universally enabled by default (even when using Clang).
|
|
// Disable until we can reliably detect whether this is the case and skip it if
|
|
// not. See https://github.com/llvm/llvm-project/issues/168891.
|
|
#if 0
|
|
TEST(SignalsTest, PrintsSymbolizerMarkup) {
|
|
scope_exit Exit([]() { unsetenv("LLVM_ENABLE_SYMBOLIZER_MARKUP"); });
|
|
setenv("LLVM_ENABLE_SYMBOLIZER_MARKUP", "1", 1);
|
|
std::string Res;
|
|
raw_string_ostream RawStream(Res);
|
|
PrintStackTrace(RawStream);
|
|
EXPECT_THAT(Res, MatchesRegex(TAG_BEGIN "reset" TAG_END ".*"));
|
|
// Module line for main binary
|
|
EXPECT_THAT(Res,
|
|
MatchesRegex(".*" TAG_BEGIN
|
|
"module:0:[^:]*SupportTests:elf:[0-9a-f]+" TAG_END
|
|
".*"));
|
|
// Text segment for main binary
|
|
EXPECT_THAT(Res, MatchesRegex(".*" TAG_BEGIN "mmap:" P_REGEX ":" I_REGEX
|
|
":load:0:rx:" P_REGEX TAG_END ".*"));
|
|
// Backtrace line
|
|
EXPECT_THAT(Res, MatchesRegex(".*" TAG_BEGIN "bt:0:" P_REGEX ".*"));
|
|
}
|
|
#endif
|
|
|
|
TEST(SignalsTest, SymbolizerMarkupDisabled) {
|
|
scope_exit Exit([]() { unsetenv("LLVM_DISABLE_SYMBOLIZATION"); });
|
|
setenv("LLVM_DISABLE_SYMBOLIZATION", "1", 1);
|
|
std::string Res;
|
|
raw_string_ostream RawStream(Res);
|
|
PrintStackTrace(RawStream);
|
|
EXPECT_THAT(Res, Not(MatchesRegex(TAG_BEGIN "reset" TAG_END ".*")));
|
|
}
|
|
|
|
#endif // defined(HAVE_BACKTRACE) && ...
|