Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | import os |
| 2 | import tempfile |
| 3 | import subprocess |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 4 | import unittest |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 5 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 6 | from oeqa.sdk.case import OESDKTestCase |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 7 | from oeqa.utils.subprocesstweak import errors_have_output |
| 8 | errors_have_output() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | |
| 10 | class BuildCpioTest(OESDKTestCase): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 11 | """ |
| 12 | Check that autotools will cross-compile correctly. |
| 13 | """ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | def test_cpio(self): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 15 | with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: |
| 16 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 18 | dirs = {} |
| 19 | dirs["source"] = os.path.join(testdir, "cpio-2.12") |
| 20 | dirs["build"] = os.path.join(testdir, "build") |
| 21 | dirs["install"] = os.path.join(testdir, "install") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 23 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) |
| 24 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 25 | os.makedirs(dirs["build"]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 27 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) |
| 28 | self._run("cd {build} && make -j".format(**dirs)) |
| 29 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) |
| 30 | |
| 31 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "cpio")) |