Skip to content

Commit

Permalink
test: fix stack overflow for noise::larger_writes test 1.57-nightly (#…
Browse files Browse the repository at this point in the history
…3515)

Description
---
Remove large slices from the stack in noise tests

Motivation and Context
---
Possible to have a stack overflow when running tests on new nightly

How Has This Been Tested?
---
Tests pass without overflow
  • Loading branch information
sdbondi authored Nov 1, 2021
1 parent e5bf571 commit f2cb924
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions comms/src/noise/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,11 @@ mod test {

let (mut a, mut b) = perform_handshake(dialer, listener).await?;

let buf_send = [1; MAX_PAYLOAD_LENGTH + 1];
a.write_all(&buf_send).await?;
let buf_send = &[1; MAX_PAYLOAD_LENGTH + 1];
a.write_all(buf_send).await?;
a.flush().await?;

let mut buf_receive = [0; MAX_PAYLOAD_LENGTH + 1];
let mut buf_receive = vec![0; MAX_PAYLOAD_LENGTH + 1];
b.read_exact(&mut buf_receive).await?;
assert_eq!(&buf_receive[..], &buf_send[..]);

Expand All @@ -775,11 +775,11 @@ mod test {

let (mut a, mut b) = perform_handshake(dialer, listener).await?;

let buf_send = [1; MAX_PAYLOAD_LENGTH * 2 + 1024];
a.write_all(&buf_send).await?;
let buf_send = &[1; MAX_PAYLOAD_LENGTH * 2 + 1024];
a.write_all(buf_send).await?;
a.flush().await?;

let mut buf_receive = [0; MAX_PAYLOAD_LENGTH * 2 + 1024];
let mut buf_receive = vec![0; MAX_PAYLOAD_LENGTH * 2 + 1024];
b.read_exact(&mut buf_receive).await?;
assert_eq!(&buf_receive[..], &buf_send[..]);

Expand All @@ -792,14 +792,14 @@ mod test {

let (mut a, mut b) = perform_handshake(dialer, listener).await?;

let buf_send = [1; MAX_PAYLOAD_LENGTH];
a.write_all(&buf_send).await?;
let buf_send = &[1; MAX_PAYLOAD_LENGTH];
a.write_all(buf_send).await?;
a.flush().await?;

a.socket.shutdown().await.unwrap();
drop(a);

let mut buf_receive = [0; MAX_PAYLOAD_LENGTH];
let mut buf_receive = vec![0; MAX_PAYLOAD_LENGTH];
b.read_exact(&mut buf_receive).await.unwrap();
assert_eq!(&buf_receive[..], &buf_send[..]);

Expand Down

0 comments on commit f2cb924

Please sign in to comment.