summaryrefslogtreecommitdiffstats
path: root/rpm/rootfs-scripts/run_tests.py
diff options
context:
space:
mode:
authorduerpei <duep.fnst@fujitsu.com>2022-07-14 14:17:13 +0800
committerduerpei <duep.fnst@fujitsu.com>2022-07-14 14:17:13 +0800
commit761c64f22b8a6c1202a2c9caafda36e154e81d41 (patch)
treebcde3881bed4d48b2b05aff9d8a2990d11445909 /rpm/rootfs-scripts/run_tests.py
parent8e0004e1d751dce49b97b00d65519c92609a213a (diff)
qa-test-misc: demo code submissionneedlefish_13.93.0needlefish/13.93.013.93.0
Submit the test scripts of rpm and glib2, and the file of LICENSE and README Bug-AGL: SPEC-4345 Signed-off-by: duerpei <duep.fnst@fujitsu.com> Change-Id: I2e2311d2864285c4c5da3309486b2e1fa8adc2ec
Diffstat (limited to 'rpm/rootfs-scripts/run_tests.py')
-rw-r--r--rpm/rootfs-scripts/run_tests.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/rpm/rootfs-scripts/run_tests.py b/rpm/rootfs-scripts/run_tests.py
new file mode 100644
index 0000000..8b085c6
--- /dev/null
+++ b/rpm/rootfs-scripts/run_tests.py
@@ -0,0 +1,54 @@
+import pytest
+import subprocess
+
+import plugins.agl_test_utils as agl_test_utils
+import plugins.agl_test_conf as agl_test_conf
+
+import rpm.parser as parser
+import rpm.report as report
+
+WORK_DIR = agl_test_conf.WORK_DIR
+TMP_LOGS_DIR = agl_test_conf.TMP_LOGS_DIR
+
+THIS_TEST = "rpm"
+test_cases_values_and_status = []
+
+def setup_module():
+ agl_test_utils.find_cmd("rpm")
+ agl_test_utils.create_dir(THIS_TEST)
+ run_test_fun()
+ global test_cases_values_and_status
+ test_cases_values_and_status = parser.log_process(TMP_LOGS_DIR,THIS_TEST)
+
+#Run test, and redirect the log into the file of THIS_TEST.log under TMP_LOGS_DIR/THIS_TEST/
+def run_test_fun():
+ log_file = agl_test_conf.get_log_file(THIS_TEST)
+ cwd = WORK_DIR + THIS_TEST + "/resource/"
+ with open(log_file,'w') as log_f:
+ subprocess.run(['sh','rpm_test.sh'],cwd=cwd,stdout=log_f,stderr=log_f)
+ log_f.close()
+
+@pytest.mark.oss_default
+def test_rpm01():
+ global test_cases_values_and_status
+ assert test_cases_values_and_status[1][1] == "TEST-PASS"
+ test_cases_values_and_status[1][2] = "passed"
+
+@pytest.mark.oss_default
+def test_rpm02():
+ global test_cases_values_and_status
+ assert test_cases_values_and_status[2][1] == "TEST-PASS"
+ test_cases_values_and_status[2][2] = "passed"
+
+@pytest.mark.oss_default
+def test_rpm03():
+ global test_cases_values_and_status
+ assert test_cases_values_and_status[3][1] == "TEST-PASS"
+ test_cases_values_and_status[3][2] = "passed"
+
+#Pack the log file and count the test results
+def teardown_module():
+ report.log_report(test_cases_values_and_status,THIS_TEST)
+
+if __name__ == '__main__':
+ pytest.main("-s run_tests")