blob: b7483bfea517ae4eb35ab645aa5f7755bdcc72e1 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001import os, tempfile, subprocess, unittest
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002from oeqa.sdk.case import OESDKTestCase
Brad Bishop19323692019-04-05 15:28:33 -04003from oeqa.utils.subprocesstweak import errors_have_output
4errors_have_output()
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005
6class BuildLzipTest(OESDKTestCase):
Brad Bishop19323692019-04-05 15:28:33 -04007 """
8 Test that "plain" compilation works, using just $CC $CFLAGS etc.
9 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010 def test_lzip(self):
Brad Bishop19323692019-04-05 15:28:33 -040011 with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir:
12 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 -050013
Brad Bishop19323692019-04-05 15:28:33 -040014 dirs = {}
15 dirs["source"] = os.path.join(testdir, "lzip-1.19")
16 dirs["build"] = os.path.join(testdir, "build")
17 dirs["install"] = os.path.join(testdir, "install")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018
Brad Bishop19323692019-04-05 15:28:33 -040019 subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
20 self.assertTrue(os.path.isdir(dirs["source"]))
21 os.makedirs(dirs["build"])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022
Brad Bishop19323692019-04-05 15:28:33 -040023 cmd = """cd {build} && \
24 {source}/configure --srcdir {source} \
25 CXX="$CXX" \
26 CPPFLAGS="$CPPFLAGS" \
27 CXXFLAGS="$CXXFLAGS" \
28 LDFLAGS="$LDFLAGS" \
29 """
30 self._run(cmd.format(**dirs))
31 self._run("cd {build} && make -j".format(**dirs))
32 self._run("cd {build} && make install DESTDIR={install}".format(**dirs))
33 self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip"))