diff options
| author | Ross Burton <ross.burton@intel.com> | 2018-12-07 21:26:05 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-08 17:17:01 +0000 |
| commit | a9093bc81b286878861e050402c3c4cbf8782575 (patch) | |
| tree | b57c89323783d41299f1d32ea80a94f2a329549c | |
| parent | aa8a9a05c2f50cb9c086bc0ca76a39d4cf40ed75 (diff) | |
| download | poky-a9093bc81b286878861e050402c3c4cbf8782575.tar.gz | |
oeqa/sdk/galculator: rewrite to use new helpers
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/sdk/cases/buildgalculator.py | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py b/meta/lib/oeqa/sdk/cases/buildgalculator.py index 9e12b3ac10..7beb55884d 100644 --- a/meta/lib/oeqa/sdk/cases/buildgalculator.py +++ b/meta/lib/oeqa/sdk/cases/buildgalculator.py | |||
| @@ -1,8 +1,16 @@ | |||
| 1 | import os | ||
| 2 | import subprocess | ||
| 3 | import tempfile | ||
| 1 | import unittest | 4 | import unittest |
| 2 | 5 | ||
| 6 | import bb | ||
| 7 | |||
| 3 | from oeqa.sdk.case import OESDKTestCase | 8 | from oeqa.sdk.case import OESDKTestCase |
| 4 | from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject | 9 | from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject |
| 5 | 10 | ||
| 11 | from oeqa.utils.subprocesstweak import errors_have_output | ||
| 12 | errors_have_output() | ||
| 13 | |||
| 6 | class GalculatorTest(OESDKTestCase): | 14 | class GalculatorTest(OESDKTestCase): |
| 7 | td_vars = ['DATETIME'] | 15 | td_vars = ['DATETIME'] |
| 8 | 16 | ||
| @@ -14,23 +22,22 @@ class GalculatorTest(OESDKTestCase): | |||
| 14 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") | 22 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") |
| 15 | 23 | ||
| 16 | def test_galculator(self): | 24 | def test_galculator(self): |
| 17 | dl_dir = self.td.get('DL_DIR', None) | 25 | with tempfile.TemporaryDirectory(prefix="galculator", dir=self.tc.sdk_dir) as testdir: |
| 18 | project = None | 26 | dl_dir = self.td.get('DL_DIR', None) |
| 19 | try: | 27 | tarball = self.fetch(testdir, dl_dir, "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2") |
| 20 | project = SDKBuildProject(self.tc.sdk_dir + "/galculator/", | 28 | |
| 21 | self.tc.sdk_env, | 29 | dirs = {} |
| 22 | "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2", | 30 | dirs["source"] = os.path.join(testdir, "galculator-2.1.4") |
| 23 | self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir) | 31 | dirs["build"] = os.path.join(testdir, "build") |
| 24 | 32 | dirs["install"] = os.path.join(testdir, "install") | |
| 25 | project.download_archive() | 33 | |
| 26 | 34 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) | |
| 27 | # regenerate configure to get support for --with-libtool-sysroot | 35 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 28 | legacy_preconf=("autoreconf -i -f -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal -I m4;") | 36 | |
| 29 | 37 | bb.utils.mkdirhier(dirs["build"]) | |
| 30 | self.assertEqual(project.run_configure(extra_cmds=legacy_preconf), | 38 | self._run("cd {source} && autoreconf -i -f -I $OECORE_TARGET_SYSROOT/usr/share/aclocal -I m4".format(**dirs)) |
| 31 | 0, msg="Running configure failed") | 39 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) |
| 32 | 40 | self._run("cd {build} && make -j".format(**dirs)) | |
| 33 | self.assertEqual(project.run_make(), 0, | 41 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) |
| 34 | msg="Running make failed") | 42 | |
| 35 | finally: | 43 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "galculator")) |
| 36 | project.clean() | ||
