blob: 9504ee8e053ae39b01cdc22e4b75b28c344d9a5d [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001import os
2import tempfile
3import subprocess
Brad Bishop6e60e8b2018-02-01 10:27:11 -05004import unittest
Brad Bishop19323692019-04-05 15:28:33 -04005
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006from oeqa.sdk.case import OESDKTestCase
Brad Bishop19323692019-04-05 15:28:33 -04007from oeqa.utils.subprocesstweak import errors_have_output
8errors_have_output()
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009
10class BuildCpioTest(OESDKTestCase):
Brad Bishop19323692019-04-05 15:28:33 -040011 """
12 Check that autotools will cross-compile correctly.
13 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014 def test_cpio(self):
Brad Bishop19323692019-04-05 15:28:33 -040015 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 Bishop6e60e8b2018-02-01 10:27:11 -050017
Brad Bishop19323692019-04-05 15:28:33 -040018 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 Bishop6e60e8b2018-02-01 10:27:11 -050022
Brad Bishop19323692019-04-05 15:28:33 -040023 subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
24 self.assertTrue(os.path.isdir(dirs["source"]))
25 os.makedirs(dirs["build"])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026
Brad Bishop19323692019-04-05 15:28:33 -040027 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"))