Skip to contentSkip to conversation

meta-security: add a basic runtime test for scanelf

PATCH In review Stefan Stanacar 1 participant 2 messages Sep 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta-security: add a basic runtime test for scanelf

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 uses scanelf from the pax-utils package and scans the binaries in PATH for TEXTREL and RPATH information.

---
 lib/oeqa/runtime/__init__.py |  0
 lib/oeqa/runtime/scanelf.py  | 26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 lib/oeqa/runtime/__init__.py
 create mode 100644 lib/oeqa/runtime/scanelf.py
lib/oeqa/runtime/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
lib/oeqa/runtime/scanelf.py new file +26 -0
new file mode 100644
index 0000000..b9abf24
@@ -0,0 +1,26 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+    if not oeRuntimeTest.hasPackage("pax-utils"):
+        skipModule("pax-utils package not installed")
+
+class ScanelfTest(oeRuntimeTest):
+
+    def setUp(self):
+        self.scancmd = 'scanelf --quiet --recursive --mount --ldpath --path'
+
+    @skipUnlessPassed('test_ssh')
+    def test_scanelf_textrel(self):
+        # print TEXTREL information
+        self.scancmd += " --textrel"
+        (status, output) = self.target.run(self.scancmd)
+        self.assertEqual(output.strip(), "", "\n".join([self.scancmd, output]))
+
+    @skipUnlessPassed('test_ssh')
+    def test_scanelf_rpath(self):
+        # print RPATH information
+        self.scancmd += " --rpath"
+        (status, output) = self.target.run(self.scancmd)
+        self.assertEqual(output.strip(), "", "\n".join([self.scancmd, output]))
Signature · 1 line
1.8.3.1
#1 lore raw

I just noticed that pax-utils is in core and has nothing to do with meta-security, so this is pointless, please ignore.
I'll send some other test for this layer.

Cheers,
Stefan

Quoted 48 lines · Stefan Stanacar

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 uses scanelf from the pax-utils package and scans the binaries in PATH for TEXTREL and RPATH information.

---
 lib/oeqa/runtime/__init__.py |  0
 lib/oeqa/runtime/scanelf.py  | 26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 lib/oeqa/runtime/__init__.py
 create mode 100644 lib/oeqa/runtime/scanelf.py
lib/oeqa/runtime/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
lib/oeqa/runtime/scanelf.py new file +26 -0
new file mode 100644
index 0000000..b9abf24
@@ -0,0 +1,26 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+    if not oeRuntimeTest.hasPackage("pax-utils"):
+        skipModule("pax-utils package not installed")
+
+class ScanelfTest(oeRuntimeTest):
+
+    def setUp(self):
+        self.scancmd = 'scanelf --quiet --recursive --mount --ldpath --path'
+
+    @skipUnlessPassed('test_ssh')
+    def test_scanelf_textrel(self):
+        # print TEXTREL information
+        self.scancmd += " --textrel"
+        (status, output) = self.target.run(self.scancmd)
+        self.assertEqual(output.strip(), "", "\n".join([self.scancmd, output]))
+
+    @skipUnlessPassed('test_ssh')
+    def test_scanelf_rpath(self):
+        # print RPATH information
+        self.scancmd += " --rpath"
+        (status, output) = self.target.run(self.scancmd)
+        self.assertEqual(output.strip(), "", "\n".join([self.scancmd, output]))