diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/makefile.py')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/makefile.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/makefile.py b/meta/lib/oeqa/sdk/cases/makefile.py new file mode 100644 index 0000000000..2ff54ce25f --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/makefile.py | |||
@@ -0,0 +1,39 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os, tempfile, subprocess | ||
8 | from oeqa.sdk.case import OESDKTestCase | ||
9 | from oeqa.utils.subprocesstweak import errors_have_output | ||
10 | errors_have_output() | ||
11 | |||
12 | class MakefileTest(OESDKTestCase): | ||
13 | """ | ||
14 | Test that "plain" compilation works, using just $CC $CFLAGS etc. | ||
15 | """ | ||
16 | def test_lzip(self): | ||
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") | ||
19 | |||
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") | ||
24 | |||
25 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
26 | self.assertTrue(os.path.isdir(dirs["source"])) | ||
27 | os.makedirs(dirs["build"]) | ||
28 | |||
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")) | ||