From f55c1e073941e6df33a30c5a2df711d0e9887068 Mon Sep 17 00:00:00 2001 From: yanxk Date: Mon, 17 Jul 2023 00:40:36 +0800 Subject: agl-test-framework: add memory test "linus_stress" this test was part of core test, testing memory. it is now part of agl-test-framework. Bug-AGL: SPEC-4345 Signed-off-by: yanxk Change-Id: I04caa643c440de18707ea112c655f694fc62f257 --- tests/linus_stress/__init__.py | 0 tests/linus_stress/run_tests.py | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/linus_stress/__init__.py create mode 100644 tests/linus_stress/run_tests.py (limited to 'tests/linus_stress') diff --git a/tests/linus_stress/__init__.py b/tests/linus_stress/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/linus_stress/run_tests.py b/tests/linus_stress/run_tests.py new file mode 100644 index 0000000..df3157b --- /dev/null +++ b/tests/linus_stress/run_tests.py @@ -0,0 +1,55 @@ +import pytest +import subprocess +import pathlib + +from plugins.agl_test_base import AGLBaseTest + +class LinusStressBase(AGLBaseTest): + def __init__(self): + super().__init__(name="linus_stress") + + def run_test_fun(self): + log_file = self.get_logfile() + cwd_buf = self.get_temp_logdir() + workdir = self.get_workdir() + run_test_cmd = workdir + '/linus_stress' + + with open(log_file, 'w') as log_f: + output = subprocess.run(run_test_cmd, shell=True, + cwd=cwd_buf, stdout=log_f, stderr=log_f) + log_f.close() + + if (output.returncode == 0): + self.case_info_list = {'test_linus_stress': ['test_linus_stress', + '', 'passed']} + else: + self.case_info_list = {'test_linus_stress': ['test_linus_stress', + '', 'failed']} + + def precheck(self): + test_location = self.get_workdir() + "/linus_stress" + pathObj = pathlib.Path(test_location) + return super().precheck() and pathObj.is_file() + +@pytest.fixture(scope='module') +def testbase(): + #init instance for test + instance = LinusStressBase() + + yield instance + + #package log files and make report file + instance.log_report() + +def precheck(): + instance = LinusStressBase() + return instance.precheck() +skip_msg = "The current environment does not match the test requirements." +pytestmark = pytest.mark.skipif(precheck() == False, reason = skip_msg) + +def test_linus_stress(testbase: LinusStressBase): + testbase.run_test_fun() + assert testbase.case_info_list['test_linus_stress'][2] == 'passed' + +if __name__ == '__main__': + pytest.main("-s run_tests") -- cgit 1.2.3-korg