mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
test_sort: created a new big file for sort
Before, the sort could work faster and we could be late with the signal. Now we create a new big file, `sort` can't process it in a minute, so we can safely wait for the temporary directory to be created and send a signal afterwards
This commit is contained in:
parent
95e7b53402
commit
ec8e610e48
1 changed files with 16 additions and 1 deletions
|
@ -1117,8 +1117,23 @@ fn test_tmp_files_deleted_on_sigint() {
|
||||||
|
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
at.mkdir("tmp_dir");
|
at.mkdir("tmp_dir");
|
||||||
|
let file_name = "big_file_to_sort.txt";
|
||||||
|
{
|
||||||
|
use rand::Rng;
|
||||||
|
use std::io::Write;
|
||||||
|
let mut file = at.make_file(file_name);
|
||||||
|
// approximately 20 MB
|
||||||
|
for _ in 0..40 {
|
||||||
|
let lines = rand::thread_rng()
|
||||||
|
.sample_iter(rand::distributions::uniform::Uniform::new(0, 10007))
|
||||||
|
.take(100000)
|
||||||
|
.map(|x| x.to_string() + "\n")
|
||||||
|
.collect::<String>();
|
||||||
|
file.write_all(lines.as_bytes()).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
ucmd.args(&[
|
ucmd.args(&[
|
||||||
"ext_sort.txt",
|
file_name,
|
||||||
"--buffer-size=1", // with a small buffer size `sort` will be forced to create a temporary directory very soon.
|
"--buffer-size=1", // with a small buffer size `sort` will be forced to create a temporary directory very soon.
|
||||||
"--temporary-directory=tmp_dir",
|
"--temporary-directory=tmp_dir",
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue