* [PATCH 1/2] nfs4client: add test name as a compound tag
2014-06-23 13:56 beatify pynfs and CI integration Tigran Mkrtchyan
@ 2014-06-23 13:56 ` Tigran Mkrtchyan
2014-06-23 13:56 ` [PATCH 2/2] group junit like output by filenames Tigran Mkrtchyan
2014-07-23 19:24 ` beatify pynfs and CI integration J. Bruce Fields
2 siblings, 0 replies; 4+ messages in thread
From: Tigran Mkrtchyan @ 2014-06-23 13:56 UTC (permalink / raw)
To: linux-nfs, bfields; +Cc: Tigran Mkrtchyan
allowes to easy trace tests, e.q: [st_verify.py:_try_mand]
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
nfs4.1/nfs4client.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 6912565..c536897 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -9,6 +9,8 @@ import nfs_ops
import time, struct
import threading
import hmac
+import inspect
+from os.path import basename
from nfs4commoncode import CBCompoundState as CompoundState, \
cb_encode_status as encode_status, \
cb_encode_status_by_name as encode_status_by_name
@@ -82,6 +84,7 @@ class NFS4Client(rpc.Client, rpc.Server):
return self.send_call(pipe, 1, p.get_buffer(), credinfo)
def compound(self, *args, **kwargs):
+ self.tag = self.create_tag()
xid = self.compound_async(*args, **kwargs)
pipe = kwargs.get("pipe", None)
res = self.listen(xid, pipe=pipe)
@@ -292,6 +295,14 @@ class NFS4Client(rpc.Client, rpc.Server):
s.compound([op4.reclaim_complete(FALSE)])
return s
+ def create_tag(self):
+ current_stack = inspect.stack()
+ stackid = 0
+ while basename(current_stack[stackid][1]) == 'environment.py' or basename(current_stack[stackid][1]) == 'nfs4client.py':
+ stackid = stackid + 1
+ test_name = '%s:%s' % (basename(current_stack[stackid][1]), current_stack[stackid][3])
+ return test_name
+
class ClientStateProtection(object):
def __init__(self, p_res, p_arg):
self.type = p_res.spr_how
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] group junit like output by filenames
2014-06-23 13:56 beatify pynfs and CI integration Tigran Mkrtchyan
2014-06-23 13:56 ` [PATCH 1/2] nfs4client: add test name as a compound tag Tigran Mkrtchyan
@ 2014-06-23 13:56 ` Tigran Mkrtchyan
2014-07-23 19:24 ` beatify pynfs and CI integration J. Bruce Fields
2 siblings, 0 replies; 4+ messages in thread
From: Tigran Mkrtchyan @ 2014-06-23 13:56 UTC (permalink / raw)
To: linux-nfs, bfields; +Cc: Tigran Mkrtchyan
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
nfs4.1/testmod.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index 661aed0..32f51a9 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -97,10 +97,11 @@ class Test(object):
_funct_result = Result(DEP_FUNCT, default=True)
__re = re.compile(r'(\D*)(\d*)(.*)')
- def __init__(self, function, module=""):
+ def __init__(self, suite, function, module=""):
"""Needs function to be run"""
self.runtest = function
self.name = function.__name__
+ self.suite = suite
if module:
self.fullname = module.split('.')[-1] + '.' + self.name
else:
@@ -347,7 +348,7 @@ def createtests(testdir):
for attr in dir(mod):
if attr.startswith("test"):
f = getattr(mod, attr)
- tests.append(Test(f, testmod))
+ tests.append(Test(testfile, f, testmod))
# Reduce doc string info into format easier to work with
used_codes = {}
flag_dict = {}
@@ -451,8 +452,8 @@ def xml_printresults(tests, file_name, suite='all'):
for t in tests:
testcase = doc.createElement("testcase")
testsuite.appendChild(testcase)
- testcase.setAttribute("name", str(t))
- testcase.setAttribute("classname", suite)
+ testcase.setAttribute("name", t.name)
+ testcase.setAttribute("classname", t.suite)
testcase.setAttribute("time", str(t.time_taken))
total_time += t.time_taken
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: beatify pynfs and CI integration
2014-06-23 13:56 beatify pynfs and CI integration Tigran Mkrtchyan
2014-06-23 13:56 ` [PATCH 1/2] nfs4client: add test name as a compound tag Tigran Mkrtchyan
2014-06-23 13:56 ` [PATCH 2/2] group junit like output by filenames Tigran Mkrtchyan
@ 2014-07-23 19:24 ` J. Bruce Fields
2 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2014-07-23 19:24 UTC (permalink / raw)
To: Tigran Mkrtchyan; +Cc: linux-nfs
On Mon, Jun 23, 2014 at 03:56:01PM +0200, Tigran Mkrtchyan wrote:
> Two small patches:
>
> One allows to map nfs requests to pynfs tests based on tags.
> Second groups test results by test module, which makes generated
> output to look like regular junit report. This nicely fits into
> any modern CI system.
OK, applied.
--b.
^ permalink raw reply [flat|nested] 4+ messages in thread