[yocto] [meta-security][PATCH] Add runtime test for some scripts in redhat-security package
Stefan Stanacar
stefanx.stanacar at intel.com
Thu Sep 5 09:12:38 PDT 2013
Now that the testimage class from core has the ability to run tests from other
layers it makes sens to add a basic runtime test here.
This runs some basic scripts from the redhat-security package that this layer provides.
Signed-off-by: Stefan Stanacar <stefanx.stanacar at intel.com>
---
lib/oeqa/runtime/__init__.py | 0
lib/oeqa/runtime/securityscripts.py | 27 +++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 lib/oeqa/runtime/__init__.py
create mode 100644 lib/oeqa/runtime/securityscripts.py
diff --git a/lib/oeqa/runtime/__init__.py b/lib/oeqa/runtime/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/oeqa/runtime/securityscripts.py b/lib/oeqa/runtime/securityscripts.py
new file mode 100644
index 0000000..f78c28d
--- /dev/null
+++ b/lib/oeqa/runtime/securityscripts.py
@@ -0,0 +1,27 @@
+# Runs on target some of the scripts found in redhat-security package
+# The target image should be an rpm one as the scripts themselves call rpm.
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ skipModuleUnless(oeRuntimeTest.hasPackage("redhat-security"), "redhat-security package not installed")
+ skipModuleUnless(oeRuntimeTest.hasFeature("package-management"), "target doesn't have package-management in IMAGE_FEATURES")
+ skipModuleUnless("package_rpm" == oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0], "target doesn't have rpm as primary package manager")
+
+class SecurityScriptsTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ssh')
+ def test_find_chroot(self):
+ (status, output) = self.target.run('find-chroot.sh', 1200)
+ self.assertEqual(status, 0, msg="find-chroot output:\n%s" % output)
+
+ @skipUnlessPassed('test_ssh')
+ def test_find_nodrop_groups(self):
+ (status, output) = self.target.run('find-nodrop-groups.sh', 1200)
+ self.assertEqual(status, 0, msg="find-nodrop-gropus output:\n%s" % output)
+
+ @skipUnlessPassed('test_ssh')
+ def test_find_execstack(self):
+ (status, output) = self.target.run('find-execstack.sh', 1200)
+ self.assertEqual(status, 0, msg="find-execstack output:\n%s" % output)
--
1.8.3.1
More information about the yocto
mailing list