diff options
Diffstat (limited to 'meta/lib')
-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() | ||