Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | import os, tempfile, subprocess, unittest |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | from oeqa.sdk.case import OESDKTestCase |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 9 | from oeqa.utils.subprocesstweak import errors_have_output |
| 10 | errors_have_output() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | |
| 12 | class BuildLzipTest(OESDKTestCase): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 13 | """ |
| 14 | Test that "plain" compilation works, using just $CC $CFLAGS etc. |
| 15 | """ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 16 | def test_lzip(self): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir: |
| 18 | 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] | 19 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 20 | dirs = {} |
| 21 | dirs["source"] = os.path.join(testdir, "lzip-1.19") |
| 22 | dirs["build"] = os.path.join(testdir, "build") |
| 23 | dirs["install"] = os.path.join(testdir, "install") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 24 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 25 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 26 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 27 | os.makedirs(dirs["build"]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | cmd = """cd {build} && \ |
| 30 | {source}/configure --srcdir {source} \ |
| 31 | CXX="$CXX" \ |
| 32 | CPPFLAGS="$CPPFLAGS" \ |
| 33 | CXXFLAGS="$CXXFLAGS" \ |
| 34 | LDFLAGS="$LDFLAGS" \ |
| 35 | """ |
| 36 | self._run(cmd.format(**dirs)) |
| 37 | self._run("cd {build} && make -j".format(**dirs)) |
| 38 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) |
| 39 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip")) |