File: fix-test-feature-gates.patch

package info (click to toggle)
rust-tokio-rustls 0.26.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: makefile: 2
file content (84 lines) | stat: -rw-r--r-- 2,230 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From: Maytham Alsudany <maytha8thedev@gmail.com>
Forwarded: no
Description: Fix test feature gates
 Some tests need to be gated behind the "ring" feature, as they relies on the
 availability of a default CryptoProvider (which the "ring" feature in rustls
 sets, and it is enabled by the "ring" feature in tokio-rustls).

--- a/src/common/test_stream.rs
+++ b/src/common/test_stream.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "ring")]
 use std::io::{self, Cursor, Read, Write};
 use std::pin::Pin;
 use std::sync::Arc;
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -15,6 +15,7 @@
 use tokio::{runtime, time};
 use tokio_rustls::{LazyConfigAcceptor, TlsAcceptor, TlsConnector};
 
+#[cfg(feature = "ring")]
 lazy_static! {
     static ref TEST_SERVER: SocketAddr = {
         let (config, _) = utils::make_configs();
@@ -94,6 +95,7 @@
     Ok(())
 }
 
+#[cfg(feature = "ring")]
 async fn pass_impl<S: AsyncRead + AsyncWrite + Unpin>(
     wrapper: impl FnOnce(TcpStream) -> S,
     use_buf_read: bool,
@@ -119,16 +121,19 @@
     Ok(())
 }
 
+#[cfg(feature = "ring")]
 #[tokio::test]
 async fn pass() -> io::Result<()> {
     pass_impl(|stream| stream, false).await
 }
 
+#[cfg(feature = "ring")]
 #[tokio::test]
 async fn pass_buf_read() -> io::Result<()> {
     pass_impl(|stream| stream, true).await
 }
 
+#[cfg(feature = "ring")]
 #[tokio::test]
 async fn fail() -> io::Result<()> {
     let (_, config) = utils::make_configs();
@@ -141,6 +146,7 @@
     Ok(())
 }
 
+#[cfg(feature = "ring")]
 #[tokio::test]
 async fn test_lazy_config_acceptor() -> io::Result<()> {
     let (sconfig, cconfig) = utils::make_configs();
@@ -234,6 +240,7 @@
     Ok(())
 }
 
+#[cfg(feature = "ring")]
 #[tokio::test]
 async fn acceptor_alert() {
     let (sconfig, _) = utils::make_configs();
@@ -318,6 +325,7 @@
     assert_eq!(received, fatal_alert_decode_error)
 }
 
+#[cfg(feature = "ring")]
 #[tokio::test]
 async fn handshake_flush_pending() -> io::Result<()> {
     pass_impl(utils::FlushWrapper::new, false).await
--- a/tests/early-data.rs
+++ b/tests/early-data.rs
@@ -1,4 +1,4 @@
-#![cfg(feature = "early-data")]
+#![cfg(all(feature = "early-data", feature = "ring"))]
 
 use std::io::{self, Read, Write};
 use std::net::{SocketAddr, TcpListener};