Skip to content

run some tests with Miri #2795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- style
- test
- msrv
- miri
- features
- ffi
- ffi-header
Expand Down Expand Up @@ -124,6 +125,27 @@ jobs:
command: check
args: --features full

miri:
name: Test with Miri
needs: [style]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: miri
override: true

- name: Test
# Can't enable tcp feature since Miri does not support the tokio runtime
run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test --features http1,http2,client,server,stream,nightly

features:
name: features
needs: [style]
Expand Down
2 changes: 1 addition & 1 deletion src/body/to_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::HttpBody;
/// # Example
///
/// ```
/// # #[cfg(all(feature = "client", any(feature = "http1", feature = "http2")))]
/// # #[cfg(all(feature = "client", feature = "tcp", any(feature = "http1", feature = "http2")))]
/// # async fn doc() -> hyper::Result<()> {
/// use hyper::{body::HttpBody};
///
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![deny(missing_debug_implementations)]
#![cfg_attr(test, deny(rust_2018_idioms))]
#![cfg_attr(all(test, feature = "full"), deny(unreachable_pub))]
#![cfg_attr(test, deny(warnings))]
#![cfg_attr(all(test, feature = "full"), deny(warnings))]
#![cfg_attr(all(test, feature = "nightly"), feature(test))]
#![cfg_attr(docsrs, feature(doc_cfg))]

Expand Down
3 changes: 3 additions & 0 deletions src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down
48 changes: 48 additions & 0 deletions src/proto/h1/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1474,8 +1474,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut method,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down Expand Up @@ -1504,8 +1507,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(crate::Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1529,8 +1535,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1552,8 +1561,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(crate::Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: true,
Expand All @@ -1577,8 +1589,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(crate::Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down Expand Up @@ -1606,8 +1621,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(crate::Method::GET),
h1_parser_config,
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1632,8 +1650,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(crate::Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1653,8 +1674,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: true,
h09_responses: false,
Expand Down Expand Up @@ -1695,8 +1719,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1718,8 +1745,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down Expand Up @@ -1950,8 +1980,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1973,8 +2006,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(m),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand All @@ -1996,8 +2032,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down Expand Up @@ -2496,8 +2535,11 @@ mod tests {
cached_headers: &mut None,
req_method: &mut Some(Method::GET),
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down Expand Up @@ -2583,8 +2625,11 @@ mod tests {
cached_headers: &mut headers,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down Expand Up @@ -2626,8 +2671,11 @@ mod tests {
cached_headers: &mut headers,
req_method: &mut None,
h1_parser_config: Default::default(),
#[cfg(feature = "runtime")]
h1_header_read_timeout: None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_fut: &mut None,
#[cfg(feature = "runtime")]
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: false,
Expand Down
1 change: 1 addition & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
//! use std::net::SocketAddr;
//! use hyper::{Body, Request, Response, Server};
//! use hyper::service::{make_service_fn, service_fn};
//! # #[cfg(feature = "runtime")]
//! use hyper::server::conn::AddrStream;
//!
//! #[derive(Clone)]
Expand Down