瀏覽代碼

Add check for compiling in panic=abort without debuginfo

Gary Guo 5 月之前
父節點
當前提交
f4b23267fa

+ 8 - 1
Cargo.lock

@@ -1,6 +1,6 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
-version = 3
+version = 4
 
 [[package]]
 name = "catch_std_exception"
@@ -33,6 +33,13 @@ version = "0.2.158"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
 
+[[package]]
+name = "panic_abort_no_debuginfo"
+version = "0.1.0"
+dependencies = [
+ "unwinding",
+]
+
 [[package]]
 name = "rustc-std-workspace-alloc"
 version = "1.0.0"

+ 1 - 0
Cargo.toml

@@ -13,6 +13,7 @@ members = [
     "test_crates/throw_and_catch",
     "test_crates/catch_std_exception",
     "test_crates/std_catch_exception",
+    "test_crates/panic_abort_no_debuginfo",
 ]
 
 [dependencies]

+ 7 - 0
test_crates/panic_abort_no_debuginfo/Cargo.toml

@@ -0,0 +1,7 @@
+[package]
+name = "panic_abort_no_debuginfo"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+unwinding = { path = "../../", features = ["panic"] }

+ 11 - 0
test_crates/panic_abort_no_debuginfo/check.sh

@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -o pipefail
+
+# Skip the test if need -Zbuild-std, it somehow doesn't work.
+if [ -n "$BUILD_STD" ]; then
+    exit 0
+fi
+
+export CARGO_TARGET_DIR=$(mktemp -d)
+trap "rm -rf $CARGO_TARGET_DIR" EXIT
+RUSTFLAGS="-Cpanic=abort -Cdebuginfo=0" ${CARGO:-cargo} build --release $BUILD_STD 2>&1

+ 3 - 0
test_crates/panic_abort_no_debuginfo/src/main.rs

@@ -0,0 +1,3 @@
+extern crate unwinding;
+
+fn main() {}

+ 1 - 0
tests/compile_tests.rs

@@ -8,6 +8,7 @@ fn main() {
         "throw_and_catch",
         "catch_std_exception",
         "std_catch_exception",
+        "panic_abort_no_debuginfo",
     ];
 
     for test in tests {