diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/gtk3.py')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/gtk3.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/gtk3.py b/meta/lib/oeqa/sdk/cases/gtk3.py new file mode 100644 index 0000000000..8f60d5e7da --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/gtk3.py | |||
@@ -0,0 +1,50 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os | ||
8 | import subprocess | ||
9 | import tempfile | ||
10 | import unittest | ||
11 | |||
12 | from oeqa.sdk.case import OESDKTestCase | ||
13 | from oeqa.utils.subprocesstweak import errors_have_output | ||
14 | errors_have_output() | ||
15 | |||
16 | class GTK3Test(OESDKTestCase): | ||
17 | """ | ||
18 | Test that autotools and GTK+ 3 compiles correctly. | ||
19 | """ | ||
20 | def setUp(self): | ||
21 | libc = self.td.get("TCLIBC") | ||
22 | if libc in [ 'newlib' ]: | ||
23 | raise unittest.SkipTest("GTK3Test class: SDK doesn't contain a supported C library") | ||
24 | |||
25 | if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \ | ||
26 | self.tc.hasTargetPackage("libgtk-3.0", multilib=True)): | ||
27 | raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3") | ||
28 | if not (self.tc.hasHostPackage("nativesdk-gettext-dev") or | ||
29 | self.tc.hasHostPackage("gettext-native")): | ||
30 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") | ||
31 | |||
32 | def test_galculator(self): | ||
33 | with tempfile.TemporaryDirectory(prefix="galculator", dir=self.tc.sdk_dir) as testdir: | ||
34 | tarball = self.fetch(testdir, self.td["DL_DIR"], "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2") | ||
35 | |||
36 | dirs = {} | ||
37 | dirs["source"] = os.path.join(testdir, "galculator-2.1.4") | ||
38 | dirs["build"] = os.path.join(testdir, "build") | ||
39 | dirs["install"] = os.path.join(testdir, "install") | ||
40 | |||
41 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
42 | self.assertTrue(os.path.isdir(dirs["source"])) | ||
43 | os.makedirs(dirs["build"]) | ||
44 | |||
45 | self._run("cd {source} && sed -i -e '/s_preferences.*prefs;/d' src/main.c && autoreconf -i -f -I $OECORE_TARGET_SYSROOT/usr/share/aclocal -I m4".format(**dirs)) | ||
46 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) | ||
47 | self._run("cd {build} && make -j".format(**dirs)) | ||
48 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) | ||
49 | |||
50 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "galculator")) | ||