diff options
author | yanxk <yanxk.fnst@fujitsu.com> | 2023-07-17 00:40:36 +0800 |
---|---|---|
committer | yanxk <yanxk.fnst@fujitsu.com> | 2023-07-17 00:40:36 +0800 |
commit | f55c1e073941e6df33a30c5a2df711d0e9887068 (patch) | |
tree | 1cb7bad3d4286f1368083413ab4f218d1aad025c | |
parent | fb969436af3ebbdc81c15b23ad8b1ef37a8c2694 (diff) |
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 <yanxk.fnst@fujitsu.com>
Change-Id: I04caa643c440de18707ea112c655f694fc62f257
-rw-r--r-- | tests/linus_stress/__init__.py | 0 | ||||
-rw-r--r-- | tests/linus_stress/run_tests.py | 55 |
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/linus_stress/__init__.py b/tests/linus_stress/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/linus_stress/__init__.py 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") |