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

xd009642 / tarpaulin / #809

27 Jul 2026 08:25AM UTC coverage: 89.107% (-0.09%) from 89.194%
#809

push

web-flow
Bump the cargo group with 10 updates (#1880)

Bumps the cargo group with 10 updates:

| Package | From | To |
| --- | --- | --- |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.106` | `1.0.107` |
| [quote](https://github.com/dtolnay/quote) | `1.0.46` | `1.0.47` |
| [regex](https://github.com/rust-lang/regex) | `1.12.4` | `1.13.1` |
| [rustc-demangle](https://github.com/rust-lang/rustc-demangle) | `0.1.27` | `0.1.28` |
| [serde](https://github.com/serde-rs/serde) | `1.0.228` | `1.0.229` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.150` | `1.0.151` |
| [syn](https://github.com/dtolnay/syn) | `3.0.2` | `3.0.3` |
| [toml](https://github.com/toml-rs/toml) | `1.1.2+spec-1.1.0` | `1.1.3+spec-1.1.0` |
| [glob](https://github.com/rust-lang/glob) | `0.3.3` | `0.3.4` |
| [libc](https://github.com/rust-lang/libc) | `0.2.186` | `0.2.189` |


Updates `proc-macro2` from 1.0.106 to 1.0.107
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.106...1.0.107)

Updates `quote` from 1.0.46 to 1.0.47
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.46...1.0.47)

Updates `regex` from 1.12.4 to 1.13.1
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.12.4...1.13.1)

Updates `rustc-demangle` from 0.1.27 to 0.1.28
- [Release notes](https://github.com/rust-lang/rustc-demangle/releases)
- [Changelog](https://github.com/rust-lang/rustc-demangle/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rustc-demangle/compare/rustc-demangle-v0.1.27...rustc-demangle-v0.1.28)

Updates `serde` from 1.0.228 to 1.0.229
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.228...v1.0.229)

Updates `se... (continued)

7133 of 8005 relevant lines covered (89.11%)

199761.98 hits per line

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

82.43
/src/process_handling/event_source.rs
1
use crate::cargo::rust_flags;
2
use crate::config::Config;
3
use crate::statemachine::*;
4
use crate::{errors::RunError, process_handling::ptrace_control::*};
5
use libc::c_long;
6
use nix::{
7
    sys::{
8
        signal::Signal,
9
        wait::{WaitPidFlag, WaitStatus, waitpid},
10
    },
11
    unistd::Pid,
12
};
13
use procfs::process::{MMapPath, Process};
14
use tracing::info;
15

16
pub trait EventSource {
17
    fn request_trace(&self) -> nix::Result<()>;
18
    fn get_offset(&self, pid: Pid, config: &Config) -> u64;
19
    fn trace_children(&self, pid: Pid) -> nix::Result<()>;
20
    /// This will be at the start of every wait/handle/continue loop so can be used to pop out and
21
    /// apply state changes which occur when tests are running for any mock event sources. In real
22
    /// life the actual processes under test will be modifying things!
23
    fn waitpid(&self, pid: Pid, options: Option<WaitPidFlag>) -> nix::Result<WaitStatus>;
24
    fn next_events(&self, wait_queue: &mut Vec<WaitStatus>) -> Result<Option<TestState>, RunError>;
25
    fn get_event_data(&self, pid: Pid) -> nix::Result<c_long>;
26
    fn continue_pid(&self, pid: Pid, signal: Option<Signal>) -> nix::Result<()>;
27
    fn single_step(&self, pid: Pid) -> nix::Result<()>;
28
    fn detach_child(&self, pid: Pid) -> nix::Result<()>;
29
    fn current_instruction_pointer(&self, pid: Pid) -> nix::Result<c_long>;
30
    fn set_current_instruction_pointer(&self, pid: Pid, addr: u64) -> nix::Result<c_long>;
31
    fn write_address(&self, pid: Pid, addr: u64, data: c_long) -> nix::Result<()>;
32
    fn read_address(&self, pid: Pid, addr: u64) -> nix::Result<c_long>;
33

34
    fn get_tids(&self, pid: Pid) -> Box<dyn Iterator<Item = Pid> + '_>;
35
    fn get_ppid(&self, pid: Pid) -> Option<Pid>;
36
}
37

38
#[derive(Clone)]
39
pub struct PtraceEventSource;
40

41
impl EventSource for PtraceEventSource {
42
    fn request_trace(&self) -> nix::Result<()> {
×
43
        request_trace()
×
44
    }
45

46
    fn get_offset(&self, pid: Pid, config: &Config) -> u64 {
228✔
47
        // TODO I don't think this would be an issue... but I'll test it
48
        if rust_flags(config, &Default::default()).contains("dynamic-no-pic") {
456✔
49
            0
×
50
        } else if let Ok(proc) = Process::new(pid.as_raw()) {
684✔
51
            let exe = proc.exe().ok();
912✔
52
            if let Ok(maps) = proc.maps() {
456✔
53
                let offset_info = maps.iter().find(|x| match (&x.pathname, exe.as_ref()) {
1,368✔
54
                    (MMapPath::Path(p), Some(e)) => p == e,
684✔
55
                    (MMapPath::Path(_), None) => true,
×
56
                    _ => false,
×
57
                });
58
                if let Some(first) = offset_info {
456✔
59
                    first.address.0
228✔
60
                } else {
61
                    0
×
62
                }
63
            } else {
64
                0
×
65
            }
66
        } else {
67
            0
×
68
        }
69
    }
70

71
    fn trace_children(&self, pid: Pid) -> nix::Result<()> {
228✔
72
        trace_children(pid)
456✔
73
    }
74

75
    fn waitpid(&self, pid: Pid, options: Option<WaitPidFlag>) -> nix::Result<WaitStatus> {
1,269,770✔
76
        waitpid(pid, options)
3,809,310✔
77
    }
78

79
    fn next_events(&self, wait_queue: &mut Vec<WaitStatus>) -> Result<Option<TestState>, RunError> {
1,265,290✔
80
        let mut result = Ok(None);
2,530,580✔
81
        let mut running = true;
2,530,580✔
82
        while running {
2,534,856✔
83
            let wait = self.waitpid(
3,808,698✔
84
                Pid::from_raw(-1),
1,269,566✔
85
                Some(WaitPidFlag::WNOHANG | WaitPidFlag::__WALL),
1,269,566✔
86
            );
87
            match wait {
1,269,562✔
88
                Ok(WaitStatus::StillAlive) => {
1,264,114✔
89
                    running = false;
1,264,114✔
90
                }
91
                Ok(WaitStatus::Exited(_, _)) => {
460✔
92
                    wait_queue.push(wait.unwrap());
2,300✔
93
                    result = Ok(Some(TestState::Stopped));
920✔
94
                    running = false;
460✔
95
                }
96
                Ok(WaitStatus::PtraceEvent(_, _, _)) => {
712✔
97
                    wait_queue.push(wait.unwrap());
3,560✔
98
                    result = Ok(Some(TestState::Stopped));
1,424✔
99
                    running = false;
712✔
100
                }
101
                Ok(s) => {
8,552✔
102
                    wait_queue.push(s);
17,104✔
103
                    result = Ok(Some(TestState::Stopped));
4,276✔
104
                }
105
                Err(e) => {
8✔
106
                    running = false;
8✔
107
                    result = Err(RunError::TestRuntime(format!(
4✔
108
                        "An error occurred while waiting for response from test: {e}"
4✔
109
                    )));
110
                }
111
            }
112
        }
113
        result
1,265,290✔
114
    }
115

116
    fn get_event_data(&self, pid: Pid) -> nix::Result<c_long> {
252✔
117
        get_event_data(pid)
504✔
118
    }
119

120
    fn continue_pid(&self, pid: Pid, signal: Option<Signal>) -> nix::Result<()> {
3,648✔
121
        continue_exec(pid, signal)
10,944✔
122
    }
123

124
    fn single_step(&self, pid: Pid) -> nix::Result<()> {
2,006✔
125
        single_step(pid)
4,012✔
126
    }
127

128
    fn detach_child(&self, pid: Pid) -> nix::Result<()> {
4✔
129
        detach_child(pid)
8✔
130
    }
131

132
    fn current_instruction_pointer(&self, pid: Pid) -> nix::Result<c_long> {
4,012✔
133
        current_instruction_pointer(pid)
8,024✔
134
    }
135

136
    fn set_current_instruction_pointer(&self, pid: Pid, addr: u64) -> nix::Result<c_long> {
2,006✔
137
        set_instruction_pointer(pid, addr)
6,018✔
138
    }
139

140
    fn write_address(&self, pid: Pid, address: u64, data: c_long) -> nix::Result<()> {
4,892✔
141
        write_to_address(pid, address, data)
19,568✔
142
    }
143

144
    fn read_address(&self, pid: Pid, address: u64) -> nix::Result<c_long> {
9,990✔
145
        read_address(pid, address)
29,970✔
146
    }
147

148
    fn get_tids(&self, pid: Pid) -> Box<dyn Iterator<Item = Pid> + '_> {
474✔
149
        if let Some(proc) = Process::new(pid.as_raw()).ok().and_then(|x| x.tasks().ok()) {
4,090✔
150
            Box::new(proc.filter_map(Result::ok).map(|x| Pid::from_raw(x.tid)))
3,800✔
151
        } else {
152
            Box::new(std::iter::empty())
44✔
153
        }
154
    }
155

156
    fn get_ppid(&self, pid: Pid) -> Option<Pid> {
238✔
157
        let proc = Process::new(pid.as_raw()).ok()?;
1,190✔
158
        if let Ok(status) = proc.status() {
×
159
            info!("Found potential parent");
×
160
            let pid = Pid::from_raw(status.ppid);
×
161
            Some(pid)
×
162
        } else {
163
            None
×
164
        }
165
    }
166
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc