Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | import os |
| 6 | import subprocess |
| 7 | import tempfile |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | import unittest |
| 9 | |
| 10 | from oeqa.sdk.case import OESDKTestCase |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 11 | from oeqa.utils.subprocesstweak import errors_have_output |
| 12 | errors_have_output() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | |
| 14 | class GalculatorTest(OESDKTestCase): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 15 | """ |
| 16 | Test that autotools and GTK+ 3 compiles correctly. |
| 17 | """ |
| 18 | def setUp(self): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \ |
| 20 | self.tc.hasTargetPackage("libgtk-3.0", multilib=True)): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3") |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 22 | if not (self.tc.hasHostPackage("nativesdk-gettext-dev")): |
| 23 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 24 | |
| 25 | def test_galculator(self): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 26 | with tempfile.TemporaryDirectory(prefix="galculator", dir=self.tc.sdk_dir) as testdir: |
| 27 | tarball = self.fetch(testdir, self.td["DL_DIR"], "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | dirs = {} |
| 30 | dirs["source"] = os.path.join(testdir, "galculator-2.1.4") |
| 31 | dirs["build"] = os.path.join(testdir, "build") |
| 32 | dirs["install"] = os.path.join(testdir, "install") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 33 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 34 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) |
| 35 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 36 | os.makedirs(dirs["build"]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 37 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 38 | self._run("cd {source} && autoreconf -i -f -I $OECORE_TARGET_SYSROOT/usr/share/aclocal -I m4".format(**dirs)) |
| 39 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) |
| 40 | self._run("cd {build} && make -j".format(**dirs)) |
| 41 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 42 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 43 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "galculator")) |