Skip to content

Commit 142d12c

Browse files
committed
[PLAT-364] Add test re-using listening port
1 parent 9fb023b commit 142d12c

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

fortanix-vme/ci-common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function cargo_test {
110110
fi
111111
RUST_BACKTRACE=full ${elf} -- --nocapture > ${out} 2> ${err}
112112

113-
out=$(cat ${out} | grep -v "#" || true)
113+
out=$(cat ${out} | grep -v "^#" || true)
114114
expected=$(cat ./out.expected)
115115

116116
if [ "${out}" == "${expected}" ]; then
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
Bind to socket to 3400
1+
Server run #1
2+
Bind TCP socket to port 3400
23
Listening for incoming connections...
34
Waiting for connection 1
45
Connection 1: Connected
56
Waiting for connection 2
67
Connection 2: Connected
8+
Server run #2
9+
Bind TCP socket to port 3400
10+
Listening for incoming connections...
11+
Waiting for connection 1
12+
Connection 1: Connected
13+
Waiting for connection 2
14+
Connection 2: Connected
15+
Bye bye

fortanix-vme/tests/incoming_connection/src/main.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::net::{IpAddr, Ipv4Addr, Shutdown, SocketAddr, TcpListener};
22
use std::io::{Read, Write};
33

4-
fn main() {
5-
println!("Bind to socket to 3400");
4+
fn server_run() {
5+
println!("Bind TCP socket to port 3400");
66
let listener = TcpListener::bind("127.0.0.1:3400").expect("Bind failed");
77
assert_eq!(listener.local_addr().unwrap(), SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 3400));
88

@@ -28,3 +28,11 @@ fn main() {
2828
}
2929
}
3030
}
31+
32+
fn main() {
33+
for run in 1..=2 {
34+
println!("Server run #{}", run);
35+
server_run()
36+
}
37+
println!("Bye bye");
38+
}

fortanix-vme/tests/incoming_connection/test_interaction.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ while [ true ]
44
do
55
echo "Interacting with test"
66
timeout 1s curl -k localhost:3400 || true
7-
sleep 20s
7+
sleep 5s
88
done

0 commit comments

Comments
 (0)