diff options
author | duerpei <duep.fnst@fujitsu.com> | 2022-07-03 16:45:47 +0800 |
---|---|---|
committer | Qiu Tingting <qiutt@fujitsu.com> | 2022-09-30 09:23:36 +0000 |
commit | 85ceffe6e67c45492818e83bec53763a16ce9e72 (patch) | |
tree | c7c614477d7d0a68a847e1726c831d91dcd87fd2 /tests | |
parent | df488024c6c01f1bc35628b303298097083ed350 (diff) |
agl-test-framework: add test set of aio-stress
Add the script file that calls the test set 'aiostress'.
Bug-AGL: SPEC-4345
Signed-off-by: duerpei <duep.fnst@fujitsu.com>
Change-Id: Ib3906fed1f85031d3554342a5555aa3a046b8c09
Diffstat (limited to 'tests')
-rw-r--r-- | tests/aio-stress/__init__.py | 0 | ||||
-rw-r--r-- | tests/aio-stress/run_tests.py | 50 |
2 files changed, 50 insertions, 0 deletions
diff --git a/tests/aio-stress/__init__.py b/tests/aio-stress/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/aio-stress/__init__.py diff --git a/tests/aio-stress/run_tests.py b/tests/aio-stress/run_tests.py new file mode 100644 index 0000000..fc966a1 --- /dev/null +++ b/tests/aio-stress/run_tests.py @@ -0,0 +1,50 @@ +import pytest +import subprocess + +from plugins.agl_test_base import AGLBaseTest + +class AIOBase(AGLBaseTest): + def __init__(self): + super().__init__(name="aio-stress") + + def run_test_fun(self): + log_file = self.get_logfile() + cwd = self.get_temp_logdir() + workdir = self.get_workdir() + run_test = workdir + '/aio-stress -s ' + \ + '$TEST_FILE_SIZE ' + './testfile' + + with open(log_file, 'w') as log_f: + output = subprocess.run(run_test, shell=True, + cwd=cwd, stdout=log_f, stderr=log_f, + env={'TEST_FILE_SIZE': '20M'}) + log_f.close() + + if (output.returncode == 0): + self.case_info_list = {'test_aiostress': ['test_aiostress', + '', 'passed']} + else: + self.case_info_list = {'test_aiostress': ['test_aiostress', + '', 'failed']} + +@pytest.fixture(scope='module') +def testbase(): + #init instance for test + instance = AIOBase() + #run test scripts + instance.run_test_fun() + + yield instance + + #package log files and make report file + instance.log_report() + +def setup_module(testbase: AIOBase): + print("setup function start") + +@pytest.mark.oss_default +def test_aiostress(testbase: AIOBase): + assert testbase.case_info_list['test_aiostress'][2] == 'passed' + +if __name__ == '__main__': + pytest.main("-s run_tests") |