diff options
| author | Ross Burton <ross.burton@intel.com> | 2018-12-11 23:26:36 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-13 16:32:21 +0000 |
| commit | 8e8898bc2d4d9b0f93e19576257534c39018e372 (patch) | |
| tree | 6edd08df195f5b8083f02017ca8d82b1e08db74b | |
| parent | 1d49a3a23ab3ec1a299ce3ce6ad0c8823da7b7a4 (diff) | |
| download | poky-8e8898bc2d4d9b0f93e19576257534c39018e372.tar.gz | |
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.
(From OE-Core rev: 6d666b0413336de2e556b2722c5be97ae5cd40ad)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/sdk/cases/buildcpio.py | 49 |
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 @@ | |||
| 1 | import os | ||
| 2 | import tempfile | ||
| 3 | import subprocess | ||
| 1 | import unittest | 4 | import unittest |
| 2 | from oeqa.sdk.case import OESDKTestCase | ||
| 3 | from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject | ||
| 4 | 5 | ||
| 6 | from oeqa.sdk.case import OESDKTestCase | ||
| 5 | from oeqa.utils.subprocesstweak import errors_have_output | 7 | from oeqa.utils.subprocesstweak import errors_have_output |
| 6 | errors_have_output() | 8 | errors_have_output() |
| 7 | 9 | ||
| 8 | class BuildCpioTest(OESDKTestCase): | 10 | class BuildCpioTest(OESDKTestCase): |
| 9 | td_vars = ['DATETIME'] | 11 | """ |
| 10 | 12 | Check that autotools will cross-compile correctly. | |
| 11 | @classmethod | 13 | """ |
| 12 | def setUpClass(self): | ||
| 13 | dl_dir = self.td.get('DL_DIR', None) | ||
| 14 | |||
| 15 | self.project = SDKBuildProject(self.tc.sdk_dir + "/cpio/", self.tc.sdk_env, | ||
| 16 | "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz", | ||
| 17 | self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir) | ||
| 18 | self.project.download_archive() | ||
| 19 | |||
| 20 | def setUp(self): | ||
| 21 | machine = self.td.get("MACHINE") | ||
| 22 | if not self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine): | ||
| 23 | raise unittest.SkipTest("SDK doesn't contain a cross-canadian toolchain") | ||
| 24 | |||
| 25 | def test_cpio(self): | 14 | def test_cpio(self): |
| 26 | self.assertEqual(self.project.run_configure(), 0, | 15 | with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: |
| 27 | msg="Running configure failed") | 16 | dl_dir = self.td.get('DL_DIR', None) |
| 17 | tarball = self.fetch(testdir, dl_dir, "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz") | ||
| 18 | |||
| 19 | dirs = {} | ||
| 20 | dirs["source"] = os.path.join(testdir, "cpio-2.12") | ||
| 21 | dirs["build"] = os.path.join(testdir, "build") | ||
| 22 | dirs["install"] = os.path.join(testdir, "install") | ||
| 28 | 23 | ||
| 29 | self.assertEqual(self.project.run_make(), 0, | 24 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) |
| 30 | msg="Running make failed") | 25 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 26 | os.makedirs(dirs["build"]) | ||
| 31 | 27 | ||
| 32 | self.assertEqual(self.project.run_install(), 0, | 28 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) |
| 33 | msg="Running make install failed") | 29 | self._run("cd {build} && make -j".format(**dirs)) |
| 30 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) | ||
| 34 | 31 | ||
| 35 | @classmethod | 32 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "cpio")) |
| 36 | def tearDownClass(self): | ||
| 37 | self.project.clean() | ||
