summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/sdk/cases/buildlzip.py61
1 files changed, 28 insertions, 33 deletions
diff --git a/meta/lib/oeqa/sdk/cases/buildlzip.py b/meta/lib/oeqa/sdk/cases/buildlzip.py
index b57fbbece7..a7ca239fb4 100644
--- a/meta/lib/oeqa/sdk/cases/buildlzip.py
+++ b/meta/lib/oeqa/sdk/cases/buildlzip.py
@@ -1,39 +1,34 @@
1import unittest 1import os, tempfile, subprocess, unittest
2from oeqa.sdk.case import OESDKTestCase 2from oeqa.sdk.case import OESDKTestCase
3from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
4
5from oeqa.utils.subprocesstweak import errors_have_output 3from oeqa.utils.subprocesstweak import errors_have_output
6errors_have_output() 4errors_have_output()
7 5
8class BuildLzipTest(OESDKTestCase): 6class BuildLzipTest(OESDKTestCase):
9 td_vars = ['DATETIME'] 7 """
10 8 Test that "plain" compilation works, using just $CC $CFLAGS etc.
11 @classmethod 9 """
12 def setUpClass(self):
13 dl_dir = self.td.get('DL_DIR', None)
14
15 self.project = SDKBuildProject(self.tc.sdk_dir + "/lzip/", self.tc.sdk_env,
16 "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz",
17 self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir)
18 self.project.download_archive()
19
20 def setUp(self):
21 machine = self.td.get("MACHINE")
22
23 if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or
24 self.tc.hasHostPackage("^gcc-", regex=True)):
25 raise unittest.SkipTest("SDK doesn't contain a cross-canadian toolchain")
26
27 def test_lzip(self): 10 def test_lzip(self):
28 self.assertEqual(self.project.run_configure(), 0, 11 with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir:
29 msg="Running configure failed") 12 dl_dir = self.td.get('DL_DIR', None)
30 13 tarball = self.fetch(testdir, dl_dir, "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz")
31 self.assertEqual(self.project.run_make(), 0, 14
32 msg="Running make failed") 15 dirs = {}
33 16 dirs["source"] = os.path.join(testdir, "lzip-1.19")
34 self.assertEqual(self.project.run_install(), 0, 17 dirs["build"] = os.path.join(testdir, "build")
35 msg="Running make install failed") 18 dirs["install"] = os.path.join(testdir, "install")
36 19
37 @classmethod 20 subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
38 def tearDownClass(self): 21 self.assertTrue(os.path.isdir(dirs["source"]))
39 self.project.clean() 22 os.makedirs(dirs["build"])
23
24 cmd = """cd {build} && \
25 {source}/configure --srcdir {source} \
26 CXX="$CXX" \
27 CPPFLAGS="$CPPFLAGS" \
28 CXXFLAGS="$CXXFLAGS" \
29 LDFLAGS="$LDFLAGS" \
30 """
31 self._run(cmd.format(**dirs))
32 self._run("cd {build} && make -j".format(**dirs))
33 self._run("cd {build} && make install DESTDIR={install}".format(**dirs))
34 self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip"))