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