summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/sdk/case.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/case.py b/meta/lib/oeqa/sdk/case.py
index 963aa8d358..ea15d6a107 100644
--- a/meta/lib/oeqa/sdk/case.py
+++ b/meta/lib/oeqa/sdk/case.py
@@ -10,3 +10,35 @@ class OESDKTestCase(OETestCase):
10 return subprocess.check_output(". %s > /dev/null; %s;" % \ 10 return subprocess.check_output(". %s > /dev/null; %s;" % \
11 (self.tc.sdk_env, cmd), shell=True, 11 (self.tc.sdk_env, cmd), shell=True,
12 stderr=subprocess.STDOUT, universal_newlines=True) 12 stderr=subprocess.STDOUT, universal_newlines=True)
13
14 def fetch(self, workdir, dl_dir, url, archive=None):
15 if not archive:
16 from urllib.parse import urlparse
17 archive = os.path.basename(urlparse(url).path)
18
19 if dl_dir:
20 tarball = os.path.join(dl_dir, archive)
21 if os.path.exists(tarball):
22 return tarball
23
24 tarball = os.path.join(workdir, archive)
25 subprocess.check_output(["wget", "-O", tarball, url])
26 return tarball
27
28 def check_elf(self, path, target_os=None, target_arch=None):
29 import oe.qa, oe.elf
30
31 elf = oe.qa.ELFFile(path)
32 elf.open()
33
34 if not target_os or not target_arch:
35 output = self._run("echo $OECORE_TARGET_OS:$OECORE_TARGET_ARCH")
36 target_os, target_arch = output.strip().split(":")
37
38 machine_data = oe.elf.machine_dict(None)[target_os][target_arch]
39 (machine, osabi, abiversion, endian, bits) = machine_data
40
41 self.assertEqual(machine, elf.machine())
42 self.assertEqual(bits, elf.abiSize())
43 self.assertEqual(endian, elf.isLittleEndian())
44