summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/qa.py
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>2012-10-01 18:29:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-10-18 12:13:49 +0100
commitf8c90bce73647f11658edcd2dda9a3c3bfd8b274 (patch)
treeeb762cdab09f992b82582505037f9f6164488f96 /meta/lib/oe/qa.py
parent96b8d721e94e5c7fd226600f4cae2463f0f55760 (diff)
downloadpoky-f8c90bce73647f11658edcd2dda9a3c3bfd8b274.tar.gz
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>
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r--meta/lib/oe/qa.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index d3800128ed..9e5ab587b7 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -28,6 +28,7 @@ class ELFFile:
28 def __init__(self, name, bits = 0): 28 def __init__(self, name, bits = 0):
29 self.name = name 29 self.name = name
30 self.bits = bits 30 self.bits = bits
31 self.objdump_output = {}
31 32
32 def open(self): 33 def open(self):
33 self.file = file(self.name, "r") 34 self.file = file(self.name, "r")
@@ -87,3 +88,19 @@ class ELFFile:
87 import struct 88 import struct
88 (a,) = struct.unpack(self.sex+"H", self.data[18:20]) 89 (a,) = struct.unpack(self.sex+"H", self.data[18:20])
89 return a 90 return a
91
92 def run_objdump(self, cmd, d):
93 import bb.process
94 import sys
95
96 if self.objdump_output.has_key(cmd):
97 return self.objdump_output[cmd]
98
99 objdump = d.getVar('OBJDUMP', True)
100 staging_dir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True)
101
102 env = os.environ
103 env["LC_ALL"] = "C"
104
105 self.objdump_output[cmd] = bb.process.run([ os.path.join(staging_dir, objdump), cmd, self.name ], env=env, shell=False)[0]
106 return self.objdump_output[cmd]