Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | import os, tempfile, subprocess, unittest |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 6 | from oeqa.sdk.case import OESDKTestCase |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | from oeqa.utils.subprocesstweak import errors_have_output |
| 8 | errors_have_output() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | |
| 10 | class BuildLzipTest(OESDKTestCase): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 11 | """ |
| 12 | Test that "plain" compilation works, using just $CC $CFLAGS etc. |
| 13 | """ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | def test_lzip(self): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 23 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 24 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 25 | os.makedirs(dirs["build"]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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")) |