Skip to content

Commit aaaf125

Browse files
committed
Disable TcpStream test on miri
error: unsupported operation: can't call foreign function: getaddrinfo --> nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:191:21 | 191 | cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: getaddrinfo | = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
1 parent f0774c4 commit aaaf125

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/test.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use serde_bytes::{ByteBuf, Bytes};
2727
use serde_json::value::RawValue;
2828
use serde_json::{
2929
from_reader, from_slice, from_str, from_value, json, to_string, to_string_pretty, to_value,
30-
to_vec, to_writer, Deserializer, Number, Value,
30+
to_vec, Deserializer, Number, Value,
3131
};
3232
use std::collections::hash_map::DefaultHasher;
3333
use std::collections::BTreeMap;
@@ -37,10 +37,8 @@ use std::io;
3737
use std::iter;
3838
use std::marker::PhantomData;
3939
use std::mem;
40-
use std::net;
4140
use std::str::FromStr;
4241
use std::string::ToString;
43-
use std::thread;
4442
use std::{f32, f64};
4543
use std::{i16, i32, i64, i8};
4644
use std::{u16, u32, u64, u8};
@@ -1623,14 +1621,19 @@ fn test_serialize_map_with_no_len() {
16231621
assert_eq!(s, expected);
16241622
}
16251623

1624+
#[cfg(not(miri))]
16261625
#[test]
16271626
fn test_deserialize_from_stream() {
1627+
use serde_json::to_writer;
1628+
use std::net::{TcpListener, TcpStream};
1629+
use std::thread;
1630+
16281631
#[derive(Debug, PartialEq, Serialize, Deserialize)]
16291632
struct Message {
16301633
message: String,
16311634
}
16321635

1633-
let l = net::TcpListener::bind("localhost:20000").unwrap();
1636+
let l = TcpListener::bind("localhost:20000").unwrap();
16341637

16351638
thread::spawn(|| {
16361639
let l = l;
@@ -1647,7 +1650,7 @@ fn test_deserialize_from_stream() {
16471650
}
16481651
});
16491652

1650-
let mut stream = net::TcpStream::connect("localhost:20000").unwrap();
1653+
let mut stream = TcpStream::connect("localhost:20000").unwrap();
16511654
let request = Message {
16521655
message: "hi there".to_string(),
16531656
};

0 commit comments

Comments
 (0)