Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | import os, tempfile, subprocess, unittest |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | from oeqa.sdk.case import OESDKTestCase |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 3 | from oeqa.utils.subprocesstweak import errors_have_output |
| 4 | errors_have_output() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 5 | |
| 6 | class BuildLzipTest(OESDKTestCase): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 7 | """ |
| 8 | Test that "plain" compilation works, using just $CC $CFLAGS etc. |
| 9 | """ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | def test_lzip(self): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 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") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 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") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 18 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 19 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) |
| 20 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 21 | os.makedirs(dirs["build"]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 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")) |