mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
Run tests under panic=abort (#749)
This commit is contained in:
@@ -89,6 +89,16 @@ jobs:
|
||||
- name: Test
|
||||
run: ci/test-stable.sh test
|
||||
|
||||
panic-abort:
|
||||
name: panic=abort tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
run: rustup update $nightly && rustup default $nightly
|
||||
- name: Run tests with -Cpanic=abort
|
||||
run: ci/panic-abort.sh
|
||||
|
||||
# Run tests on some extra platforms
|
||||
cross:
|
||||
name: cross
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
RUSTFLAGS="$RUSTFLAGS -Cpanic=abort -Zpanic-abort-tests" cargo test --all-features --test '*'
|
||||
@@ -291,6 +291,7 @@ fn split_to_uninitialized() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(panic = "unwind"), ignore)]
|
||||
fn split_off_to_at_gt_len() {
|
||||
fn make_bytes() -> Bytes {
|
||||
let mut bytes = BytesMut::with_capacity(100);
|
||||
@@ -1618,6 +1619,7 @@ fn owned_to_vec() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(panic = "unwind"), ignore)]
|
||||
fn owned_safe_drop_on_as_ref_panic() {
|
||||
let buf: [u8; 10] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
let drop_counter = SharedAtomicCounter::new();
|
||||
|
||||
@@ -7,7 +7,7 @@ use bytes::{Buf, Bytes};
|
||||
#[global_allocator]
|
||||
static LEDGER: Ledger = Ledger::new();
|
||||
|
||||
const LEDGER_LENGTH: usize = 2048;
|
||||
const LEDGER_LENGTH: usize = 1024 * 1024;
|
||||
|
||||
struct Ledger {
|
||||
alloc_table: [(AtomicPtr<u8>, AtomicUsize); LEDGER_LENGTH],
|
||||
@@ -31,9 +31,11 @@ impl Ledger {
|
||||
.is_ok()
|
||||
{
|
||||
entry_size.store(size, Ordering::SeqCst);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
panic!("Ledger ran out of space.");
|
||||
}
|
||||
|
||||
fn remove(&self, ptr: *mut u8) -> usize {
|
||||
|
||||
Reference in New Issue
Block a user