From: Costin Constantin <costin.c.constantin@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 03/12] utils/decorators.py: add TestNeedsBin() decorator
Date: Fri, 18 Dec 2015 14:40:55 +0200 [thread overview]
Message-ID: <66fc1be529e8b27f03264fdc351c1f8392509f55.1450441923.git.costin.c.constantin@intel.com> (raw)
In-Reply-To: <cover.1450441923.git.costin.c.constantin@intel.com>
In-Reply-To: <cover.1450441923.git.costin.c.constantin@intel.com>
TestNeedsBin() is used in all tests where binaries are required.
It offers functionality to send binaries to DUTs
both in unpacked (raw) and in an .rpm form.
It is able to handle native binaries, intended for the machine
launching tests on DUTs.
It also offers functionality for removing DUTs
related binaries after finishing the test.
Signed-off-by: Costin Constantin <costin.c.constantin@intel.com>
---
meta/lib/oeqa/utils/decorators.py | 48 +++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
index 0d79223..93a728e 100644
--- a/meta/lib/oeqa/utils/decorators.py
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -12,7 +12,9 @@ import sys
import unittest
import threading
import signal
+import re
from functools import wraps
+import testexport as te
#get the "result" object from one of the upper frames provided that one of these upper frames is a unittest.case frame
class getResults(object):
@@ -260,3 +262,49 @@ def timeout_handler(seconds):
else:
return fn
return decorator
+
+class TestNeedsBin(object):
+ """
+ This decorator provides binary support for test cases
+ """
+ def __init__(self, *args):
+ self.params_list = list()
+ self. clean_list = list()
+ if args:# these are tuples of values
+ for param_tuple in args:
+ bn,bv,t, p,rm_b = ("", "", "", "", "")
+ for index,value in enumerate(param_tuple):
+ if index == 0:
+ bn = value
+ elif index == 1 and re.match("[0-9]+\.",value):
+ bv = value
+ elif value == "rpm":
+ p = value
+ elif value == "native":
+ t = value
+ elif value == "rm":
+ rm_b = value
+ self.params_list.append("%s_%s_%s_%s_%s" % (bn, bv, p, t, rm_b))
+
+ def deploy_binary(self, params):
+ from oeqa.oetest import oeRuntimeTest
+ p = params.split("_")
+ if p[3] == "native":
+ te.process_binaries(oeRuntimeTest.tc.d, params)
+ else:
+ status = te.process_binaries(oeRuntimeTest.tc.d, params)
+ if status:
+ bin_to_rm = te.send_bin_to_DUT(oeRuntimeTest.tc.d, params)
+ if bin_to_rm:
+ self.clean_list.extend(bin_to_rm)
+
+ def __call__(self, func):
+ def wrapped_f(*args):
+ for item in set(self.params_list):
+ self.deploy_binary(item)
+ func(*args)
+ te.rm_bin(self.clean_list) # used to remove sent binaries
+ return
+ wrapped_f.__name__ = func.__name__
+ return wrapped_f
+
--
2.5.0
next prev parent reply other threads:[~2015-12-18 12:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 12:40 [PATCH 00/12] Include binaries in test cases and update runexported.py Costin Constantin
2015-12-18 12:40 ` [PATCH 01/12] oeqa/utils/testexport.py: add functionality for exporting binaries Costin Constantin
2015-12-18 12:40 ` [PATCH 02/12] classes/testimage.bbclass: add support for binaries export Costin Constantin
2015-12-18 12:40 ` Costin Constantin [this message]
2015-12-18 12:40 ` [PATCH 04/12] oeqa/runexported: Add option to run arbitrary tests Costin Constantin
2015-12-18 12:40 ` [PATCH 05/12] oeqa/runexported: Fix a problem with ssh_target_log symlink Costin Constantin
2015-12-18 12:40 ` [PATCH 06/12] oeqa/testimage: Added support for folder names in TEST_SUITES Costin Constantin
2015-12-18 12:40 ` [PATCH 07/12] oeqa/runexported: " Costin Constantin
2015-12-18 12:41 ` [PATCH 08/12] oeqa/runexported: The runner supports tests from other layers Costin Constantin
2015-12-18 12:41 ` [PATCH 09/12] oeqa/runexported: Add parameter support for machine arch Costin Constantin
2015-12-18 12:41 ` [PATCH 10/12] oeqa/testimage: Added export features Costin Constantin
2015-12-18 12:41 ` [PATCH 11/12] oeqa/runtime: Copy all __init__.py files from all layers Costin Constantin
2015-12-18 12:41 ` [PATCH 12/12] buildtools-with-tc.bb: extend buildtools-tarball to include test cases Costin Constantin
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=66fc1be529e8b27f03264fdc351c1f8392509f55.1450441923.git.costin.c.constantin@intel.com \
--to=costin.c.constantin@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.