1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +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

@ -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