1# 2# SPDX-License-Identifier: MIT 3# 4 5import os, tempfile, subprocess, unittest 6from oeqa.sdk.case import OESDKTestCase 7from oeqa.utils.subprocesstweak import errors_have_output 8errors_have_output() 9 10class BuildLzipTest(OESDKTestCase): 11 """ 12 Test that "plain" compilation works, using just $CC $CFLAGS etc. 13 """ 14 def test_lzip(self): 15 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") 17 18 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") 22 23 subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) 24 self.assertTrue(os.path.isdir(dirs["source"])) 25 os.makedirs(dirs["build"]) 26 27 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")) 38