mirror of
https://git.yoctoproject.org/poky
synced 2026-03-19 13:49:41 +01:00
oeqa/sdk: rewrite lzip test
Don't use the helper class as it gets in the way more than it helps, exercise the out-of-tree paths, and verify the installed files match the expected architecture. (From OE-Core rev: 920ae8c6537c2469f21ab9439587fd094ecc40f6) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
01bee70c31
commit
1d49a3a23a
@@ -1,39 +1,34 @@
|
||||
import unittest
|
||||
import os, tempfile, subprocess, unittest
|
||||
from oeqa.sdk.case import OESDKTestCase
|
||||
from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
|
||||
|
||||
from oeqa.utils.subprocesstweak import errors_have_output
|
||||
errors_have_output()
|
||||
|
||||
class BuildLzipTest(OESDKTestCase):
|
||||
td_vars = ['DATETIME']
|
||||
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
dl_dir = self.td.get('DL_DIR', None)
|
||||
|
||||
self.project = SDKBuildProject(self.tc.sdk_dir + "/lzip/", self.tc.sdk_env,
|
||||
"http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz",
|
||||
self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir)
|
||||
self.project.download_archive()
|
||||
|
||||
def setUp(self):
|
||||
machine = self.td.get("MACHINE")
|
||||
|
||||
if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or
|
||||
self.tc.hasHostPackage("^gcc-", regex=True)):
|
||||
raise unittest.SkipTest("SDK doesn't contain a cross-canadian toolchain")
|
||||
|
||||
"""
|
||||
Test that "plain" compilation works, using just $CC $CFLAGS etc.
|
||||
"""
|
||||
def test_lzip(self):
|
||||
self.assertEqual(self.project.run_configure(), 0,
|
||||
msg="Running configure failed")
|
||||
with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir:
|
||||
dl_dir = self.td.get('DL_DIR', None)
|
||||
tarball = self.fetch(testdir, dl_dir, "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz")
|
||||
|
||||
self.assertEqual(self.project.run_make(), 0,
|
||||
msg="Running make failed")
|
||||
dirs = {}
|
||||
dirs["source"] = os.path.join(testdir, "lzip-1.19")
|
||||
dirs["build"] = os.path.join(testdir, "build")
|
||||
dirs["install"] = os.path.join(testdir, "install")
|
||||
|
||||
self.assertEqual(self.project.run_install(), 0,
|
||||
msg="Running make install failed")
|
||||
subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
|
||||
self.assertTrue(os.path.isdir(dirs["source"]))
|
||||
os.makedirs(dirs["build"])
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
self.project.clean()
|
||||
cmd = """cd {build} && \
|
||||
{source}/configure --srcdir {source} \
|
||||
CXX="$CXX" \
|
||||
CPPFLAGS="$CPPFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" \
|
||||
"""
|
||||
self._run(cmd.format(**dirs))
|
||||
self._run("cd {build} && make -j".format(**dirs))
|
||||
self._run("cd {build} && make install DESTDIR={install}".format(**dirs))
|
||||
self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip"))
|
||||
|
||||
Reference in New Issue
Block a user