[yocto] [meta-security][PATCH] meta-security: add a basic runtime test for scanelf

Stanacar, StefanX stefanx.stanacar at intel.com
Thu Sep 5 02:04:27 PDT 2013


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

On Thu, 2013-09-05 at 11:15 +0300, Stefan Stanacar wrote:
> 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 <stefanx.stanacar at intel.com>
> ---
>  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
> 
> 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/scanelf.py b/lib/oeqa/runtime/scanelf.py
> new file mode 100644
> index 0000000..b9abf24
> --- /dev/null
> +++ b/lib/oeqa/runtime/scanelf.py
> @@ -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]))



More information about the yocto mailing list