1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Tests: provides easy mount of temp fs (#7249)

This commit is contained in:
sreehari prasad 2025-02-01 23:31:49 +05:30 committed by GitHub
parent 3891ee1159
commit c2505841e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 82 additions and 26 deletions

View file

@ -232,7 +232,7 @@ fn test_manpage() {
let test_scenario = TestScenario::new("");
let child = Command::new(test_scenario.bin_path)
let child = Command::new(&test_scenario.bin_path)
.arg("manpage")
.arg("base64")
.stdin(Stdio::piped())

View file

@ -2288,7 +2288,7 @@ fn test_cp_one_file_system() {
use crate::common::util::AtPath;
use walkdir::WalkDir;
let scene = TestScenario::new(util_name!());
let mut scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
// Test must be run as root (or with `sudo -E`)
@ -2304,14 +2304,8 @@ fn test_cp_one_file_system() {
let mountpoint_path = &at_src.plus_as_string(TEST_MOUNT_MOUNTPOINT);
scene
.cmd("mount")
.arg("-t")
.arg("tmpfs")
.arg("-o")
.arg("size=640k") // ought to be enough
.arg("tmpfs")
.arg(mountpoint_path)
.succeeds();
.mount_temp_fs(mountpoint_path)
.expect("mounting tmpfs failed");
at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE);
@ -2324,7 +2318,7 @@ fn test_cp_one_file_system() {
.succeeds();
// Ditch the mount before the asserts
scene.cmd("umount").arg(mountpoint_path).succeeds();
scene.umount_temp_fs();
assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE));
// Check if the other files were copied from the source folder hierarchy

View file

@ -1683,7 +1683,7 @@ fn test_reading_partial_blocks_from_fifo() {
fn test_reading_partial_blocks_from_fifo_unbuffered() {
// Create the FIFO.
let ts = TestScenario::new(util_name!());
let at = ts.fixtures;
let at = &ts.fixtures;
at.mkfifo("fifo");
let fifoname = at.plus_as_string("fifo");

View file

@ -655,7 +655,7 @@ fn test_du_time() {
#[cfg(feature = "touch")]
fn birth_supported() -> bool {
let ts = TestScenario::new(util_name!());
let m = match std::fs::metadata(ts.fixtures.subdir) {
let m = match std::fs::metadata(&ts.fixtures.subdir) {
Ok(m) => m,
Err(e) => panic!("{}", e),
};

View file

@ -137,7 +137,7 @@ fn test_debug_2() {
let result = ts
.ucmd()
.arg("-vv")
.arg(ts.bin_path)
.arg(&ts.bin_path)
.args(&["echo", "hello2"])
.succeeds();
result.stderr_matches(
@ -165,7 +165,7 @@ fn test_debug1_part_of_string_arg() {
let result = ts
.ucmd()
.arg("-vS FOO=BAR")
.arg(ts.bin_path)
.arg(&ts.bin_path)
.args(&["echo", "hello1"])
.succeeds();
result.stderr_matches(
@ -186,7 +186,7 @@ fn test_debug2_part_of_string_arg() {
let result = ts
.ucmd()
.arg("-vvS FOO=BAR")
.arg(ts.bin_path)
.arg(&ts.bin_path)
.args(&["echo", "hello2"])
.succeeds();
result.stderr_matches(

View file

@ -31,7 +31,7 @@ fn test_deleted_dir() {
use std::process::Command;
let ts = TestScenario::new(util_name!());
let at = ts.fixtures;
let at = &ts.fixtures;
let output = Command::new("sh")
.arg("-c")
.arg(format!(