Skip to content

Commit 92e673f

Browse files
committed
Add new CI test test_read_large_file_bug
Signed-off-by: Jiahao XU <[email protected]>
1 parent 5282f39 commit 92e673f

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

tests/openssh.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
use once_cell::sync::Lazy;
22
use regex::Regex;
3-
use std::env;
4-
use std::io;
5-
use std::io::Write;
6-
use std::net::IpAddr;
7-
use std::path::PathBuf;
8-
use std::time::Duration;
3+
use std::{env, io, io::Write, net::IpAddr, path::PathBuf, process, time::Duration};
94
use tempfile::tempdir;
10-
11-
use tokio::io::{AsyncReadExt, AsyncWriteExt};
125
use tokio::{
6+
io::{AsyncReadExt, AsyncWriteExt},
137
net::{UnixListener, UnixStream},
148
time::sleep,
159
};
@@ -942,3 +936,23 @@ async fn test_sftp_subsystem() {
942936
sftp.close().await.unwrap();
943937
}
944938
}
939+
940+
#[tokio::test]
941+
#[cfg_attr(not(ci), ignore)]
942+
async fn test_read_large_file_bug() {
943+
for session in connects().await {
944+
let bs = 1024;
945+
let count = 20480;
946+
947+
let process::Output { status, stdout, .. } = session
948+
.shell(format!("dd if=/dev/zero bs={bs} count={count}"))
949+
.output()
950+
.await
951+
.unwrap();
952+
953+
assert!(status.success());
954+
955+
assert_eq!(stdout.len(), bs * count);
956+
stdout.iter().copied().for_each(|byte| assert_eq!(byte, 0));
957+
}
958+
}

0 commit comments

Comments
 (0)