Merge pull request #23 from Kamoppl/kamilg/speed_up_TF

Kamilg/update tf
This commit is contained in:
Katarzyna Treder 2024-11-12 11:24:58 +01:00 committed by GitHub
commit a5a05f4ac2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 12 deletions

View File

@ -211,7 +211,7 @@ def __makereport(cls, item, call, res):
if res.outcome == "skipped": if res.outcome == "skipped":
cls.LOGGER.skip("Test skipped.") cls.LOGGER.skip("Test skipped.")
if res.when == "call" and cls.LOGGER.get_result() == BaseLogResult.FAILED: if res.when in ["call", "setup"] and cls.LOGGER.get_result() >= BaseLogResult.FAILED:
res.outcome = "failed" res.outcome = "failed"
# To print additional message in final test report, assign it to res.longrepr # To print additional message in final test report, assign it to res.longrepr

View File

@ -1,13 +1,14 @@
# #
# Copyright(c) 2019-2021 Intel Corporation # Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2024 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
from enum import Enum from enum import IntEnum
from re import sub from re import sub
class BaseLogResult(Enum): class BaseLogResult(IntEnum):
DEBUG = 10 DEBUG = 10
PASSED = 11 PASSED = 11
WORKAROUND = 12 WORKAROUND = 12

View File

@ -288,8 +288,8 @@ class SataDisk(Disk):
@classmethod @classmethod
def plug_all(cls) -> Output: def plug_all(cls) -> Output:
cmd = ( cmd = (
f"for i in $(find -H /sys/devices/ -path '*/scsi_host/*/scan' -type f); do echo " "find -H /sys/devices/ -path '*/scsi_host/*/scan' -type f |"
f"'- - -' > $i; done;" " xargs -P20 -I % sh -c \"echo '- - -' | tee %\""
) )
output = TestRun.executor.run_expect_success(cmd) output = TestRun.executor.run_expect_success(cmd)
return output return output

View File

@ -1,11 +1,14 @@
# #
# Copyright(c) 2020-2021 Intel Corporation # Copyright(c) 2020-2021 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
import re import re
from core.test_run import TestRun from core.test_run import TestRun
from test_utils.size import Unit from test_utils.size import Unit
from test_utils.os_utils import Udev
class Mdadm: class Mdadm:
@ -33,7 +36,11 @@ class Mdadm:
if conf.size: if conf.size:
cmd += f"--size={int(conf.size.get_value(Unit.KibiByte))} " cmd += f"--size={int(conf.size.get_value(Unit.KibiByte))} "
cmd += device_paths cmd += device_paths
return TestRun.executor.run_expect_success(cmd) ret = TestRun.executor.run_expect_success(cmd)
Udev.trigger()
Udev.settle()
return ret
@staticmethod @staticmethod
def detail(raid_device_paths: str): def detail(raid_device_paths: str):
@ -76,8 +83,6 @@ class Mdadm:
raids = [] raids = []
uuid_path_prefix = "/dev/disk/by-id/md-uuid-" uuid_path_prefix = "/dev/disk/by-id/md-uuid-"
# sometimes links for RAIDs are not properly created, force udev to create them
TestRun.executor.run("udevadm trigger && udevadm settle")
for line in output.stdout.splitlines(): for line in output.stdout.splitlines():
split_line = line.split() split_line = line.split()

View File

@ -381,12 +381,15 @@ def get_udev_service_path(unit_name):
return path return path
def kill_all_io(): def kill_all_io(graceful=True):
if graceful:
# TERM signal should be used in preference to the KILL signal, since a # TERM signal should be used in preference to the KILL signal, since a
# process may install a handler for the TERM signal in order to perform # process may install a handler for the TERM signal in order to perform
# clean-up steps before terminating in an orderly fashion. # clean-up steps before terminating in an orderly fashion.
TestRun.executor.run("killall -q --signal TERM dd fio blktrace") TestRun.executor.run("killall -q --signal TERM dd fio blktrace")
time.sleep(3) time.sleep(3)
TestRun.executor.run("killall -q --signal TERM dd fio blktrace")
time.sleep(3)
TestRun.executor.run("killall -q --signal KILL dd fio blktrace") TestRun.executor.run("killall -q --signal KILL dd fio blktrace")
TestRun.executor.run("kill -9 `ps aux | grep -i vdbench.* | awk '{ print $2 }'`") TestRun.executor.run("kill -9 `ps aux | grep -i vdbench.* | awk '{ print $2 }'`")