summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases/makefile.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/makefile.py')
-rw-r--r--meta/lib/oeqa/sdk/cases/makefile.py45
1 files changed, 45 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..e1e2484820
--- /dev/null
+++ b/meta/lib/oeqa/sdk/cases/makefile.py
@@ -0,0 +1,45 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7import os, tempfile, subprocess
8import unittest
9from oeqa.sdk.case import OESDKTestCase
10from oeqa.utils.subprocesstweak import errors_have_output
11errors_have_output()
12
13class MakefileTest(OESDKTestCase):
14 """
15 Test that "plain" compilation works, using just $CC $CFLAGS etc.
16 """
17 def setUp(self):
18 libc = self.td.get("TCLIBC")
19 if libc in [ 'newlib' ]:
20 raise unittest.SkipTest("MakefileTest class: SDK doesn't contain a supported C library")
21
22 def test_lzip(self):
23 with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir:
24 tarball = self.fetch(testdir, self.td["DL_DIR"], "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz")
25
26 dirs = {}
27 dirs["source"] = os.path.join(testdir, "lzip-1.19")
28 dirs["build"] = os.path.join(testdir, "build")
29 dirs["install"] = os.path.join(testdir, "install")
30
31 subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT)
32 self.assertTrue(os.path.isdir(dirs["source"]))
33 os.makedirs(dirs["build"])
34
35 cmd = """cd {build} && \
36 {source}/configure --srcdir {source} \
37 CXX="$CXX" \
38 CPPFLAGS="$CPPFLAGS" \
39 CXXFLAGS="$CXXFLAGS" \
40 LDFLAGS="$LDFLAGS" \
41 """
42 self._run(cmd.format(**dirs))
43 self._run("cd {build} && make -j".format(**dirs))
44 self._run("cd {build} && make install DESTDIR={install}".format(**dirs))
45 self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip"))