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

stacks-network / stacks-core / 25903914664-1

15 May 2026 06:28AM UTC coverage: 47.122% (-38.8%) from 85.959%
25903914664-1

Pull #7199

github

94e391
web-flow
Merge 109f2828c into 1c7b8e6ac
Pull Request #7199: Feat: L1 and L2 early unlocks, updating signer

103343 of 219309 relevant lines covered (47.12%)

12880462.62 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,560✔
32
            sleep_ms(1000);
1,560✔
33
            if let Ok(success) = rx.try_recv() {
1,560✔
34
                assert!(success);
13✔
35
                done = true;
13✔
36
                break;
13✔
37
            }
1,547✔
38
        }
39

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

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

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

64
    #[test]
65
    #[should_panic]
66
    fn test_test_timeout_panic() {
×
67
        with_timeout(1000, || {
×
68
            panic!("force a panic");
×
69
        })
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