summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-12-11 23:26:36 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-13 16:32:15 +0000
commit6d666b0413336de2e556b2722c5be97ae5cd40ad (patch)
tree0dfbbaeb338ee98d2bb5661989fd956c0194e07b /meta/lib
parent920ae8c6537c2469f21ab9439587fd094ecc40f6 (diff)
downloadopenembedded-core-contrib-6d666b0413336de2e556b2722c5be97ae5cd40ad.tar.gz
openembedded-core-contrib-6d666b0413336de2e556b2722c5be97ae5cd40ad.tar.bz2
openembedded-core-contrib-6d666b0413336de2e556b2722c5be97ae5cd40ad.zip
oeqa/sdk: rewrite cpio test
Don't use the helper class as it gets in the way more than it helps, exercise the out-of-tree paths, and verify the installed files match the expected architecture. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/sdk/cases/buildcpio.py49
1 files changed, 22 insertions, 27 deletions
diff --git a/meta/lib/oeqa/sdk/cases/buildcpio.py b/meta/lib/oeqa/sdk/cases/buildcpio.py
index 6697b12de2..ff3e1347d3 100644
--- a/meta/lib/oeqa/sdk/cases/buildcpio.py
+++ b/meta/lib/oeqa/sdk/cases/buildcpio.py
@@ -1,37 +1,32 @@
+import os
+import tempfile
+import subprocess
import unittest
-from oeqa.sdk.case import OESDKTestCase
-from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
+from oeqa.sdk.case import OESDKTestCase
from oeqa.utils.subprocesstweak import errors_have_output
errors_have_output()
class BuildCpioTest(OESDKTestCase):
- td_vars = ['DATETIME']
-
- @classmethod
- def setUpClass(self):
- dl_dir = self.td.get('DL_DIR', None)
-
- self.project = SDKBuildProject(self.tc.sdk_dir + "/cpio/", self.tc.sdk_env,
- "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz",
- self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir)
- self.project.download_archive()
-
- def setUp(self):
- machine = self.td.get("MACHINE")
- if not self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine):
- raise unittest.SkipTest("SDK doesn't contain a cross-canadian toolchain")
-
+ """
+ Check that autotools will cross-compile correctly.
+ """
def test_cpio(self):
- self.assertEqual(self.project.run_configure(), 0,
- msg="Running configure failed")
+ with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir:
+ dl_dir = self.td.get('DL_DIR', None)
+ tarball = self.fetch(testdir, dl_dir, "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz")
+
+ dirs = {}
+ dirs["source"] = os.path.join(testdir, "cpio-2.12")
+ dirs["build"] = os.path.join(testdir, "build")
+ dirs["install"] = os.path.join(testdir, "install")
- self.assertEqual(self.project.run_make(), 0,
- msg="Running make failed")
+ subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
+ self.assertTrue(os.path.isdir(dirs["source"]))
+ os.makedirs(dirs["build"])
- self.assertEqual(self.project.run_install(), 0,
- msg="Running make install failed")
+ self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs))
+ self._run("cd {build} && make -j".format(**dirs))
+ self._run("cd {build} && make install DESTDIR={install}".format(**dirs))
- @classmethod
- def tearDownClass(self):
- self.project.clean()
+ self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "cpio"))