• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacks-network / stacks-core / 25904007932-1

15 May 2026 06:31AM UTC coverage: 47.459% (-38.5%) from 85.959%
25904007932-1

Pull #7210

github

869a54
web-flow
Merge 27877974d into 1c7b8e6ac
Pull Request #7210: [wip] epoch 4 release branch

36 of 53 new or added lines in 1 file covered. (67.92%)

88645 existing lines in 346 files now uncovered.

104136 of 219422 relevant lines covered (47.46%)

12897381.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

56.1
/stackslib/src/util_lib/mod.rs
1
#[macro_use]
2
pub mod db;
3
pub mod bloom;
4
pub mod boot;
5
pub mod signed_structured_data;
6
pub mod strings;
7

8
#[cfg(test)]
9
pub mod test {
10
    use std::sync::mpsc::sync_channel;
11
    use std::{panic, thread};
12

13
    use stacks_common::util::{get_epoch_time_secs, sleep_ms};
14

15
    pub fn with_timeout<F>(timeout_secs: u64, test_func: F)
13✔
16
    where
13✔
17
        F: FnOnce() + std::marker::Send + 'static + panic::UnwindSafe,
13✔
18
    {
19
        let (sx, rx) = sync_channel(1);
13✔
20

21
        let t = thread::spawn(move || {
13✔
22
            let result = panic::catch_unwind(|| {
13✔
23
                test_func();
13✔
24
            });
13✔
25
            let _ = sx.send(result.is_ok());
13✔
26
        });
13✔
27

28
        // wait for test to finish
29
        let deadline = timeout_secs + get_epoch_time_secs();
13✔
30
        let mut done = false;
13✔
31
        while get_epoch_time_secs() <= deadline {
1,354✔
32
            sleep_ms(1000);
1,354✔
33
            if let Ok(success) = rx.try_recv() {
1,354✔
34
                assert!(success);
13✔
35
                done = true;
13✔
36
                break;
13✔
37
            }
1,341✔
38
        }
39

40
        if !done {
13✔
UNCOV
41
            panic!("Test timed out after {} seconds", timeout_secs);
×
42
        }
13✔
43
        t.join().unwrap();
13✔
44
    }
13✔
45

46
    #[test]
UNCOV
47
    fn test_test_timeout() {
×
UNCOV
48
        with_timeout(2000000, || {
×
UNCOV
49
            eprintln!("timeout test start...");
×
UNCOV
50
            sleep_ms(1000);
×
UNCOV
51
            eprintln!("timeout test end");
×
UNCOV
52
        })
×
UNCOV
53
    }
×
54

55
    #[test]
56
    #[should_panic]
UNCOV
57
    fn test_test_timeout_timeout() {
×
UNCOV
58
        with_timeout(1, || {
×
UNCOV
59
            eprintln!("timeout panic test start...");
×
UNCOV
60
            sleep_ms(1000 * 1000);
×
UNCOV
61
        })
×
UNCOV
62
    }
×
63

64
    #[test]
65
    #[should_panic]
UNCOV
66
    fn test_test_timeout_panic() {
×
UNCOV
67
        with_timeout(1000, || {
×
UNCOV
68
            panic!("force a panic");
×
69
        })
UNCOV
70
    }
×
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc