Commit Graph

15 Commits

Author SHA1 Message Date
Richard Purdie ffe9604be2 meta/selftest/scripts: Use print function for python3 compatibility
Used print function instead of print statement to make
the code work in python 3.

[Changes from both Ed and Richard]

(From OE-Core rev: ced1995694c394d92cb82fb9c25a33dc027a3b69)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-21 22:26:32 +01:00
Ross Burton c3c0d0ac55 lib/oe/qa: add method to check if static or dynamic linked
It's useful to know if a binary is statically or dynamically linked, so add a
method to determine this.

(From OE-Core rev: 96813445e6618fd8442600d81e53c448310b6e8b)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-26 07:34:58 +00:00
Ross Burton 4495e8bae0 lib/oe/qa: add explicit exception for 'file isn't an ELF'
(From OE-Core rev: 4c1fe0cbcb98b0a69ad5b3a04432055d773ee4ba)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28 11:32:59 +00:00
Ross Burton 7a700f59d9 lib/qa.py: raise ValueError if file isn't an ELF
Instead of raising a generic Exception that can't be handled specifically, raise
a ValueError.  Also update the callers so any unexpected exceptions are not
ignored.

Also, rename isBigEngian() to isBigEndian().

(From OE-Core rev: c136652f9c0b35aafa393e63567daf029ae03929)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-16 11:17:10 +00:00
Ross Burton 334e1b5e0e lib/oe/qa: ELFFile: check that a path is a file before opening it
When opening an ELF file check that a filename points to a normal file before
attempting to open it, as if the file turns out to be something more exotic like
a FIFO it could hang forever.

(From OE-Core rev: 4b3576bc30d8f8cdcde25189def8b059fc92b27c)

(From OE-Core rev: d3af2058e2753516b9aaf7f6d71162363eea11d4)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-16 11:17:10 +00:00
Richard Purdie 534325fd1f image/kernel-module-split/eglibc-ld.inc: Remove has_key() usage
The has_key() attribute has been removed in python 3 since there is better
syntax available. Use the improved syntax.

(From OE-Core rev: 3dff13793e875ff58cc38c4a960caca9b6969843)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:51 +01:00
Richard Purdie c3d18afaa5 classes/recipes/lib: Fix various python whitespace issues
There are some left over tab characters in the python functions. This
removes them and resolves python 3 errors.

(From OE-Core rev: fafeb381c48291fa65c634c01c244843c8d7fad3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:51 +01:00
Richard Purdie 2ac4f8b397 clases/lib: Use modern exception syntax
Update older code to use modern exception handling syntax which
is the form accepted by python 3.

(From OE-Core rev: b010501cd089e649a68f683be0cf4d0aac90fbe3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:50 +01:00
Muhammad Shakeel ef05a7fe17 qa.py: Toolchain path should not be hardcoded to execute objdump
Currently objdump command is invoked from the STAGING_BINDIR_TOOLCHAIN
directory. In case of external toolchain if this directory doesn't
exist then objdump fails to execute. Instead of hardcoding the path
it should search PATH to find it.

(From OE-Core rev: a3a0e29d5d796fdf6755503cc31e45199b79d756)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-06 12:31:13 +00:00
Muhammad Shakeel fafc87112e qa.py: Modify the env for the child process only
Modified environment is only required for new subprocess to execute
objdump command and not for the current process. We should only
modify the copy of env to pass it on to the child.

(From OE-Core rev: cb3b046450b47739daf441a0b964823aff2472e6)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-04 18:02:00 +00:00
Phil Blundell f0a56f6d15 lib/oe/qa: Trap exceptions when running objdump
This avoids propagating a failure if we encounter an ELF file
that objdump can't parse for any reason.  Some versions and/or
configurations of objdump will refuse to read files for "the
wrong" architecture.

(From OE-Core rev: 11f5998e539f7b884ae1387252f8995b2dc7437f)

Signed-off-by: Phil Blundell <pb@pbcl.net>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-18 12:13:49 +01:00
Phil Blundell f8c90bce73 insane: Rationalise phdrs-based QA checks
Various different QA checks are based on essentially the same data from
the ELF program headers.  Calling objdump to extract it repeatedly is
inefficient, particularly if the shell is involved.  Instead, let's
cache the output from objdump inside the qa.elf object and allow it to
be reused by multiple tests.

Also, using objdump instead of scanelf to check for bad RPATHs (in the
same way that the useless-rpaths check was doing already) allows the
dependency on pax-utils-native to be dropped.

(From OE-Core rev: bf19eeb9f65e91bf2b5d89e7c0b099c55d7c15ff)

Signed-off-by: Phil Blundell <philb@gnu.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-18 12:13:49 +01:00
Mark Hatle 18420c4112 qa.py: Fix a typo when evaluating bitsize
This should be setting a variable, not performing a comparison.

(From OE-Core rev: cbe1b8277c610e8e31d1270757877300532bed56)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-03 23:49:19 +00:00
Mark Hatle 78c2b79d54 insane.bbclass: Fix ELF bitsize comparison
Fix the way the ELF size is compared to ensure that incorrectly
sized ELF binaries are captured during the file scan.

lib/oe/qa.py is changed to accept a bitsize as a parameter.  Instead
of previously defining true/false, it now takes "0" undefined, "32"
32-bit, and "64" 64-bit as the size argument.  This allows us to
preserve existing behavior of only loading one ELF type, while
allowing the function to be able to discover the size on it's own.

(From OE-Core rev: 17dae13fabe2932a47ecc86fcafb1d177226513f)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-03 16:57:44 +00:00
Joshua Lock ac023d775b lib/oe: Import oe lib from OE.dev
This library moves the common Python methods into modules of an 'oe' Python
package.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
2010-05-06 12:48:05 +01:00