summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/agl_test_base.py3
-rw-r--r--tests/aio-stress/__init__.py0
-rw-r--r--tests/aio-stress/run_tests.py50
3 files changed, 53 insertions, 0 deletions
diff --git a/plugins/agl_test_base.py b/plugins/agl_test_base.py
index 6888d34..1a2c602 100644
--- a/plugins/agl_test_base.py
+++ b/plugins/agl_test_base.py
@@ -17,6 +17,9 @@ class AGLBaseTest:
def get_name(self):
return self.name
+ def get_temp_logdir(self):
+ return conf.TMP_LOGS_DIR + self.name
+
def get_temp_logfile(self):
return conf.get_log_file(self.name)
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")