]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa: add selftest for python pgo marquiz/fixes-9338
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 24 Nov 2017 08:08:05 +0000 (10:08 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 16 Apr 2018 06:54:20 +0000 (09:54 +0300)
Check that we're able to run python profile task on qemu and that python
builds when pgo is enabled.

[YOCTO #9338]

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
meta/lib/oeqa/selftest/cases/python.py [new file with mode: 0644]

diff --git a/meta/lib/oeqa/selftest/cases/python.py b/meta/lib/oeqa/selftest/cases/python.py
new file mode 100644 (file)
index 0000000..9379c42
--- /dev/null
@@ -0,0 +1,29 @@
+import os
+import shutil
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake, get_bb_vars, runCmd
+
+
+class PythonTests(OESelftestTestCase):
+
+    def test_python_pgo(self):
+        bbvars = get_bb_vars(['TMPDIR', 'MACHINE'])
+        profile_dir = os.path.join(bbvars['TMPDIR'], 'oeqa', bbvars['MACHINE'], 'python3-pgo-data')
+
+        self.write_config("""
+PYTHON3_PROFILE_OPT = "1"
+PYTHON3_PROFILE_TASK = "-m test.regrtest test_abc"
+PYTHON3_PROFILE_DIR = "{}"
+""".format(profile_dir))
+
+        profile_file = os.path.join(profile_dir, 'Objects', 'object.gcda')
+
+        bitbake('python-pgo-image -ccleansstate')
+        bitbake('python-pgo-image -cprofile')
+
+        # Check that profile task generated a file
+        self.assertTrue(os.path.isfile(profile_file))
+
+        # Check that python builds with pgo enabled
+        bitbake('python3')