blob: 47d7580fafdadfc51db31067c18d81c9a4789f41 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001import os
2import subprocess
3import tempfile
Brad Bishop6e60e8b2018-02-01 10:27:11 -05004import unittest
5
6from oeqa.sdk.case import OESDKTestCase
Brad Bishop19323692019-04-05 15:28:33 -04007from oeqa.utils.subprocesstweak import errors_have_output
8errors_have_output()
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009
10class GalculatorTest(OESDKTestCase):
Brad Bishop19323692019-04-05 15:28:33 -040011 """
12 Test that autotools and GTK+ 3 compiles correctly.
13 """
14 def setUp(self):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080015 if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \
16 self.tc.hasTargetPackage("libgtk-3.0", multilib=True)):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017 raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3")
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018 if not (self.tc.hasHostPackage("nativesdk-gettext-dev")):
19 raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020
21 def test_galculator(self):
Brad Bishop19323692019-04-05 15:28:33 -040022 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 Bishop6e60e8b2018-02-01 10:27:11 -050024
Brad Bishop19323692019-04-05 15:28:33 -040025 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 Bishop6e60e8b2018-02-01 10:27:11 -050029
Brad Bishop19323692019-04-05 15:28:33 -040030 subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
31 self.assertTrue(os.path.isdir(dirs["source"]))
32 os.makedirs(dirs["build"])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050033
Brad Bishop19323692019-04-05 15:28:33 -040034 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 Bishop6e60e8b2018-02-01 10:27:11 -050038
Brad Bishop19323692019-04-05 15:28:33 -040039 self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "galculator"))