blob: 49ae756bf3c4d1b14152dd2603b074ea2ced2c16 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishop19323692019-04-05 15:28:33 -04005import os, tempfile, subprocess, unittest
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 BuildLzipTest(OESDKTestCase):
Brad Bishop19323692019-04-05 15:28:33 -040011 """
12 Test that "plain" compilation works, using just $CC $CFLAGS etc.
13 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014 def test_lzip(self):
Brad Bishop19323692019-04-05 15:28:33 -040015 with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir:
16 tarball = self.fetch(testdir, self.td["DL_DIR"], "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.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, "lzip-1.19")
20 dirs["build"] = os.path.join(testdir, "build")
21 dirs["install"] = os.path.join(testdir, "install")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022
Andrew Geisslerc9f78652020-09-18 14:11:35 -050023 subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT)
Brad Bishop19323692019-04-05 15:28:33 -040024 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 cmd = """cd {build} && \
28 {source}/configure --srcdir {source} \
29 CXX="$CXX" \
30 CPPFLAGS="$CPPFLAGS" \
31 CXXFLAGS="$CXXFLAGS" \
32 LDFLAGS="$LDFLAGS" \
33 """
34 self._run(cmd.format(**dirs))
35 self._run("cd {build} && make -j".format(**dirs))
36 self._run("cd {build} && make install DESTDIR={install}".format(**dirs))
37 self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip"))