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