test-framework: fix blktrace,file copy,trim support detection

Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
Kamil Gierszewski
2024-04-11 03:38:43 +02:00
parent db06ac9d3c
commit 0cd936ee72
4 changed files with 17 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
#
# Copyright(c) 2019-2022 Intel Corporation
# Copyright(c) 2023 Huawei Technologies Co., Ltd.
# Copyright(c) 2023-2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -341,9 +341,13 @@ def wipe_filesystem(device, force=True):
def check_if_device_supports_trim(device):
if device.get_device_id().startswith("nvme"):
return True
command_output = TestRun.executor.run(f'hdparm -I {device.path} | grep "TRIM supported"')
if command_output.exit_code == 0:
return True
command_output = TestRun.executor.run(
f'hdparm -I {device.path} | grep "TRIM supported"')
return command_output.exit_code == 0
f"lsblk -dn {device.path} -o DISC-MAX | grep -o \'[0-9]\\+\'"
)
return int(command_output.stdout) > 0
def get_device_filesystem_type(device_id):