Skip to content

Commit 340d728

Browse files
authored
Run Miri everywhere (#269)
* Explicitly mark all tests where MIRI doesn't run * Update the github action to run miri on the entire library
1 parent ad8ff1f commit 340d728

File tree

22 files changed

+71
-5
lines changed

22 files changed

+71
-5
lines changed

.github/workflows/miri.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44

55
jobs:
6-
profiler-test:
6+
run-miri:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
@@ -13,7 +13,6 @@ jobs:
1313
toolchain: nightly
1414
override: true
1515
components: miri
16-
- run: cd ${GITHUB_WORKSPACE}/profiling && MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test
17-
- run: cd ${GITHUB_WORKSPACE}/profiling-ffi && MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test
16+
- run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test
1817
# We need to disable isolation because
1918
# "unsupported operation: `clock_gettime` with `REALTIME` clocks not available when isolation is enabled"

ddcommon/src/connector/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ mod tests {
132132
use super::*;
133133

134134
#[test]
135+
#[cfg_attr(miri, ignore)]
135136
/// Verify that the Connector type implements the correct bound Connect + Clone
136137
/// to be able to use the hyper::Client
137138
fn test_hyper_client_from_connector() {
138139
let _: hyper::Client<Connector> = hyper::Client::builder().build(Connector::new());
139140
}
140141

141142
#[tokio::test]
143+
#[cfg_attr(miri, ignore)]
142144
/// Verify that Connector will only allow non tls connections if root certificates
143145
/// are not found
144146
async fn test_missing_root_certificates_only_allow_http_connections() {

ddtelemetry-ffi/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ mod test_c_ffi {
118118
use ddcommon::{parse_uri, Endpoint};
119119

120120
#[test]
121+
#[cfg_attr(miri, ignore)]
121122
fn test_set_builder_str_param() {
122123
let mut builder = std::ptr::null_mut();
123124

@@ -176,6 +177,7 @@ mod test_c_ffi {
176177
}
177178

178179
#[test]
180+
#[cfg_attr(miri, ignore)]
179181
fn test_set_builder_enum_param() {
180182
let mut builder = std::ptr::null_mut();
181183

@@ -226,6 +228,7 @@ mod test_c_ffi {
226228
}
227229

228230
#[test]
231+
#[cfg_attr(miri, ignore)]
229232
fn test_worker_run() {
230233
unsafe {
231234
let mut builder = std::ptr::null_mut();

ddtelemetry/src/worker/http_client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ mod tests {
105105
use super::*;
106106

107107
#[tokio::test]
108+
#[cfg_attr(miri, ignore)]
108109
async fn test_mock_client() {
109110
let output: Vec<u8> = Vec::new();
110111
let c = MockClient {

ipc/src/platform/unix/platform_handle.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ mod tests {
185185
}
186186

187187
#[test]
188+
#[cfg_attr(miri, ignore)]
188189
fn test_platform_handles_fd_handling() {
189190
let mut file = tempfile::tempfile().unwrap();
190191
assert_file_is_open_for_writing!(file);
@@ -205,6 +206,7 @@ mod tests {
205206
}
206207

207208
#[test]
209+
#[cfg_attr(miri, ignore)]
208210
fn test_platform_handle_fd_borrowing() {
209211
let mut file = tempfile::tempfile().unwrap();
210212
assert_file_is_open_for_writing!(file);

ipc/tarpc/tarpc/src/client.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ mod tests {
629629
use tracing::Span;
630630

631631
#[tokio::test]
632+
#[cfg_attr(miri, ignore)]
632633
async fn response_completes_request_future() {
633634
let (mut dispatch, mut _channel, mut server_channel) = set_up();
634635
let cx = &mut Context::from_waker(noop_waker_ref());
@@ -650,6 +651,7 @@ mod tests {
650651
}
651652

652653
#[tokio::test]
654+
#[cfg_attr(miri, ignore)]
653655
async fn dispatch_response_cancels_on_drop() {
654656
let (cancellation, mut canceled_requests) = cancellations();
655657
let (_, mut response) = oneshot::channel();
@@ -665,6 +667,7 @@ mod tests {
665667
}
666668

667669
#[tokio::test]
670+
#[cfg_attr(miri, ignore)]
668671
async fn dispatch_response_doesnt_cancel_after_complete() {
669672
let (cancellation, mut canceled_requests) = cancellations();
670673
let (tx, mut response) = oneshot::channel();
@@ -689,6 +692,7 @@ mod tests {
689692
}
690693

691694
#[tokio::test]
695+
#[cfg_attr(miri, ignore)]
692696
async fn stage_request() {
693697
let (mut dispatch, mut channel, _server_channel) = set_up();
694698
let cx = &mut Context::from_waker(noop_waker_ref());
@@ -707,6 +711,7 @@ mod tests {
707711

708712
// Regression test for https://github.com/google/tarpc/issues/220
709713
#[tokio::test]
714+
#[cfg_attr(miri, ignore)]
710715
async fn stage_request_channel_dropped_doesnt_panic() {
711716
let (mut dispatch, mut channel, mut server_channel) = set_up();
712717
let cx = &mut Context::from_waker(noop_waker_ref());
@@ -729,6 +734,7 @@ mod tests {
729734

730735
#[allow(unstable_name_collisions)]
731736
#[tokio::test]
737+
#[cfg_attr(miri, ignore)]
732738
async fn stage_request_response_future_dropped_is_canceled_before_sending() {
733739
let (mut dispatch, mut channel, _server_channel) = set_up();
734740
let cx = &mut Context::from_waker(noop_waker_ref());
@@ -745,6 +751,7 @@ mod tests {
745751

746752
#[allow(unstable_name_collisions)]
747753
#[tokio::test]
754+
#[cfg_attr(miri, ignore)]
748755
async fn stage_request_response_future_dropped_is_canceled_after_sending() {
749756
let (mut dispatch, mut channel, _server_channel) = set_up();
750757
let cx = &mut Context::from_waker(noop_waker_ref());
@@ -766,6 +773,7 @@ mod tests {
766773
}
767774

768775
#[tokio::test]
776+
#[cfg_attr(miri, ignore)]
769777
async fn stage_request_response_closed_skipped() {
770778
let (mut dispatch, mut channel, _server_channel) = set_up();
771779
let cx = &mut Context::from_waker(noop_waker_ref());

ipc/tarpc/tarpc/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@
171171
//! # future::ready(format!("Hello, {name}!"))
172172
//! # }
173173
//! # }
174-
//! # #[cfg(not(feature = "tokio1"))]
174+
//! # #[cfg(any(not(feature = "tokio1"), miri))]
175175
//! # fn main() {}
176-
//! # #[cfg(feature = "tokio1")]
176+
//! # #[cfg(all(feature = "tokio1", not(miri)))]
177177
//! #[tokio::main]
178178
//! async fn main() -> anyhow::Result<()> {
179179
//! let (client_transport, server_transport) = tarpc::transport::channel::unbounded();

ipc/tarpc/tarpc/src/server.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ mod tests {
896896
}
897897

898898
#[tokio::test]
899+
#[cfg_attr(miri, ignore)]
899900
async fn base_channel_start_send_duplicate_request_returns_error() {
900901
let (mut channel, _tx) = test_channel::<(), ()>();
901902

@@ -918,6 +919,7 @@ mod tests {
918919
}
919920

920921
#[tokio::test]
922+
#[cfg_attr(miri, ignore)]
921923
async fn base_channel_poll_next_aborts_multiple_requests() {
922924
let (mut channel, _tx) = test_channel::<(), ()>();
923925

@@ -949,6 +951,7 @@ mod tests {
949951
}
950952

951953
#[tokio::test]
954+
#[cfg_attr(miri, ignore)]
952955
async fn base_channel_poll_next_aborts_canceled_request() {
953956
let (mut channel, mut tx) = test_channel::<(), ()>();
954957

@@ -978,6 +981,7 @@ mod tests {
978981
}
979982

980983
#[tokio::test]
984+
#[cfg_attr(miri, ignore)]
981985
async fn base_channel_with_closed_transport_and_in_flight_request_returns_pending() {
982986
let (mut channel, tx) = test_channel::<(), ()>();
983987

@@ -999,6 +1003,7 @@ mod tests {
9991003
}
10001004

10011005
#[tokio::test]
1006+
#[cfg_attr(miri, ignore)]
10021007
async fn base_channel_with_closed_transport_and_no_in_flight_requests_returns_closed() {
10031008
let (mut channel, tx) = test_channel::<(), ()>();
10041009
drop(tx);
@@ -1009,6 +1014,7 @@ mod tests {
10091014
}
10101015

10111016
#[tokio::test]
1017+
#[cfg_attr(miri, ignore)]
10121018
async fn base_channel_poll_next_yields_request() {
10131019
let (mut channel, mut tx) = test_channel::<(), ()>();
10141020
tx.send(fake_request(())).await.unwrap();
@@ -1020,6 +1026,7 @@ mod tests {
10201026
}
10211027

10221028
#[tokio::test]
1029+
#[cfg_attr(miri, ignore)]
10231030
async fn base_channel_poll_next_aborts_request_and_yields_request() {
10241031
let (mut channel, mut tx) = test_channel::<(), ()>();
10251032

@@ -1044,6 +1051,7 @@ mod tests {
10441051
}
10451052

10461053
#[tokio::test]
1054+
#[cfg_attr(miri, ignore)]
10471055
async fn base_channel_start_send_removes_in_flight_request() {
10481056
let (mut channel, _tx) = test_channel::<(), ()>();
10491057

@@ -1067,6 +1075,7 @@ mod tests {
10671075
}
10681076

10691077
#[tokio::test]
1078+
#[cfg_attr(miri, ignore)]
10701079
async fn in_flight_request_drop_cancels_request() {
10711080
let (mut requests, mut tx) = test_requests::<(), ()>();
10721081
tx.send(fake_request(())).await.unwrap();
@@ -1087,6 +1096,7 @@ mod tests {
10871096
}
10881097

10891098
#[tokio::test]
1099+
#[cfg_attr(miri, ignore)]
10901100
async fn in_flight_requests_successful_execute_doesnt_cancel_request() {
10911101
let (mut requests, mut tx) = test_requests::<(), ()>();
10921102
tx.send(fake_request(())).await.unwrap();
@@ -1105,6 +1115,7 @@ mod tests {
11051115
}
11061116

11071117
#[tokio::test]
1118+
#[cfg_attr(miri, ignore)]
11081119
async fn requests_poll_next_response_returns_pending_when_buffer_full() {
11091120
let (mut requests, _tx) = test_bounded_requests::<(), ()>(0);
11101121

@@ -1156,6 +1167,7 @@ mod tests {
11561167
}
11571168

11581169
#[tokio::test]
1170+
#[cfg_attr(miri, ignore)]
11591171
async fn requests_pump_write_returns_pending_when_buffer_full() {
11601172
let (mut requests, _tx) = test_bounded_requests::<(), ()>(0);
11611173

@@ -1211,6 +1223,7 @@ mod tests {
12111223
}
12121224

12131225
#[tokio::test]
1226+
#[cfg_attr(miri, ignore)]
12141227
async fn requests_pump_read() {
12151228
let (mut requests, mut tx) = test_requests::<(), ()>();
12161229

ipc/tarpc/tarpc/src/server/in_flight_requests.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ mod tests {
137137
use futures_test::task::noop_context;
138138

139139
#[tokio::test]
140+
#[cfg_attr(miri, ignore)]
140141
async fn start_request_increases_len() {
141142
let mut in_flight_requests = InFlightRequests::default();
142143
assert_eq!(in_flight_requests.len(), 0);
@@ -147,6 +148,7 @@ mod tests {
147148
}
148149

149150
#[tokio::test]
151+
#[cfg_attr(miri, ignore)]
150152
async fn polling_expired_aborts() {
151153
let mut in_flight_requests = InFlightRequests::default();
152154
let abort_registration = in_flight_requests
@@ -169,6 +171,7 @@ mod tests {
169171
}
170172

171173
#[tokio::test]
174+
#[cfg_attr(miri, ignore)]
172175
async fn cancel_request_aborts() {
173176
let mut in_flight_requests = InFlightRequests::default();
174177
let abort_registration = in_flight_requests
@@ -185,6 +188,7 @@ mod tests {
185188
}
186189

187190
#[tokio::test]
191+
#[cfg_attr(miri, ignore)]
188192
async fn remove_request_doesnt_abort() {
189193
let mut in_flight_requests = InFlightRequests::default();
190194
assert!(in_flight_requests.deadlines.is_empty());

ipc/tarpc/tarpc/src/server/limits/requests_per_channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ mod tests {
192192
use tracing::Span;
193193

194194
#[tokio::test]
195+
#[cfg_attr(miri, ignore)]
195196
async fn throttler_in_flight_requests() {
196197
let throttler = MaxRequests {
197198
max_in_flight_requests: 0,
@@ -320,6 +321,7 @@ mod tests {
320321
}
321322

322323
#[tokio::test]
324+
#[cfg_attr(miri, ignore)]
323325
async fn throttler_start_send() {
324326
let throttler = MaxRequests {
325327
max_in_flight_requests: 0,

ipc/tarpc/tarpc/src/transport/channel.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ mod tests {
170170
}
171171

172172
#[tokio::test]
173+
#[cfg_attr(miri, ignore)]
173174
async fn integration() -> anyhow::Result<()> {
174175
let _ = tracing_subscriber::fmt::try_init();
175176

ipc/tarpc/tarpc/tests/service_functional.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl Service for Server {
3636
}
3737

3838
#[tokio::test]
39+
#[cfg_attr(miri, ignore)]
3940
async fn sequential() -> anyhow::Result<()> {
4041
let _ = tracing_subscriber::fmt::try_init();
4142

@@ -58,6 +59,7 @@ async fn sequential() -> anyhow::Result<()> {
5859
}
5960

6061
#[tokio::test]
62+
#[cfg_attr(miri, ignore)]
6163
async fn dropped_channel_aborts_in_flight_requests() -> anyhow::Result<()> {
6264
#[tarpc_plugins::service]
6365
trait Loop {
@@ -108,6 +110,7 @@ async fn dropped_channel_aborts_in_flight_requests() -> anyhow::Result<()> {
108110

109111
#[cfg(all(feature = "serde-transport", feature = "tcp"))]
110112
#[tokio::test]
113+
#[cfg_attr(miri, ignore)]
111114
async fn serde_tcp() -> anyhow::Result<()> {
112115
use tarpc::serde_transport;
113116
use tokio_serde::formats::Json;
@@ -138,6 +141,7 @@ async fn serde_tcp() -> anyhow::Result<()> {
138141

139142
#[cfg(all(feature = "serde-transport", feature = "unix", unix))]
140143
#[tokio::test]
144+
#[cfg_attr(miri, ignore)]
141145
async fn serde_uds() -> anyhow::Result<()> {
142146
use tarpc::serde_transport;
143147
use tokio_serde::formats::Json;
@@ -168,6 +172,7 @@ async fn serde_uds() -> anyhow::Result<()> {
168172
}
169173

170174
#[tokio::test]
175+
#[cfg_attr(miri, ignore)]
171176
async fn concurrent() -> anyhow::Result<()> {
172177
let _ = tracing_subscriber::fmt::try_init();
173178

@@ -192,6 +197,7 @@ async fn concurrent() -> anyhow::Result<()> {
192197
}
193198

194199
#[tokio::test]
200+
#[cfg_attr(miri, ignore)]
195201
async fn concurrent_join() -> anyhow::Result<()> {
196202
let _ = tracing_subscriber::fmt::try_init();
197203

@@ -217,6 +223,7 @@ async fn concurrent_join() -> anyhow::Result<()> {
217223
}
218224

219225
#[tokio::test]
226+
#[cfg_attr(miri, ignore)]
220227
async fn concurrent_join_all() -> anyhow::Result<()> {
221228
let _ = tracing_subscriber::fmt::try_init();
222229

@@ -240,6 +247,7 @@ async fn concurrent_join_all() -> anyhow::Result<()> {
240247
}
241248

242249
#[tokio::test]
250+
#[cfg_attr(miri, ignore)]
243251
async fn counter() -> anyhow::Result<()> {
244252
#[tarpc::service]
245253
trait Counter {

ipc/tests/blocking_client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use datadog_ipc::example_interface::{
1414
};
1515

1616
#[test]
17+
#[cfg_attr(miri, ignore)]
1718
fn test_blocking_client() {
1819
let (sock_a, sock_b) = StdUnixStream::pair().unwrap();
1920
// Setup async server

ipc/tests/flock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub extern "C" fn flock_test_entrypoint() {
3030
}
3131

3232
#[test]
33+
#[cfg_attr(miri, ignore)]
3334
fn test_file_locking_works_as_expected() {
3435
let d = tempdir().unwrap();
3536
let lock_path = d.path().join("file.lock");

0 commit comments

Comments
 (0)