From c5a530f4a162dea9f2e9b1df222d2d82e2ecb5b2 Mon Sep 17 00:00:00 2001 From: Anirban Halder Date: Thu, 2 May 2024 21:55:22 +0530 Subject: [PATCH] Changed ``/sys/kernel/address_bits`` to ``/sys/kernel/profiling`` in test_cp (#6294) * Changed sys/kernel/address_bits to sys/kernel/profiling * Added comments and fixed formatting --------- Co-authored-by: Anirban --- tests/by-util/test_cp.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index c9bb003bc..7db188069 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -3952,13 +3952,13 @@ fn test_cp_debug_reflink_never_sparse_always_empty_file_with_hole() { #[test] #[cfg(target_os = "linux")] fn test_cp_default_virtual_file() { + // This file has existed at least since 2008, so we assume that it is present on "all" Linux kernels. + // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-profiling + use std::os::unix::prelude::MetadataExt; let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; - ts.ucmd() - .arg("/sys/kernel/address_bits") - .arg("b") - .succeeds(); + ts.ucmd().arg("/sys/kernel/profiling").arg("b").succeeds(); let dest_size = std::fs::metadata(at.plus("b")) .expect("Metadata of copied file cannot be read") @@ -4037,11 +4037,13 @@ fn test_cp_debug_reflink_never_sparse_always_non_sparse_file_with_long_zero_sequ #[test] #[cfg(target_os = "linux")] fn test_cp_debug_sparse_always_sparse_virtual_file() { + // This file has existed at least since 2008, so we assume that it is present on "all" Linux kernels. + // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-profiling let ts = TestScenario::new(util_name!()); ts.ucmd() .arg("--debug") .arg("--sparse=always") - .arg("/sys/kernel/address_bits") + .arg("/sys/kernel/profiling") .arg("b") .succeeds() .stdout_contains( @@ -4209,10 +4211,12 @@ fn test_cp_debug_sparse_never_file_with_hole() { #[test] #[cfg(target_os = "linux")] fn test_cp_debug_default_sparse_virtual_file() { + // This file has existed at least since 2008, so we assume that it is present on "all" Linux kernels. + // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-profiling let ts = TestScenario::new(util_name!()); ts.ucmd() .arg("--debug") - .arg("/sys/kernel/address_bits") + .arg("/sys/kernel/profiling") .arg("b") .succeeds() .stdout_contains(