diff options
author | duerpei <duep.fnst@fujitsu.com> | 2022-09-23 16:11:48 +0800 |
---|---|---|
committer | duerpei <duep.fnst@fujitsu.com> | 2022-09-23 16:11:48 +0800 |
commit | 5d580b48ba3fc26735f7858461a47a7347baceec (patch) | |
tree | 532776179ccc680867020e467b9dde5790912460 | |
parent | 50df2b6904dc448c2a8c5ed4f974c631fd97b070 (diff) |
agl-test-framework: add test "stress-ng"
Replace "stress" with "stress-ng", the stress-ng package which is
already in OE-core.
Bug-AGL: SPEC-4345
Signed-off-by: duerpei <duep.fnst@fujitsu.com>
Change-Id: Ia79453f2fc82d4aed0a7a405df93d2560da253de
-rw-r--r-- | tests/stress-ng/__init__.py (renamed from tests/stress/__init__.py) | 0 | ||||
-rw-r--r-- | tests/stress-ng/run_tests.py (renamed from tests/stress/run_tests.py) | 26 |
2 files changed, 12 insertions, 14 deletions
diff --git a/tests/stress/__init__.py b/tests/stress-ng/__init__.py index e69de29..e69de29 100644 --- a/tests/stress/__init__.py +++ b/tests/stress-ng/__init__.py diff --git a/tests/stress/run_tests.py b/tests/stress-ng/run_tests.py index d2bc70c..ec6822b 100644 --- a/tests/stress/run_tests.py +++ b/tests/stress-ng/run_tests.py @@ -4,37 +4,35 @@ import pathlib from plugins.agl_test_base import AGLBaseTest -class STRESSBase(AGLBaseTest): +class StressngBase(AGLBaseTest): def __init__(self): - super().__init__(name="stress") + super().__init__(name="stress-ng") def run_test_fun(self): log_file = self.get_logfile() - workdir = self.get_workdir() - run_test = workdir + '/stress ' +\ + run_test = 'stress-ng ' +\ '-i 2 -c 2 --hdd 2 --hdd-bytes 100M --vm 2 --vm-bytes 128M -t 60' with open(log_file, 'w') as log_f: output = subprocess.run(run_test, shell=True, - cwd=workdir, stdout=log_f, stderr=log_f) + stdout=log_f, stderr=log_f) log_f.close() if (output.returncode == 0): - self.case_info_list = {'test_stress': ['test_stress', + self.case_info_list = {'test_stress-ng': ['test_stress-ng', str(output.returncode), 'passed']} else: - self.case_info_list = {'test_stress': ['test_stress', + self.case_info_list = {'test_stress-ng': ['test_stress-ng', str(output.returncode), 'failed']} def precheck(self): - run_test = self.get_workdir() + "/stress" - path_script = pathlib.Path(run_test) - return super().precheck() and path_script.is_file() + path_stress_ng = pathlib.Path("/usr/bin/stress-ng") + return super().precheck() and path_stress_ng.is_file() @pytest.fixture(scope='module') def testbase(): #init instance for test - instance = STRESSBase() + instance = StressngBase() #run test scripts instance.run_test_fun() @@ -44,14 +42,14 @@ def testbase(): instance.log_report() def precheck(): - instance = STRESSBase() + instance = StressngBase() return instance.precheck() skip_msg = "The current environment does not match the test requirements." pytestmark = pytest.mark.skipif(precheck() == False, reason = skip_msg) @pytest.mark.oss_default -def test_stress(testbase: STRESSBase): - assert testbase.case_info_list['test_stress'][1] == '0' +def test_stress_ng(testbase: StressngBase): + assert testbase.case_info_list['test_stress-ng'][1] == '0' if __name__ == '__main__': pytest.main("-s run_tests") |