test-framework: fix blktrace,file copy,trim support detection
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
parent
db06ac9d3c
commit
0cd936ee72
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2023-2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
import posixpath
|
import posixpath
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2023-2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
import time
|
||||||
|
|
||||||
from aenum import IntFlag, Enum
|
from aenum import IntFlag, Enum
|
||||||
|
|
||||||
@ -133,6 +136,10 @@ class BlkTrace:
|
|||||||
drop_caches(DropCachesMode.ALL)
|
drop_caches(DropCachesMode.ALL)
|
||||||
|
|
||||||
TestRun.executor.run_expect_success(f"kill -s SIGINT {self.blktrace_pid}")
|
TestRun.executor.run_expect_success(f"kill -s SIGINT {self.blktrace_pid}")
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
if TestRun.executor.check_if_process_exists(self.blktrace_pid):
|
||||||
|
TestRun.fail("blktrace monitoring for device is still active")
|
||||||
self.blktrace_pid = -1
|
self.blktrace_pid = -1
|
||||||
|
|
||||||
# dummy command for swallowing output of killed command
|
# dummy command for swallowing output of killed command
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# 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
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -341,9 +341,13 @@ def wipe_filesystem(device, force=True):
|
|||||||
def check_if_device_supports_trim(device):
|
def check_if_device_supports_trim(device):
|
||||||
if device.get_device_id().startswith("nvme"):
|
if device.get_device_id().startswith("nvme"):
|
||||||
return True
|
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(
|
command_output = TestRun.executor.run(
|
||||||
f'hdparm -I {device.path} | grep "TRIM supported"')
|
f"lsblk -dn {device.path} -o DISC-MAX | grep -o \'[0-9]\\+\'"
|
||||||
return command_output.exit_code == 0
|
)
|
||||||
|
return int(command_output.stdout) > 0
|
||||||
|
|
||||||
|
|
||||||
def get_device_filesystem_type(device_id):
|
def get_device_filesystem_type(device_id):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# 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
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ def copy(source: str,
|
|||||||
cmd = f"cp{' --force' if force else ''}" \
|
cmd = f"cp{' --force' if force else ''}" \
|
||||||
f"{' --recursive' if recursive else ''}" \
|
f"{' --recursive' if recursive else ''}" \
|
||||||
f"{' --dereference' if dereference else ''} " \
|
f"{' --dereference' if dereference else ''} " \
|
||||||
f"\"{source}\" \"{destination}\""
|
f"{source} {destination}"
|
||||||
return TestRun.executor.run_expect_success(cmd)
|
return TestRun.executor.run_expect_success(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user