meta-security: add a basic runtime test for scanelf
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.
Signed-off-by Stefan Stanacar <[email protected]>
--- 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
lib/oeqa/runtime/scanelf.py new file +26 -0
@@ -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
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.Signed-off-by Stefan Stanacar <[email protected]>--- 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.pylib/oeqa/runtime/__init__.py new file +0
-0lib/oeqa/runtime/scanelf.py new file +26
-0@@ -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]))