Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Erik Botö" <erik.boto@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] testexport: Add support for testcase utils
Date: Tue, 18 Sep 2018 11:20:19 +0200	[thread overview]
Message-ID: <20180918092019.14722-1-erik.boto@gmail.com> (raw)

Add the possibility to ship a lib/oeqa/runtime/cases/utils directory
that will be included in the generated testexport tarball.

This makes it easier to split common functionality from test suites
into modules that can be imported from multiple test suites.
---
 meta/classes/testexport.bbclass | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index d070f07afa..e67e5842d6 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -74,6 +74,21 @@ def testexport_main(d):
 
     copy_needed_files(d, tc)
 
+def get_runtime_cases_utils_paths(d):
+    """
+    Returns a list of paths where testcase utils must reside. Utils can be e.g.
+    common functionality used by multiple test cases.
+
+    Testcase utils are expected in <LAYER_DIR>/lib/oeqa/runtime/cases/utils/
+    """
+    paths = []
+
+    for layer in d.getVar('BBLAYERS').split():
+        path = os.path.join(layer, 'lib/oeqa/runtime/cases/utils')
+        if os.path.isdir(path):
+            paths.append(path)
+    return paths
+
 def copy_needed_files(d, tc):
     import shutil
     import oe.path
@@ -108,6 +123,8 @@ def copy_needed_files(d, tc):
         else:
             shutil.copy2(src, dst)
 
+
+
     # Remove cases and just copy the ones specified
     cases_path = os.path.join(export_path, 'lib', 'oeqa', 'runtime', 'cases')
     oe.path.remove(cases_path)
@@ -121,6 +138,15 @@ def copy_needed_files(d, tc):
         if json_file:
             shutil.copy2(json_file, cases_path)
 
+
+    # Copy cases/utils provided by layers
+    utils_dest_path = os.path.join(export_path, 'lib', 'oeqa', 'runtime', 'cases', 'utils')
+    utils_source_paths = get_runtime_cases_utils_paths(d)
+
+    for f in utils_source_paths:
+        if os.path.isdir(f):
+            oe.path.copytree(f, utils_dest_path)
+
     # Copy test data
     image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
                             d.getVar('IMAGE_LINK_NAME')))
-- 
2.19.0.rc1



             reply	other threads:[~2018-09-18  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18  9:20 Erik Botö [this message]
2018-09-18  9:35 ` ✗ patchtest: failure for testexport: Add support for testcase utils Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180918092019.14722-1-erik.boto@gmail.com \
    --to=erik.boto@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox