Skip to contentSkip to conversation

remove trailing whitespace

PATCH In review Petr Vorel 2 participants 5 messages May 24, 2021 – May 25, 2021

Subsystems (3)
lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/3 remove trailing whitespace

---
 nfs4.0/nfs4acl.py        |  9 +++--
 nfs4.0/nfs4client.py     |  4 +--
 nfs4.0/nfs4lib.py        | 78 ++++++++++++++++++++--------------------
 nfs4.0/nfs4server.py     | 18 +++++-----
 nfs4.0/nfs4state.py      | 54 ++++++++++++++--------------
 nfs4.0/testserver.py     | 18 +++++-----
 nfs4.1/config.py         |  2 +-
 nfs4.1/fs.py             |  8 ++---
 nfs4.1/locking.py        |  8 ++---
 nfs4.1/nfs4client.py     | 22 ++++++------
 nfs4.1/nfs4commoncode.py | 12 +++----
 nfs4.1/nfs4lib.py        | 16 ++++-----
 nfs4.1/nfs4proxy.py      |  2 +-
 nfs4.1/nfs4server.py     | 56 ++++++++++++++---------------
 nfs4.1/nfs4state.py      | 12 +++----
 nfs4.1/setup.py          |  5 ++-
 nfs4.1/testclient.py     | 24 ++++++-------
 nfs4.1/testmod.py        | 15 ++++----
 nfs4.1/testserver.py     | 16 ++++-----
 rpc/rpc.py               | 14 ++++----
 rpc/setup.py             |  5 ++-
 showresults.py           |  4 +--
 xdr/setup.py             |  3 +-
 xdr/xdrgen.py            | 36 +++++++++----------
 24 files changed, 218 insertions(+), 223 deletions(-)
nfs4.0/nfs4acl.py +4 -5
index b7f033e..69e0d0b 100644
@@ -2,7 +2,7 @@
 # nfs4acl.py - some useful acl code
 #
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 
@@ -87,7 +87,7 @@ def acl2mode(acl):
     for ace in short:
         if perms[ace.who] is not None: continue
         if ace.type == ALLOWED:
-            bits = 0 
+            bits = 0
             for mode, bit in modes:
                 if mode & ace.access_mask == mode:
                     bits |= bit
@@ -103,7 +103,7 @@ def acl2mode(acl):
         if perms[key] is None:
             perm[keys] = 0
     return perms["OWNER@"]*0o100 + perms["GROUP@"]*0o10 + perms["EVERYONE@"]
-        
+
 def maps_to_posix(acl):
     """Raises ACLError if acl does not map to posix """
 
@@ -147,7 +147,7 @@ def chk_triple(mask, allow, deny, flags, not_mask):
         raise ACLError("Triple mask does not have required flags  %x" % flags)
     if not_mask != mask.access_mask:
         raise ACLError("Triple mask is not same as a previous mask")
-    
+
 def chk_everyone(acl, flags):
     if len(acl) != 2:
         raise ACLError("Had %i ACEs left when called chk_everyone" % len(acl))
@@ -216,4 +216,3 @@ def printableacl(acl):
                (type_str[ace.type], ace.flag, ace.access_mask, ace.who)
     #print("leaving printableacl with out = %s" % out)
     return out
-    
nfs4.0/nfs4client.py +2 -2
index d3d6e88..bc714d3 100755
@@ -4,7 +4,7 @@
 # nfs4client.py - NFS4 interactive client in python
 #
 # Written by Fred Isaman   <[email protected]>
-# Copyright (C) 2006 University of Michigan, Center for 
+# Copyright (C) 2006 University of Michigan, Center for
 #                    Information Technology Integration
 #
 
@@ -126,6 +126,6 @@ def main(server):
     c = PyShell(server)
     c.interact("Try COMPOUND([PUTROOTFH()])")
     print("Goodbye!")
-        
+
 if __name__ == "__main__":
     main(sys.argv[1])
nfs4.0/nfs4lib.py +39 -39

263 lines not on this page · raw message

nfs4.0/nfs4server.py +9 -9
index 3cf6ec2..2dbad30 100755
@@ -4,7 +4,7 @@
 #
 # Written by Martin Murray <[email protected]>
 # and        Fred Isaman   <[email protected]>
-# Copyright (C) 2001 University of Michigan, Center for 
+# Copyright (C) 2001 University of Michigan, Center for
 #                    Information Technology Integration
 #
 
@@ -62,7 +62,7 @@ def verify_utf8(str):
         return True
     except UnicodeError:
         return False
-            
+
 def access2string(access):
     ret = []
     if access & ACCESS4_READ:
@@ -119,7 +119,7 @@ class NFS4Server(rpc.RPCServer):
             return rpc.GARBAGE_ARGS, ''
         else:
             return rpc.SUCCESS, ''
-    
+
     def handle_1(self, data, cred):
         self.nfs4unpacker.reset(data)
         print
@@ -129,7 +129,7 @@ class NFS4Server(rpc.RPCServer):
             self.nfs4unpacker.done()
         except XDRError:
             print(repr(self.nfs4unpacker.get_buffer()))
-            
+
             raise
             return rpc.GARBAGE_ARGS, ''
         cmp4res = COMPOUND4res(ok, tag, results)
@@ -175,7 +175,7 @@ class NFS4Server(rpc.RPCServer):
             return NFS4ERR_MINOR_VERS_MISMATCH, [], tag
         if not verify_utf8(tag):
             return NFS4ERR_INVAL, [], tag
-        self.prep_client()            
+        self.prep_client()
         results = []
         ok = NFS4_OK
         for op in cmp4args.argarray:
@@ -278,7 +278,7 @@ class NFS4Server(rpc.RPCServer):
     # FIXME: have it actually do something
     def op_delegpurge(self, op):
         return simple_error(NFS4ERR_NOTSUPP)
-    
+
     # FIXME: have it actually do something
     def op_delegreturn(self, op):
         return simple_error(NFS4ERR_NOTSUPP)
@@ -402,7 +402,7 @@ class NFS4Server(rpc.RPCServer):
     def op_lookup(self, op):
         print("  CURRENT FILEHANDLE %s" % repr(self.curr_fh))
         print("  REQUESTED OBJECT %s" % op.oplookup.objname)
-        
+
         if not self.curr_fh:
             return simple_error(NFS4ERR_NOFILEHANDLE)
         if self.curr_fh.get_type() == NF4LNK:
@@ -595,7 +595,7 @@ class NFS4Server(rpc.RPCServer):
         # check access!
         if not op.opputfh.object in self.fhcache:
             return simple_error(NFS4ERR_BADHANDLE)
-        self.curr_fh = self.fhcache[op.opputfh.object] 
+        self.curr_fh = self.fhcache[op.opputfh.object]
         return simple_error(NFS4_OK)
 
     def op_putpubfh(self, op):
@@ -898,7 +898,7 @@ class NFS4Server(rpc.RPCServer):
         self.state.unconfirmed.remove(x=entry2.x)
         self.state.reset_seqid(c)
         return simple_error(NFS4_OK)
-            
+
     def op_verify(self, op):
         print("  CURRENT FILEHANDLE %s" % repr(self.curr_fh))
         if not self.curr_fh:
nfs4.0/nfs4state.py +27 -27

192 lines not on this page · raw message

nfs4.0/testserver.py +9 -9
index 801142e..0ef010a 100755
@@ -2,24 +2,24 @@
 # nfs4stest.py - nfsv4 server tester
 #
 # Requires python 3.2
-# 
+#
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 # Based on pynfs
 # Written by Peter Astrand <[email protected]>
 # Copyright (C) 2001 Cendio Systems AB (http://www.cendio.se)
-# 
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License. 
-# 
+# the Free Software Foundation; version 2 of the License.
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -112,7 +112,7 @@ def scan_options(p):
                  help="Force test dependencies to be run, "
                  "even if not requested on command line")
     p.add_option_group(g)
-    
+
     g = OptionGroup(p, "Test output options",
                     "These options affect how test results are shown.")
     g.add_option("-v", "--verbose", action="store_true", default=False,
@@ -227,7 +227,7 @@ def printflags(list):
     for s in list:
         if s not in command_names:
             print(s)
-    
+
 def main():
     nfail = -1
     p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n"
@@ -316,7 +316,7 @@ def main():
                 (opt.security, str(valid.keys())))
     opt.flavor = valid[opt.security]
     opt.service = {'krb5':1, 'krb5i':2, 'krb5p':3}.get(opt.security, 0)
-               
+
     # Make sure args are valid
     opt.args = []
     for a in args:
nfs4.1/config.py +1 -1
index 8779fe1..3777e31 100644
@@ -116,7 +116,7 @@ class MetaConfig(type):
         for i, attr in enumerate(attrs):
             setattr(cls, attr.name, property(make_get(i), make_set(i),
                                              None, attr.comment))
-        
+
 class ServerConfig(object):
     __metaclass__ = MetaConfig
     attrs =  [ConfigLine("allow_null_data", False,
nfs4.1/fs.py +4 -4
index e8d413e..7f690bb 100644
@@ -176,7 +176,7 @@ class FSObject(object):
         self.lock = RWLock(name=str(id))
         self.seek_lock = Lock("SeekLock")
         self.current_layout = None
-        self.covered_by = None # If this is a mountpoint for fs, equals fs.root 
+        self.covered_by = None # If this is a mountpoint for fs, equals fs.root
         # XXX Need to write to disk here?
         self._init_hook()
 
@@ -760,7 +760,7 @@ class ConfigObj(FSObject):
     def exists(self, name):
         """Returns True if name is in the dir"""
         log_o.log(5, "FSObject.exists(%r)" % name)
-        # HACK - build a fake client 
+        # HACK - build a fake client
         class Fake(object):
             def __init__(self):
                 self.clientid = 0
@@ -911,7 +911,7 @@ class ConfigFS(FileSystem):
         else:
             # Is a directory.  Tree is currently set up like:
             #                       config (1)
-            #        ______________/ /   \  \______________      
+            #        ______________/ /   \  \______________
             #       /               /     \                \
             # actions (8)   serverwide (2)  perclient (3)  ops (4)
             #
@@ -1292,7 +1292,7 @@ class BlockLayoutFS(FileSystem):
 
     def _make_files(self, dev):
         # STUB - hard code some test files with various properties
-        
+
         # These will use test_layout_dict to get id to layout mapping
         princ = nfs4lib.NFS4Principal("root", system=True)
         bs = self.fattr4_layout_blksize
nfs4.1/locking.py +4 -4
index 1dc428f..238fdad 100644
@@ -2,7 +2,7 @@ from __future__ import with_statement
 import threading
 
 
-DEBUG = False # Note this only affects locks at creation 
+DEBUG = False # Note this only affects locks at creation
 
 class Counter(object):
     def __init__(self, first_value=0, name="counter"):
@@ -62,7 +62,7 @@ class _DebugLock(object):
         self.lock = threading.Lock()
         self.name = name
 
-    
+
     @_collect_acq_data()
     def acquire(self):
         self.lock.acquire()
@@ -86,7 +86,7 @@ class _RWLock(object):
     """
     # NOTE - in case of read-only filesystem, want acquire/release to
     # revert to NOPs, while acquire-write should raise error.
-    
+
     def __init__(self):
         self._cond = threading.Condition()
         self._write_lock = threading.Lock()
@@ -171,7 +171,7 @@ class _RWLockVerbose(_RWLock):
     """
     # NOTE - in case of read-only filesystem, want acquire/release to
     # revert to NOPs, while acquire-write should raise error.
-    
+
     def __init__(self, name=""):
         super(_RWLockVerbose, self).__init__()
         self.name = "RWLock_%s" % name
nfs4.1/nfs4client.py +11 -11
index df573d6..c9d8775 100644
@@ -99,7 +99,7 @@ class NFS4Client(rpc.Client, rpc.Server):
                 [ nfs_opnum4[a.argop].lower()[3:] for a in args[0] ],
                 nfsstat4[res.status])
         return res
-    
+
     def listen(self, xid, pipe=None, timeout=10.0):
         if pipe is None:
             pipe = self.c1
@@ -167,7 +167,7 @@ class NFS4Client(rpc.Client, rpc.Server):
             log_cb.info("Replay...sending data")
             data = e.cache.data
         return rpc.SUCCESS, data, getattr(env, "notify", None)
-        
+
     def check_utf8str_cs(self, str):
         # XXX combine code with server
         # STUB - raises NFS4Error if appropriate.
@@ -234,7 +234,7 @@ class NFS4Client(rpc.Client, rpc.Server):
         if funct is None:
             return
         funct(arg, env)
-        
+
     def posthook(self, arg, env, res=None):
         """Call the function post_<opname>_<clientid> if it exists"""
         if env.session is None:
@@ -246,7 +246,7 @@ class NFS4Client(rpc.Client, rpc.Server):
         if funct is None:
             return res
         return funct(arg, env, res)
-        
+
     def op_cb_sequence(self, arg, env):
         log_cb.info("In CB_SEQUENCE")
         if env.index != 0:
@@ -430,18 +430,18 @@ class ClientRecord(object):
         else:
             # Add hook
             setattr(self.c, hook_name, funct)
-        
+
     def cb_pre_hook(self, op_num, funct=None):
         if op_num == OP_CB_SEQUENCE:
             raise RuntimeError("Hook depends on session info from CB_SEQUENCE")
         self._cb_hook("pre", nfs_cb_opnum4[op_num][3:].lower(), funct)
-        
+
     def cb_post_hook(self, op_num, funct=None):
         self._cb_hook("post", nfs_cb_opnum4[op_num][3:].lower(), funct)
-        
+
 # XXX FIXME - this is for Slot code, put in reuasable spot if this works
-from nfs4server import Slot        
-from nfs4server import Channel as RecvChannel 
+from nfs4server import Slot
+from nfs4server import Channel as RecvChannel
 
 class SendChannel(object):
     def __init__(s, attrs):
@@ -464,7 +464,7 @@ class SendChannel(object):
             raise RuntimeError("Out of slots")
         finally:
             self.lock.release()
-                
+
 class SessionRecord(object):
     def __init__(self, csr, client):
         self.sessionid = csr.csr_sessionid
@@ -515,7 +515,7 @@ class SessionRecord(object):
                              kwargs.pop("cache_this", False))
         slot = self.fore_channel.slots[seq_op.sa_slotid]
         return slot, seq_op
- 
+
     def compound_async(self, ops, **kwargs):
         slot, seq_op = self._prepare_compound(kwargs)
         slot.xid = self.c.compound_async([seq_op] + ops, **kwargs)
nfs4.1/nfs4commoncode.py +6 -6
index 24c4650..bba5a69 100644
@@ -47,7 +47,7 @@ def %(encode_status)s_by_name(name, status, *args, **kwargs):
         raise
         pass
     raise RuntimeError("Problem with name %%r" %% name)
-        
+
 def %(encode_status)s(status, *args, **kwargs):
     """Called from function op_<name>, encodes the operations response.
 
@@ -63,7 +63,7 @@ def %(encode_status)s(status, *args, **kwargs):
 class %(CompoundArgResults)s(object):
     size = property(lambda s: s._base_len + nfs4lib.xdrlen(s._env.tag))
     tag = property(lambda s: s.prefix + s._env.tag)
-    
+
     def __init__(self, env, prefix=b""):
         self.status = NFS4_OK # Generally == self.results[-1].status
         self.results = [] # Array of nfs_resop4 structures
@@ -106,7 +106,7 @@ class %(PairedResults)s(object):
         #        self.cache = self.reply[0:1] + [NFS4ERR_RETRY_UNCACHED_REP]
         #                        ^
         #                         \should be SEQ
-        
+
         # STUB - do size checking on self.reply
         if self.env.caching or self.env.index == 0:
             self.cache.append(result)
@@ -122,7 +122,7 @@ class %(PairedResults)s(object):
         self.reply.status = self.cache.status = status
         if tag is not None:
             self.env.tag = tag
-        
+
     # Generally make class behave like self.reply
     def __getitem__(self, key):
         return self.reply[key]
@@ -132,7 +132,7 @@ class %(PairedResults)s(object):
 
 class %(CompoundState)s(object):
     """ We hold here all the interim state the server needs to remember
-    
+
     as it handles each operation in turn.
     """
     def __init__(self, args, cred):
@@ -172,7 +172,7 @@ class %(CompoundState)s(object):
         """Pull security triple of (OID, QOP, service) from cred"""
         # STUB
         return 0
-    
+
     def get_connection(self, cred):
         """Pull connection id from credential"""
         return cred.connection
nfs4.1/nfs4lib.py +8 -8
index 5eada23..b1a247b 100644
@@ -100,7 +100,7 @@ def set_attrbit_dicts():
     """Set global dictionaries manipulating attribute bit positions.
 
     Note: This function uses introspection. It assumes an entry
-    in nfs4_const.py is an attribute iff it is named FATTR4_<something>. 
+    in nfs4_const.py is an attribute iff it is named FATTR4_<something>.
 
     Returns {"type": 1, "fh_expire_type": 2,  "change": 3 ...}
             { 1: "type", 2: "fh_expire_type", 3: "change", ...}
@@ -111,7 +111,7 @@ def set_attrbit_dicts():
     for name in dir(xdrdef.nfs4_const):
         if name.startswith("FATTR4_"):
             value = getattr(xdrdef.nfs4_const, name)
-            # Sanity checking. Must be integer. 
+            # Sanity checking. Must be integer.
             assert(type(value) is int)
             attrname = name[7:].lower()
             attr2bitnum[attrname] = value
@@ -172,7 +172,7 @@ class UnexpectedCompoundRes(NFSException):
     """The COMPOUND procedure returned OK, but had unexpected data"""
     def __init__(self, msg=""):
         self.msg = msg
-    
+
     def __str__(self):
         if self.msg:
             return "Unexpected COMPOUND result: %s" % self.msg
@@ -183,7 +183,7 @@ class InvalidCompoundRes(NFSException):
     """The COMPOUND return is invalid, ie response is not to spec"""
     def __init__(self, msg=""):
         self.msg = msg
-    
+
     def __str__(self):
         if self.msg:
             return "Invalid COMPOUND result: %s" % self.msg
@@ -242,11 +242,11 @@ class FancyNFS4Unpacker(NFS4Unpacker):
             list.append(e)
         data.entries = list
         return data
-            
+
 def dict2fattr(dict):
     """Convert a dictionary of form {numb:value} to a fattr4 object.
 
-    Returns a fattr4 object.  
+    Returns a fattr4 object.
     """
 
     attrs = sorted(dict.keys())
@@ -259,7 +259,7 @@ def dict2fattr(dict):
         getattr(packer, bitnum2packer[bitnum])(value)
         attr_vals += packer.get_buffer()
     attrmask = list2bitmap(attrs)
-    return xdrdef.nfs4_type.fattr4(attrmask, attr_vals); 
+    return xdrdef.nfs4_type.fattr4(attrmask, attr_vals);
 
 def fattr2dict(obj):
     """Convert a fattr4 object to a dictionary with attribute name and values.
@@ -648,7 +648,7 @@ class AttrConfig(object):
         self._f = (kind=="obj")
         self._s = (kind=="serv")
         self._fs = (kind=="fs")
-    
+
 from xdrdef.nfs4_const import *
 
 A = AttrConfig
nfs4.1/nfs4proxy.py +1 -1
index dd870d9..1b935fa 100755
@@ -235,7 +235,7 @@ class NFS4Proxy(rpc.Server):
         log.debug("Proxy sent:")
         log.debug(repr(args))
         calldata = packer.get_buffer()
-        try:    
+        try:
             ret_data = self.forward_call(calldata, callback)
         except rpc.RPCTimeout:
             log.critical("Error: cannot connect to destination server")
nfs4.1/nfs4server.py +28 -28

199 lines not on this page · raw message

nfs4.1/nfs4state.py +6 -6
index f2cad04..e57b90a 100644
@@ -60,7 +60,7 @@ def find_state(env, stateid, allow_0=True, allow_bypass=False):
             raise NFS4Error(NFS4ERR_BAD_STATEID, tag="stateid not known")
         if state.file != env.cfh:
             raise NFS4Error(NFS4ERR_BAD_STATEID,
-                            tag="cfh %r does not match stateid %r" % 
+                            tag="cfh %r does not match stateid %r" %
                             (state.file.fh, env.cfh.fh))
     state.lock.acquire()
     # It is possible that while waiting to get the lock, the state has been
@@ -747,7 +747,7 @@ class DelegEntry(StateTableEntry):
             # BUG deal with this
             raise RuntimeError
         # NOTE that we come in w/o state lock...when should we grab it?
-        # ANSWER - we care about self.status, which can be set to 
+        # ANSWER - we care about self.status, which can be set to
         # INVALID anytime by deleg_return
         slot = session.channel_back.choose_slot()
         seq_op = op4.cb_sequence(session.sessionid, slot.get_seqid(),
@@ -760,9 +760,9 @@ class DelegEntry(StateTableEntry):
             return
         # All sorts of STUBBINESS here
         pipe = session.channel_back.connections[0]
-        xid = dispatcher.cb_compound_async([seq_op, recall_op], 
+        xid = dispatcher.cb_compound_async([seq_op, recall_op],
                                            session.cb_prog, pipe=pipe)
-        # Note it is possible that self.invalid is True, but don't 
+        # Note it is possible that self.invalid is True, but don't
         # want to take the lock
         self.status = CB_SENT
         res = dispatcher.cb_listen(xid, pipe)
@@ -823,13 +823,13 @@ class ByteEntry(StateTableEntry):
 #         list = self.locklist
 #         if not list:
 #             list.append(ByteLock(type, start, end))
-#             return 
+#             return
 #         i = 0
 #         while (list and list[i].end < start):
 #             i += 1
 #         list.insert(i, ByteLock(type, start, end))
 #         # Merge adjacent locks
-#         # Really want range(i+1, i-1, -1), but need to account for list edges 
+#         # Really want range(i+1, i-1, -1), but need to account for list edges
 #         for i in range(min(i+1, len(list)-1), max(1,i)-1, -1):
 #             if i > 0 and list[i].start == list[i-1].end + 1 and \
 #                list[i].type == list[i-1].type:
nfs4.1/setup.py +2 -3
index 37b99a0..e13170e 100644
@@ -54,11 +54,11 @@ class build_py(_build_py):
 setup(name = "nfs4",
       version = "0.0.0", # import this?
       package_dir = {"nfs4" : ""},
-      packages = ["nfs4", "nfs4.server41tests"], 
+      packages = ["nfs4", "nfs4.server41tests"],
       description = "NFS version 4.1 tools and tests",
       long_description = DESCRIPTION,
       cmdclass = {"build_py": build_py},
-      
+
       # These will be the same
       author = "Fred Isaman",
       author_email = "[email protected]",
@@ -66,6 +66,5 @@ setup(name = "nfs4",
       maintainer_email = "[email protected]",
       url = "http://www.citi.umich.edu/projects/nfsv4/pynfs/",
       license = "GPL"
-      
       )
 
nfs4.1/testclient.py +12 -12
index dd68bda..87cdb30 100755
@@ -2,20 +2,20 @@
 # nfs4stest.py - nfsv4 server tester
 #
 # Requires python 3.2
-# 
+#
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License. 
-# 
+# the Free Software Foundation; version 2 of the License.
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -49,12 +49,12 @@ def scan_options(p):
     .nocleanup = (False)
     .outfile   = (None)
     .debug_fail = (False)
-    
+
     .security = (sys)
 
     .force   = (False)
     .rundeps = (False)
-    
+
     .verbose  = (False)
     .showpass = (True)
     .showwarn = (True)
@@ -70,7 +70,7 @@ def scan_options(p):
     .usefile   = (None)
     .usedir    = (None)
     .usespecial= (None)
-    
+
     """
     p.add_option("--showflags", action="store_true", default=False,
                  help="Print a list of all possible flags and exit")
@@ -90,7 +90,7 @@ def scan_options(p):
 ##     g.add_option("--security", default='sys',
 ##                  help="Choose security flavor such as krb5i [sys]")
 ##     p.add_option_group(g)
-    
+
     g = OptionGroup(p, "Test selection options",
                     "These options affect how flags are interpreted.")
     g.add_option("--force", action="store_true", default=False,
@@ -99,7 +99,7 @@ def scan_options(p):
                  help="Force test dependencies to be run, "
                  "even if not requested on command line")
     p.add_option_group(g)
-    
+
     g = OptionGroup(p, "Test output options",
                     "These options affect how test results are shown")
     g.add_option("-v", "--verbose", action="store_true", default=False,
@@ -207,7 +207,7 @@ def printflags(list):
     for s in list:
         if s not in command_names:
             print(s)
-    
+
 def main():
     p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n"
                      "       %prog --help\n"
@@ -275,7 +275,7 @@ def main():
 ##                 (opt.security, str(valid.keys())))
 ##     opt.flavor = valid[opt.security]
 ##     opt.service = {'krb5':1, 'krb5i':2, 'krb5p':3}.get(opt.security, 0)
-               
+
     # Make sure args are valid
     opt.args = []
     for a in args:
nfs4.1/testmod.py +7 -8
index 6285758..e368853 100644
@@ -1,9 +1,9 @@
 # testmod.py - run tests from a suite
 #
 # Requires python 3.2
-# 
+#
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 from __future__ import print_function
@@ -194,7 +194,7 @@ class Test(object):
             out += ' ' + w
             lout += lw + 1
         return out
-            
+
     def fail(self, msg):
         raise FailureException(msg)
 
@@ -275,14 +275,14 @@ class Environment(object):
     def shutDown(self):
         """Run after each test"""
         pass
-        
+
 def _run_filter(test, options):
     """Returns True if test should be run, False if it should be skipped"""
     return True
 
 def runtests(tests, options, environment, runfilter=_run_filter):
     """tests is an array of test objects, to be run in order
-    
+
     (as much as possible)
     """
     for t in tests:
@@ -307,7 +307,7 @@ def _runtree(t, options, environment, runfilter=_run_filter):
     for dep in t.dependencies:
         if dep.result == DEP_FUNCT:
             if (not options.force) and (not dep(t, environment)):
-                t.result = Result(TEST_OMIT, 
+                t.result = Result(TEST_OMIT,
                                   "Dependency function %s failed" %
                                   dep.__name__)
                 return
@@ -322,7 +322,7 @@ def _runtree(t, options, environment, runfilter=_run_filter):
             return
         elif (not options.force) and \
                  (dep.result in [TEST_OMIT, TEST_FAIL, TEST_NOTSUP]):
-            t.result = Result(TEST_OMIT, 
+            t.result = Result(TEST_OMIT,
                               "Dependency %s had status %s." % \
                               (dep, dep.result))
             return
@@ -421,7 +421,6 @@ def createtests(testdir):
                 t.dependencies.append(funct)
     return tests, flag_dict, used_codes
 
-                 
 def printresults(tests, opts, file=None):
     NOTRUN, OMIT, SKIP, FAIL, WARN, PASS = range(6)
     count = [0] * 6
nfs4.1/testserver.py +8 -8
index 3cecfdc..d3c44c7 100755
@@ -2,24 +2,24 @@
 # nfs4stest.py - nfsv4 server tester
 #
 # Requires python 3.2
-# 
+#
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 # Based on pynfs
 # Written by Peter Astrand <[email protected]>
 # Copyright (C) 2001 Cendio Systems AB (http://www.cendio.se)
-# 
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License. 
-# 
+# the Free Software Foundation; version 2 of the License.
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -95,7 +95,7 @@ def scan_options(p):
                  help="Force test dependencies to be run, "
                  "even if not requested on command line")
     p.add_option_group(g)
-    
+
     g = OptionGroup(p, "Test output options",
                     "These options affect how test results are shown.")
     g.add_option("-v", "--verbose", action="store_true", default=False,
@@ -215,7 +215,7 @@ def printflags(list):
     for s in list:
         if s not in command_names:
             print(s)
-    
+
 def main():
     p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n"
                      "       %prog --help\n"
rpc/rpc.py +7 -7
index 4a454d7..4d1eb09 100644
@@ -122,7 +122,7 @@ class FancyRPCPacker(rpc_pack.RPCPacker):
                          py_data.proc,
                          self._filter_opaque_auth(py_data.cred),
                          py_data.verf)
-        
+
 ###################################################
 
 class DeferredData(object):
@@ -144,7 +144,7 @@ class DeferredData(object):
         self.data = None
         self._exception = None
         self.msg = msg # Data that thread calling fill might need
-        
+
     def wait(self, timeout=10):
         """Wait for data to be filled in"""
         self._filled.wait(timeout)
@@ -458,7 +458,7 @@ class ConnectionHandler(object):
 
         # Create internal server for alarm system to connect to
         self.s = self.expose((LOOPBACK, 0), socket.AF_INET, False)
-        
+
         # Set up alarm system, which is how other threads inform the polling
         # thread that data is ready to be sent out
         # NOTE that there are TWO sockets associated with alarm, one
@@ -643,7 +643,7 @@ class ConnectionHandler(object):
 
     def _event_rpc_call(self, msg, msg_data, pipe):
         """Deal with an incoming RPC CALL.
-        
+
         msg is unpacked header, with length fields added.
         msg_data is raw procedure data.
         """
@@ -785,7 +785,7 @@ class ConnectionHandler(object):
 
         # For AUTH_SYS:
         #    check machinename, mode - again how is accept list set on server?
-        
+
         # For GSS:
         #   illegal enum values should return AUTH_BADCRED
         #      this will be noticed by XDR unpack failing, which means
@@ -877,7 +877,7 @@ class ConnectionHandler(object):
             # A list of all sockets we have open, indexed by fileno
             self.sockets[s.fileno()] = s
         return s
-            
+
     def make_call_function(self, pipe, procedure, prog, vers):
         def call(data, credinfo, proc=None, timeout=15.0):
             if proc is None:
@@ -887,7 +887,7 @@ class ConnectionHandler(object):
             # XXX STUB - do header checking
             return header, data
         return call
-    
+
     def listen(self, pipe, xid):
         # STUB - should be overwritten by subclass
         header, data = pipe.listen(xid)
rpc/setup.py +2 -3
index 7297099..99dad5a 100644
@@ -46,11 +46,11 @@ class build_py(_build_py):
 setup(name = "rpc",
       version = "0.0.0", # import this?
       package_dir = {"rpc" : ""},
-      packages = ["rpc"], 
+      packages = ["rpc"],
       description = "GSS enabled RPC client and server",
       long_description = DESCRIPTION,
       cmdclass = {"build_py": build_py},
-      
+
       # These will be the same
       author = "Fred Isaman",
       author_email = "[email protected]",
@@ -58,6 +58,5 @@ setup(name = "rpc",
       maintainer_email = "[email protected]",
       url = "http://www.citi.umich.edu/projects/nfsv4/pynfs/",
       license = "GPL"
-      
       )
 
showresults.py +2 -2
index 5abd72a..944db40 100755
@@ -2,9 +2,9 @@
 # showresults.py - redisplay results from nfsv4 server tester output file
 #
 # Requires python 3.2
-# 
+#
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 
xdr/setup.py +1 -2
index e8af152..3acb8a2 100644
@@ -12,7 +12,7 @@ Add stuff here.
 
 setup(name = "xdrgen",
       version = "0.0.0", # import this?
-      py_modules = ["xdrgen"], 
+      py_modules = ["xdrgen"],
       scripts = ["xdrgen.py"], # FIXME - make small script that calls module
       description = "Generate python code from .x files",
       long_description = DESCRIPTION,
@@ -25,6 +25,5 @@ setup(name = "xdrgen",
       maintainer_email = "[email protected]",
       url = "http://www.citi.umich.edu/projects/nfsv4/pynfs/",
       license = "GPL"
-      
       )
 
xdr/xdrgen.py +18 -18
index 130f364..6064586 100755
@@ -1,22 +1,22 @@
 #!/usr/bin/env python3
 # rpcgen.py - A Python RPC protocol compiler
-# 
+#
 # Written by Fred Isaman <[email protected]>
-# Copyright (C) 2004 University of Michigan, Center for 
+# Copyright (C) 2004 University of Michigan, Center for
 #                    Information Technology Integration
 #
 # Based on version written by Peter Astrand <[email protected]>
 # Copyright (C) 2001 Cendio Systems AB (http://www.cendio.se)
-# 
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License. 
-# 
+# the Free Software Foundation; version 2 of the License.
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -25,7 +25,7 @@
 # Note <something>_list means zero or more of <something>.
 #
 # TODO:
-# Code generation for programs and procedures. 
+# Code generation for programs and procedures.
 #
 
 ##########################################################################
@@ -209,7 +209,7 @@
         practice is to wrap arguments into a structure.
 """
 # Spec above allows the following problems:
-# typedef void; 
+# typedef void;
 # typedef enum <enum_body> ID[5];  <---Not a problem
 # typedef enum <enum_body> ID<>;   <---Not a problem
 
@@ -243,7 +243,7 @@ keywords = ("bool", "case", "const", "default", "double", "quadruple",
 # Required by lex.  Each token also allows a function t_<token>.
 tokens = tuple([t.upper() for t in keywords]) + (
     "ID", "CONST10", "CONST8", "CONST16",
-    # ( ) [ ] { } 
+    # ( ) [ ] { }
     "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", "LBRACE", "RBRACE",
     # ; : < > * = ,
     "SEMI", "COLON", "LT", "GT", "STAR", "EQUALS", "COMMA"
@@ -320,7 +320,7 @@ def p_specification(t):
     '''specification : definition_list'''
 
 def p_definition_list(t):
-    '''definition_list : definition definition_list 
+    '''definition_list : definition definition_list
                        | empty'''
 
 def p_definition(t):
@@ -536,17 +536,17 @@ def p_struct_body(t):
     t[0] = t[2]
 
 def p_declaration_list_1(t):
-    '''declaration_list : declaration SEMI''' 
+    '''declaration_list : declaration SEMI'''
     t[0] = [t[1]]
 
 def p_declaration_list_2(t):
-    '''declaration_list : declaration SEMI declaration_list''' 
+    '''declaration_list : declaration SEMI declaration_list'''
     t[0] = [t[1]] + t[3]
 
 def p_enum_body(t):
     '''enum_body : LBRACE enum_constant_list RBRACE'''
     # Returns a list of const_info
-    t[0] = t[2] 
+    t[0] = t[2]
 
 def p_enum_constant(t):
     '''enum_constant : ID EQUALS value'''
@@ -809,7 +809,7 @@ class Info(object):
             newdata = "%s.%s" % (data, self.id)
         if self.array:
             newdata = data
-            subheader = "%sdef pack_one_%s(self, data):\n" % (prefix, self.id) 
+            subheader = "%sdef pack_one_%s(self, data):\n" % (prefix, self.id)
             varindent = indent
             if self.fixed:
                 array = "%sself.pack_farray(%s, data, pack_one_%s)\n" % \
@@ -835,7 +835,7 @@ class Info(object):
             newdata = "%s.%s" % (data, self.id)
         if self.array:
             subheader = "%sdef unpack_one_%s(self, data):\n" % \
-                        (prefix, self.id) 
+                        (prefix, self.id)
             varindent = indent
             array = "%s%sreturn data\n" % (prefix, varindent)
             if self.fixed:
@@ -1385,7 +1385,7 @@ class %sUnpacker(xdrlib.Unpacker):
 """ % ("%s", indent, indent2, indent2, indent2)
 
 known_basics = {"int" : "pack_int",
-                #"enum" : "pack_enum", 
+                #"enum" : "pack_enum",
                 "uint" : "pack_uint",
                 "unsigned" : "pack_uint",
                 "hyper" : "pack_hyper",
@@ -1393,8 +1393,8 @@ known_basics = {"int" : "pack_int",
                 "float" : "pack_float",
                 "double" : "pack_double",
                 # Note: xdrlib.py does not have a
-                # pack_quadruple currently. 
-                "quadruple" : "pack_double", 
+                # pack_quadruple currently.
+                "quadruple" : "pack_double",
                 "bool" : "pack_bool",
                 "opaque": "pack_opaque",
                 "string": "pack_string"}
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/3 server: Allow to print JSON format

---
 nfs4.0/testserver.py |  7 ++++++-
 nfs4.1/testmod.py    | 40 +++++++++++++++++++++++++++++++++++++++-
 nfs4.1/testserver.py |  6 +++++-
 3 files changed, 50 insertions(+), 3 deletions(-)
nfs4.0/testserver.py +6 -1
index 0ef010a..f2c4156 100755
@@ -85,6 +85,8 @@ def scan_options(p):
                  help="Skip final cleanup of test directory")
     p.add_option("--outfile", "--out", default=None, metavar="FILE",
                  help="Store test results in FILE [%default]")
+    p.add_option("--jsonout", "--json", default=None, metavar="FILE",
+                 help="Store test results in JSON format [%default]")
     p.add_option("--xmlout", "--xml", default=None, metavar="FILE",
                  help="Store test results in xml format [%default]")
     p.add_option("--debug_fail", action="store_true", default=False,
@@ -378,8 +380,11 @@ def main():
     if fail:
         print("\nWARNING: could not clean testdir due to:\n%s\n" % err)
 
-    if opt.xmlout is not None:
+    if opt.jsonout is not None:
+        testmod.json_printresults(tests, opt.jsonout)
+    elif opt.xmlout is not None:
         testmod.xml_printresults(tests, opt.xmlout)
+
     if nfail < 0:
         sys.exit(3)
     if nfail > 0:
nfs4.1/testmod.py +39 -1
index e368853..4b4ed24 100644
@@ -13,6 +13,7 @@ import re
 import sys
 import time
 from traceback import format_exception, print_exc
+import json
 import xml.dom.minidom
 import datetime
 
@@ -467,6 +468,43 @@ def printresults(tests, opts, file=None):
           (count[SKIP], count[FAIL], count[WARN], count[PASS]), file=file)
     return count[FAIL]
 
+def json_printresults(tests, file_name, suite='all'):
+    with open(file_name, 'w') as fd:
+        failures = 0
+        skipped = 0
+        total_time = 0
+        data = {}
+        data["tests"] = len(tests)
+        data["errors"] = 0
+        data["timestamp"] = str(datetime.datetime.now())
+        data["name"] = suite
+        data["testcase"] = []
+        for t in tests:
+            test = {
+                "name": t.name,
+                "classname": t.suite,
+                "time": str(t.time_taken),
+            }
+
+            total_time += t.time_taken
+            if t.result == TEST_FAIL:
+                failures += 1
+                test["failure"] = {
+                        "message" : t.result.msg,
+                        "err" : ''.join(t.result.tb)
+                }
+            elif t.result == TEST_OMIT:
+                skipped += 1
+                test["skipped"] = 1
+
+            data["testcase"].append(test)
+
+        data["failures"] = failures
+        data["skipped"] = skipped
+        data["time"] = total_time
+
+        fd.write(json.dumps(data, indent=4, sort_keys=True))
+
 def xml_printresults(tests, file_name, suite='all'):
     with open(file_name, 'w') as fd:
         failures = 0
@@ -484,7 +522,7 @@ def xml_printresults(tests, file_name, suite='all'):
             testsuite.appendChild(testcase)
             testcase.setAttribute("name", t.name)
             testcase.setAttribute("classname", t.suite)
-            testcase.setAttribute("time", str(t.time_taken))
+            testcase.setAttribute("time", t.time_taken)
 
             total_time += t.time_taken
             if t.result == TEST_FAIL:
nfs4.1/testserver.py +5 -1
index d3c44c7..085f007 100755
@@ -68,6 +68,8 @@ def scan_options(p):
                  help="Skip final cleanup of test directory")
     p.add_option("--outfile", "--out", default=None, metavar="FILE",
                  help="Store test results in FILE [%default]")
+    p.add_option("--jsonout", "--json", default=None, metavar="FILE",
+                 help="Store test results in JSON format [%default]")
     p.add_option("--xmlout", "--xml", default=None, metavar="FILE",
                  help="Store test results in xml format [%default]")
     p.add_option("--debug_fail", action="store_true", default=False,
@@ -363,7 +365,9 @@ def main():
     if fail:
         print("\nWARNING: could not clean testdir due to:\n%s\n" % err)
 
-    if opt.xmlout is not None:
+    if opt.jsonout is not None:
+        testmod.json_printresults(tests, opt.jsonout)
+    elif opt.xmlout is not None:
         testmod.xml_printresults(tests, opt.xmlout)
 
 if __name__ == "__main__":
Signature · 1 line
2.31.1
#2 lore raw

Re: [PATCH pynfs 2/3] server: Allow to print JSON format

I've got nothing against this, but I'm curious why you need it.

--b.

Quoted 125 lines · Petr Vorel
---
 nfs4.0/testserver.py |  7 ++++++-
 nfs4.1/testmod.py    | 40 +++++++++++++++++++++++++++++++++++++++-
 nfs4.1/testserver.py |  6 +++++-
 3 files changed, 50 insertions(+), 3 deletions(-)
nfs4.0/testserver.py +6 -1
index 0ef010a..f2c4156 100755
@@ -85,6 +85,8 @@ def scan_options(p):
                  help="Skip final cleanup of test directory")
     p.add_option("--outfile", "--out", default=None, metavar="FILE",
                  help="Store test results in FILE [%default]")
+    p.add_option("--jsonout", "--json", default=None, metavar="FILE",
+                 help="Store test results in JSON format [%default]")
     p.add_option("--xmlout", "--xml", default=None, metavar="FILE",
                  help="Store test results in xml format [%default]")
     p.add_option("--debug_fail", action="store_true", default=False,
@@ -378,8 +380,11 @@ def main():
     if fail:
         print("\nWARNING: could not clean testdir due to:\n%s\n" % err)
 
-    if opt.xmlout is not None:
+    if opt.jsonout is not None:
+        testmod.json_printresults(tests, opt.jsonout)
+    elif opt.xmlout is not None:
         testmod.xml_printresults(tests, opt.xmlout)
+
     if nfail < 0:
         sys.exit(3)
     if nfail > 0:
nfs4.1/testmod.py +39 -1
index e368853..4b4ed24 100644
@@ -13,6 +13,7 @@ import re
 import sys
 import time
 from traceback import format_exception, print_exc
+import json
 import xml.dom.minidom
 import datetime
 
@@ -467,6 +468,43 @@ def printresults(tests, opts, file=None):
           (count[SKIP], count[FAIL], count[WARN], count[PASS]), file=file)
     return count[FAIL]
 
+def json_printresults(tests, file_name, suite='all'):
+    with open(file_name, 'w') as fd:
+        failures = 0
+        skipped = 0
+        total_time = 0
+        data = {}
+        data["tests"] = len(tests)
+        data["errors"] = 0
+        data["timestamp"] = str(datetime.datetime.now())
+        data["name"] = suite
+        data["testcase"] = []
+        for t in tests:
+            test = {
+                "name": t.name,
+                "classname": t.suite,
+                "time": str(t.time_taken),
+            }
+
+            total_time += t.time_taken
+            if t.result == TEST_FAIL:
+                failures += 1
+                test["failure"] = {
+                        "message" : t.result.msg,
+                        "err" : ''.join(t.result.tb)
+                }
+            elif t.result == TEST_OMIT:
+                skipped += 1
+                test["skipped"] = 1
+
+            data["testcase"].append(test)
+
+        data["failures"] = failures
+        data["skipped"] = skipped
+        data["time"] = total_time
+
+        fd.write(json.dumps(data, indent=4, sort_keys=True))
+
 def xml_printresults(tests, file_name, suite='all'):
     with open(file_name, 'w') as fd:
         failures = 0
@@ -484,7 +522,7 @@ def xml_printresults(tests, file_name, suite='all'):
             testsuite.appendChild(testcase)
             testcase.setAttribute("name", t.name)
             testcase.setAttribute("classname", t.suite)
-            testcase.setAttribute("time", str(t.time_taken))
+            testcase.setAttribute("time", t.time_taken)
 
             total_time += t.time_taken
             if t.result == TEST_FAIL:
nfs4.1/testserver.py +5 -1
index d3c44c7..085f007 100755
@@ -68,6 +68,8 @@ def scan_options(p):
                  help="Skip final cleanup of test directory")
     p.add_option("--outfile", "--out", default=None, metavar="FILE",
                  help="Store test results in FILE [%default]")
+    p.add_option("--jsonout", "--json", default=None, metavar="FILE",
+                 help="Store test results in JSON format [%default]")
     p.add_option("--xmlout", "--xml", default=None, metavar="FILE",
                  help="Store test results in xml format [%default]")
     p.add_option("--debug_fail", action="store_true", default=False,
@@ -363,7 +365,9 @@ def main():
     if fail:
         print("\nWARNING: could not clean testdir due to:\n%s\n" % err)
 
-    if opt.xmlout is not None:
+    if opt.jsonout is not None:
+        testmod.json_printresults(tests, opt.jsonout)
+    elif opt.xmlout is not None:
         testmod.xml_printresults(tests, opt.xmlout)
 
 if __name__ == "__main__":
Signature · 1 line
2.31.1
author
#3 lore raw

Re: [PATCH pynfs 2/3] server: Allow to print JSON format

Hi Bruce,

Quoted 1 line

I've got nothing against this, but I'm curious why you need it.

Well, I can integrate it via XML, but JSON is just a bit more readable. So it's up to you.
Having code in XML (and JSON if accepted) would be nice.

I prefer to have well defined format instead of parsing showresults.py output (originally I though I'd add JSON to showresults.py, but then I noticed --xml in testserver.py).

Kind regards,
Petr

Quoted 1 line

--b.

author
#4 lore raw

PATCH 3/3 server: Add test code to JSON and XML output

In reply to Petr Vorel

test code is printed when parsed --outfile log with showresults.py.

It's useful to have it in JSON and XML log generated by testserver.py --json or --xml.

---
 nfs4.1/testmod.py | 2 ++
 1 file changed, 2 insertions(+)
nfs4.1/testmod.py +2 -0
index 4b4ed24..47016dd 100644
@@ -481,6 +481,7 @@ def json_printresults(tests, file_name, suite='all'):
         data["testcase"] = []
         for t in tests:
             test = {
+                "code": t.code,
                 "name": t.name,
                 "classname": t.suite,
                 "time": str(t.time_taken),
@@ -520,6 +521,7 @@ def xml_printresults(tests, file_name, suite='all'):
         for t in tests:
             testcase = doc.createElement("testcase")
             testsuite.appendChild(testcase)
+            testcase.setAttribute("code", t.code)
             testcase.setAttribute("name", t.name)
             testcase.setAttribute("classname", t.suite)
             testcase.setAttribute("time", t.time_taken)
Signature · 1 line
2.31.1