blob: 515acd2891f568e16061e0434b36c910e16703fd [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
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 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"))