pynfs patches
Subsystems (3)
cover pynfs patches
This fixes a RECLAIM_COMPLETE bug that makes the tests work for me again.
And also try sharing a few more things between 4.0 and 4.1.
The same patches are available from
git://linux-nfs.org/~bfields/pynfs.git master
My biggest remaining annoyance is that the rename tests all go over the nfs server's maximum op count. pynfs should really be smart enough to do the lookups in reasonable chunks. Or we could probably find a simpler workaround for the rename case.
(And I've also updated by test scripts to use the new merged project, atgit://linux-nfs.org/~bfields/testd.git.)
--b.
J. Bruce Fields (6):
CLNT: provide new_client_session shortcut
CLNT: send RECLAIM_COMPLETE when required
Share showresults.py between 4.0 and 4.1
Make top-level setup.py set up nfs4.0 as well
Merge top-level READMEs
Share testmod.py between nfs4.0 and nfs4.1
README | 17 +- README-4.1 | 8 - nfs4.0/lib/testmod.py | 417 +---------------------------------- nfs4.0/showresults.py | 74 ------ nfs4.1/nfs4client.py | 6 + nfs4.1/server41tests/environment.py | 3 +- nfs4.1/server41tests/st_block.py | 16 +- nfs4.1/server41tests/st_open.py | 23 +-- nfs4.1/server41tests/st_rename.py | 108 +++------ nfs4.1/server41tests/st_secinfo.py | 6 +- nfs4.1/server41tests/st_sequence.py | 9 +- nfs4.1/showresults.py | 74 ------ setup.py | 6 +- showresults.py | 74 ++++++ 14 files changed, 158 insertions(+), 683 deletions(-) delete mode 100644 README-4.1 mode change 100644 => 120000 nfs4.0/lib/testmod.py delete mode 100755 nfs4.0/showresults.py delete mode 100755 nfs4.1/showresults.py mode change 100644 => 100755 setup.py create mode 100755 showresults.py
Signature · 1 line
1.7.4.1
PATCH 1/6 CLNT: provide new_client_session shortcut
Most tests begin with new_client + create_session. Provide a handy shortcut for both.
This will also provide a convenient place to put a RECLAIM_COMPLETE, which most tests also need.
--- nfs4.1/nfs4client.py | 5 ++ nfs4.1/server41tests/environment.py | 3 +- nfs4.1/server41tests/st_block.py | 16 +++--- nfs4.1/server41tests/st_open.py | 21 ++----- nfs4.1/server41tests/st_rename.py | 108 ++++++++++++----------------------- nfs4.1/server41tests/st_secinfo.py | 6 +- nfs4.1/server41tests/st_sequence.py | 8 +-- 7 files changed, 62 insertions(+), 105 deletions(-)
nfs4.1/nfs4client.py +5 -0
@@ -289,6 +289,11 @@ class NFS4Client(rpc.Client, rpc.Server): else: return None + def new_client_session(self, name, flags=0): + c = self.new_client(name, flags=flags) + s = c.create_session() + return s + class ClientStateProtection(object): def __init__(self, p_res, p_arg): self.type = p_res.spr_how
nfs4.1/server41tests/environment.py +1 -2
@@ -143,8 +143,7 @@ class Environment(testmod.Environment): """Run once before any test is run""" if self.opts.noinit: return - c = self.c1.new_client("Environment.init_%i" % self.timestamp) - sess = c.create_session() + sess = self.c1.new_client_session("Environment.init_%i" % self.timestamp) if self.opts.maketree: self._maketree(sess) # Make sure opts.home exists
nfs4.1/server41tests/st_block.py +8 -8
@@ -14,8 +14,8 @@ def testStateid1(t, env): FLAGS: block CODE: BLOCK1 """ - c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) - sess = c1.create_session() + sess = env.c1.new_client_session(env.testname(t), + flags=EXCHGID4_FLAG_USE_PNFS_MDS) # Create the file res = create_file(sess, env.testname(t)) check(res)
@@ -56,8 +56,8 @@ def testStateid2(t, env): FLAGS: block CODE: BLOCK2 """ - c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) - sess = c1.create_session() + c1 = env.c1.new_client_session(env.testname(t), + flags=EXCHGID4_FLAG_USE_PNFS_MDS) # Create the file res = create_file(sess, env.testname(t)) check(res)
@@ -116,8 +116,8 @@ def testEmptyCommit(t, env): FLAGS: block CODE: BLOCK3 """ - c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) - sess = c1.create_session() + c1 = env.c1.new_client_session(env.testname(t), + flags=EXCHGID4_FLAG_USE_PNFS_MDS) # Create the file res = create_file(sess, env.testname(t)) check(res)
@@ -178,8 +178,8 @@ def testSplitCommit(t, env): FLAGS: block CODE: BLOCK4 """ - c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) - sess = c1.create_session() + sess = env.c1.new_client_session(env.testname(t), + flags=EXCHGID4_FLAG_USE_PNFS_MDS) # Create the file res = create_file(sess, env.testname(t)) check(res)
nfs4.1/server41tests/st_open.py +7 -14
@@ -18,8 +18,7 @@ def testSupported(t, env): FLAGS: open all CODE: OPEN1 """ - c1 = env.c1.new_client(env.testname(t)) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, env.testname(t)) check(res) # See 8.1.3.1 of draft-10:
@@ -38,8 +37,7 @@ def testServerStateSeqid(t, env): CODE: OPEN2 """ name = env.testname(t) - c1 = env.c1.new_client(name) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(name) owner = "owner_%s" % name path = sess1.c.homedir + [name] res = create_file(sess1, owner, path, access=OPEN4_SHARE_ACCESS_WRITE)
@@ -60,8 +58,7 @@ def xtestClientStateSeqid(t, env): CODE: OPEN3 """ name = env.testname(t) - c1 = env.c1.new_client(name) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(name) owner = "owner_%s" % name path = sess1.c.homedir + [name] res = create_file(sess1, owner, path, access=OPEN4_SHARE_ACCESS_WRITE)
@@ -86,8 +83,7 @@ def xtestOpenSeqid(t, env): CODE: OPEN4 """ name = env.testname(t) - c1 = env.c1.new_client(name) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(name) owner = "owner_%s" % name path = sess1.c.homedir + [name] res = create_file(sess1, owner, path, access=OPEN4_SHARE_ACCESS_WRITE)
@@ -143,8 +139,7 @@ def testReadDeleg(t, env): if deleg.delegation_type == OPEN_DELEGATE_NONE: fail("Could not get delegation") # c2 - OPEN - WRITE - c2 = env.c1.new_client("%s_2" % env.testname(t)) - sess2 = c2.create_session() + sess2 = env.c1.new_client_session("%s_2" % env.testname(t)) claim = open_claim4(CLAIM_NULL, env.testname(t)) owner = open_owner4(0, "My Open Owner 2") how = openflag4(OPEN4_NOCREATE)
@@ -168,8 +163,7 @@ def testReadWrite(t, env): FLAGS: open all CODE: OPEN30 """ - c1 = env.c1.new_client(env.testname(t)) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(env.testname(t)) owner = open_owner4(0, "My Open Owner") res = create_file(sess1, env.testname(t)) check(res)
@@ -196,8 +190,7 @@ def testEXCLUSIVE4AtNameAttribute(t, env): FLAGS: open all CODE: OPEN6 """ - c1 = env.c1.new_client(env.testname(t)) - sess1 = c1.create_session() + sess1 = env.c1.new_client(env.testname(t)) res = create_file(sess1, env.testname(t), mode=EXCLUSIVE4_1) check(res)
nfs4.1/server41tests/st_rename.py +36 -72
324 lines not on this page · raw message
nfs4.1/server41tests/st_secinfo.py +2 -4
@@ -12,8 +12,7 @@ def testSupported(t, env): CODE: SEC1 """ name = env.testname(t) - c = env.c1.new_client(env.testname(t)) - sess = c.create_session() + sess = env.c1.new_client_session(env.testname(t)) # Create a tmpfile for testing owner = "owner_%s" % name
@@ -38,8 +37,7 @@ def testSupported2(t, env): CODE: SEC2 """ name = env.testname(t) - c = env.c1.new_client(env.testname(t)) - sess = c.create_session() + sess = env.c1.new_client_session(env.testname(t)) # Create a tmpfile for testing owner = "owner_%s" % name
nfs4.1/server41tests/st_sequence.py +3 -5
@@ -205,8 +205,7 @@ def testReplayCache002(t, env): FLAGS: sequence all CODE: SEQ9b """ - c1 = env.c1.new_client(env.testname(t)) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, "%s_1" % env.testname(t)) check(res) ops = env.home + [op.savefh(),\
@@ -290,8 +289,7 @@ def testReplayCache007(t, env): FLAGS: sequence all CODE: SEQ10b """ - c1 = env.c1.new_client(env.testname(t)) - sess1 = c1.create_session() + sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, "%s_1" % env.testname(t)) check(res) ops = env.home + [op.savefh(),\
@@ -373,8 +371,8 @@ def testReuseSlotID(t, env): CODE: SEQ14 """ c = env.c1.new_client(env.testname(t)) - # CREATE_SESSION sess1 = c.create_session() + sess1 = env.c1.new_client_session(env.testname(t)) name = "%s_1" % env.testname(t) res = create_file(sess1, name)
Signature · 1 line
1.7.4.1
PATCH 2/6 CLNT: send RECLAIM_COMPLETE when required
In reply to J. Bruce FieldsAll tests fail against any server which (correctly) enforces the requirement that a RECLAIM_COMPLETE precede any client's first non-reclaim OPEN.
Mi Jinlong suggested putting the RECLAIM_COMPLETE in create_file, which works well since create_file almost always generates the first such open.
But that seems like an odd place to put what is really a sort of initialization. Whether many exist now, there will eventually be tests that don't start with create_file, or that create multiple files.
So, instead, use the just-added new_client_session method.
--- nfs4.1/nfs4client.py | 1 + nfs4.1/server41tests/st_open.py | 2 ++ nfs4.1/server41tests/st_sequence.py | 1 + 3 files changed, 4 insertions(+), 0 deletions(-)
nfs4.1/nfs4client.py +1 -0
@@ -292,6 +292,7 @@ class NFS4Client(rpc.Client, rpc.Server): def new_client_session(self, name, flags=0): c = self.new_client(name, flags=flags) s = c.create_session() + s.compound([op.reclaim_complete(FALSE)]) return s class ClientStateProtection(object):
nfs4.1/server41tests/st_open.py +2 -0
@@ -110,6 +110,7 @@ def xtestOpenClientid(t, env): # If by coincidence clientid==0, make a new client c1 = env.c1.new_client("%s_2" % name) sess1 = c1.create_session() + sess1.compound([op.reclaim_complete(FALSE)]) res = create_file(sess1, env.testname(t), clientid=c1.clientid) check(res, NFS4ERR_INVAL, msg="Using non-zero clientid in open_owner")
@@ -130,6 +131,7 @@ def testReadDeleg(t, env): c1.cb_pre_hook(OP_CB_RECALL, pre_hook) c1.cb_post_hook(OP_CB_RECALL, post_hook) sess1 = c1.create_session() + sess1.compound([op.reclaim_complete(FALSE)]) res = create_file(sess1, env.testname(t), access=OPEN4_SHARE_ACCESS_READ | OPEN4_SHARE_ACCESS_WANT_READ_DELEG)
nfs4.1/server41tests/st_sequence.py +1 -0
@@ -373,6 +373,7 @@ def testReuseSlotID(t, env): c = env.c1.new_client(env.testname(t)) sess1 = c.create_session() sess1 = env.c1.new_client_session(env.testname(t)) + sess1.compound([op.reclaim_complete(FALSE)]) name = "%s_1" % env.testname(t) res = create_file(sess1, name)
Signature · 1 line
1.7.4.1
PATCH 3/6 Share showresults.py between 4.0 and 4.1
In reply to J. Bruce FieldsCode for showresults.py is identical between 4.0 and 4.1.
--- nfs4.0/showresults.py | 74 ------------------------------------------------- nfs4.1/showresults.py | 74 ------------------------------------------------- showresults.py | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 148 deletions(-) delete mode 100755 nfs4.0/showresults.py delete mode 100755 nfs4.1/showresults.py create mode 100755 showresults.py
nfs4.0/showresults.py deleted +0 -74
@@ -1,74 +0,0 @@ -#!/usr/bin/env python -# showresults.py - redisplay results from nfsv4 server tester output file -# -# Requires python 2.3 -# -# Written by Fred Isaman <[email protected]> -# Copyright (C) 2004 University of Michigan, Center for -# Information Technology Integration -# - - -# Allow to be run stright from package root -if __name__ == "__main__": - import os.path - import sys - if os.path.isfile(os.path.join(sys.path[0], 'lib', 'testmod.py')): - sys.path.insert(1, os.path.join(sys.path[0], 'lib')) - -#import cPickle as pickle -import pickle -import testmod -from optparse import OptionParser - -class MyUnpickler(pickle.Unpickler): - class Unknown(object): - def __init__(self, name): - self.name = name - - def find_class(self, module, name): - # Handle function renames gracefully - __import__(module) - mod = sys.modules[module] - try: - klass = getattr(mod, name) - return klass - except: - return self.Unknown(name) - -def show(filename, opt): - fd = file(filename, 'r') - p = MyUnpickler(fd) - tests = p.load() - testmod.printresults(tests, opt) - -def scan_options(p): - """Parse command line options""" - p.add_option("--showpass", action="store_true", default=True, - help="Show passed tests [default]") - p.add_option("--hidepass", action="store_false", dest="showpass", - help="Hide passed tests") - p.add_option("--showomit", action="store_true", default=False, - help="Show omitted tests") - p.add_option("--hideomit", action="store_false", dest="showomit", - help="Hide omitted tests [default]") - p.add_option("--showwarn", action="store_true", default=True, - help="Show tests that gave warnings [default]") - p.add_option("--hidewarn", action="store_false", dest="showwarn", - help="Hide tests that gave warnings") - p.add_option("--showfail", action="store_true", default=True, - help="Show failed tests [default]") - p.add_option("--hidefail", action="store_false", dest="showfail", - help="Hide failed tests") - return p.parse_args() - -def main(): - p = OptionParser("%prog [options] filename") - opt, args = scan_options(p) - if not args: - p.error("Need a filename") - for a in args: - show(a, opt) - -if __name__ == "__main__": - main()
nfs4.1/showresults.py deleted +0 -74
74 lines not on this page · raw message
showresults.py new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 4/6 Make top-level setup.py set up nfs4.0 as well
In reply to J. Bruce FieldsWith this, a single run of the top level setup.py will do everything.
Also I can't see any reason not to make setup.py executable.
--- setup.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 setup.py
setup.py +4 -2
@@ -1,3 +1,5 @@ +#!/usr/bin/env python + from distutils.core import setup import sys
@@ -5,13 +7,13 @@ import os from os.path import join DESCRIPTION = """ -newpynfs 4.1 +pynfs ============ Add stuff here. """ -DIRS = ["ply", "xdr", "gssapi", "rpc", "nfs4.1"] # Order is important +DIRS = ["ply", "xdr", "gssapi", "rpc", "nfs4.1", "nfs4.0"] # Order is important def setup(*args, **kwargs): print "This just runs the setup.py file in each of the following dirs:"
Signature · 1 line
1.7.4.1
PATCH 5/6 Merge top-level READMEs
In reply to J. Bruce Fields--- README | 17 +++++++++++++---- README-4.1 | 8 -------- 2 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 README-4.1
README +13 -4
@@ -1,4 +1,13 @@ -The 4.0 and 4.1 git trees have been merged, preparing for merging of -the actual code bases. As a first step, the original 4.0 code was -just moved down into the nfs4.0 directory. If yuo want to ignore the -4.1 work, just cd down to nfs4.0 and work from there as before. +This tree includes support for both 4.0 and 4.1 pynfs testing. It is +the merge of what were originally two independent projects--initially +the 4.0 pynfs code was all moved into the nfs4.0 directory, but as time +passes we expect to merge the two code bases. + +You can prepare both for use with a single + ./setup.py build_ext --inplace +which will create auto-generated files and compile any shared libraries +in place. + +For more details about 4.0 and 4.1 testing, see nfs4.0/README and +nfs4.1/README, respectively. For information about automatic code +generation from an XDR file, see xdr/README.
README-4.1 deleted +0 -8
@@ -1,8 +0,0 @@ -For nfs4 testing, see the nfs4/README. -For automatic code generation frmo an XDR file, see xdr/README. - -First, if you need gss (kerberos), cd to the gssapi directoy -and run "python setup.py build_ext --inplace" - -To use, you will first need to run "python setup.py build" to generate -python files from xdr.
Signature · 1 line
1.7.4.1
Re: [PATCH 5/6] Merge top-level READMEs
README line 9
Quoted 4 lines · J. Bruce Fields
README +4
-0+You can prepare both for use with a single + ./setup.py build_ext --inplace +which will create auto-generated files and compile any shared libraries +in place.
This, by the way, is a bald-faced lie.
Or anyway, at least I'm having trouble getting the tests to run unless I do a "setup.py build".
But I thought I'd just leave it as is and get you to explain what's actually supposed to work....
--b.
PATCH 6/6 Share testmod.py between nfs4.0 and nfs4.1
In reply to J. Bruce FieldsThe nfs4.0 copy is really just an older version of the one in nfs4.1. Probably this should go in some common directory, but I don't know where, so I'm just replacing the nfs4.0 copy by a symlink to nfs4.1's.
--- nfs4.0/lib/testmod.py | 417 +------------------------------------------------ 1 files changed, 1 insertions(+), 416 deletions(-) mode change 100644 => 120000 nfs4.0/lib/testmod.py
nfs4.0/lib/testmod.py deleted +0 -416
@@ -1,416 +0,0 @@ -# testmod.py - run tests from a suite -# -# Requires python 2.3 -# -# Written by Fred Isaman <[email protected]> -# Copyright (C) 2004 University of Michigan, Center for -# Information Technology Integration -# -import nfs4.nfs4lib -import re -import sys -from traceback import format_exception - -if 'sum' not in __builtins__: - def sum(seq, start=0): - return reduce(lambda x,y: x+y, seq, start) - -# Possible outcomes -TEST_NOTRUN = 0 # Not yet considered -TEST_RUNNING = 1 # Test actually running -TEST_WAIT = 2 # Waiting for dependencies to run -TEST_OMIT = 3 # Test skipped -TEST_FAIL = 4 # Test failed -TEST_NOTSUP = 5 # Counts as WARN, but considered a failed dependency -TEST_WARN = 6 # Technically a PASS, but there was a better way -TEST_PASS = 7 # Test passed -DEP_FUNCT = 100 # Used for depency functions - -class Result(object): - outcome_names = { TEST_NOTRUN : "NOT RUN", - TEST_RUNNING: "RUNNING", - TEST_WAIT : "WAITING TO RUN", - TEST_OMIT : "OMIT", - TEST_FAIL : "FAILURE", - TEST_NOTSUP : "UNSUPPORTED", - TEST_WARN : "WARNING", - TEST_PASS : "PASS", - DEP_FUNCT : "DEPENDENCY FUNCTION" - } - - def __init__(self, outcome=TEST_NOTRUN, msg="", tb=None, default=False): - self.outcome = outcome - self.msg = str(msg) - self.default = default - if tb is None: - self.tb = [] - else: - #self.tb = ''.join(format_exception(*tb)) - self.tb = format_exception(*tb) - - def __str__(self): - return self.outcome_names[self.outcome] - - def __repr__(self): - return '\n'.join([self.__str__(), self.msg]) - - def __eq__(self, other): - if type(other) == type(0): - return self.outcome == other - else: - return id(self) == id(other) - - def __ne__(self, other): - if type(other) == type(0): - return self.outcome != other - else: - return id(self) != id(other) - -class TestException(Exception): - pass - -class UnsupportedException(TestException): - def __init__(self, *args): - self.type = TEST_NOTSUP - TestException.__init__(self, *args) - -class FailureException(TestException): - def __init__(self, *args): - self.type = TEST_FAIL - TestException.__init__(self, *args) - -class WarningException(TestException): - def __init__(self, *args): - self.type = TEST_WARN - TestException.__init__(self, *args) - -class Test(object): - _keywords = ["FLAGS", "DEPEND", "CODE"] - _pass_result = Result(TEST_PASS, default=True) - _run_result = Result(TEST_RUNNING, default=True) - _wait_result = Result(TEST_WAIT, "Circular dependency", default=True) - _omit_result = Result(TEST_OMIT, "Failed runfilter", default=True) - _funct_result = Result(DEP_FUNCT, default=True) - __re = re.compile(r'(\D*)(\d*)(.*)') - - def __init__(self, function, module=""): - """Needs function to be run""" - self.runtest = function - self.name = function.__name__ - if module: - self.fullname = module.split('.')[-1] + '.' + self.name - else: - self.fullname = self.name - self.doc = function.__doc__.split('\n')[0].strip() - #self.doc = function.__doc__.strip() - self.result = Result() - self._read_docstr(function.__doc__) - - def _read_docstr(self, s): - """Searches s for 'keyword: list' and stores resulting lists""" - for key in self._keywords: - p = re.compile(r'^\s*' + key +':(.*$)', re.MULTILINE) - match = p.search(str(s)) - if match is None: - setattr(self, key.lower() + '_list', []) - else: - setattr(self, key.lower() + '_list', match.group(1).split()) - - def __getstate__(self): - """Remove function reference when pickling - - This vastly reduce size of the output file, while at the same - time making it more robust to function/class renames. However, - if we need to restore this info for some reason, will need a - __setstate__ function to try and recover it. - """ - d = self.__dict__.copy() - del d["runtest"] - del d["dependencies"] - del d["flags"] - return d - -## def __cmp__(self, other): -## if self.code < other.code: -## return -1 -## elif self.code == other.code: -## return 0 -## else: -## return 1 - - def __cmp__(self, other): - me = self.__re.match(self.code) - me = (me.group(1), int(me.group(2).zfill(1)), me.group(3)) - you = self.__re.match(other.code) - you = (you.group(1), int(you.group(2).zfill(1)), you.group(3)) - if me < you: - return -1 - elif me == you: - return 0 - else: - return 1 - - def __str__(self): - return "%-8s %s" % ( self.code, self.fullname) - - def __repr__(self): - if self.result.msg: - return "%-65s : %s\n%s" % (self, self.result, self._format(self.result.msg)) - else: - return "%-65s : %s" % (self, self.result) - - def display(self, showdoc=False, showtrace=False): - out = "%-65s : %s" % (str(self), str(self.result)) - if showdoc: - out += "\n%s" % self._format(self.doc, 5, 70) - if showtrace and self.result.tb: - out += "\n%s" % ''.join(self.result.tb) - elif self.result.msg: - out += "\n%s" % self._format(self.result.msg, 11, 64) - return out - - - def _format(self, s, start_col=11, end_col=64): - s = str(s) - indent = ' ' * (start_col - 1) - out = indent - lout = len(out) - words = s.split() - for w in words: - lw = len(w) - if lout + lw > end_col and lout > start_col: - out += '\n' + indent - lout = start_col - 1 - out += ' ' + w - lout += lw + 1 - return out - - def fail(self, msg): - raise FailureException(msg) - - def fail_support(self, msg): - raise UnsupportedException(msg) - - def pass_warn(self, msg): - raise WarningException(msg) - - def __info(self): - #return sys.exc_info() - exctype, excvalue, tb = sys.exc_info() - if sys.platform[:4] == 'java': ## tracebacks look different in Jython - return (exctype, excvalue, tb) - newtb = tb.tb_next - if newtb is None: - return (exctype, excvalue, tb) - return (exctype, excvalue, newtb) - - def run(self, environment, verbose=False): - """Run self.runtest, storing result""" - #print "*********Running test %s (%s)" % (self.name, self.code) - self.result = self._run_result - if verbose: - print repr(self) - try: - environment.startUp() - self.runtest(self, environment) - self.result = self._pass_result - except KeyboardInterrupt: - raise - except TestException, e: - self.result = Result(e.type, e, sys.exc_info()) - except StandardError, e: - self.result = Result(TEST_FAIL, '', sys.exc_info()) - self.result.msg = self.result.tb[-1] - except Exception, e: - self.result = Result(TEST_FAIL, e, sys.exc_info()) - try: - environment.shutDown() - except StandardError, e: - self.result = Result(TEST_FAIL, '', sys.exc_info()) - self.result.msg = self.result.tb[-1] - if verbose: - print repr(self) - -class Environment(object): - """Base class for a test environment""" - def __init__(self, opts): - self.opts = opts - - def init(self): - """Run once before any test is run""" - pass - - def finish(self): - """Run once after all tests are run""" - pass - - def startUp(self): - """Run before each test""" - pass - - 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: - if t.result == TEST_NOTRUN: - _runtree(t, options, environment, runfilter) - else: - # Test has already been run in a dependency tree - pass - -def _runtree(t, options, environment, runfilter=_run_filter): - if t.result == TEST_WAIT: - return - t.result = t._wait_result - if not runfilter(t, options): - # Check flags to see if test should be omitted - t.result = t._omit_result - return - if options.rundeps: - runfilter = lambda x, y : True - for dep in t.dependencies: - if dep.result == DEP_FUNCT: - if (not options.force) and (not dep(t, environment)): - t.result = Result(TEST_OMIT, - "Dependency function %s failed" % - dep.__name__) - return - continue - if dep.result == t._omit_result and options.rundeps: - _runtree(dep, options, environment, runfilter) - elif dep.result in [TEST_NOTRUN, TEST_WAIT]: - _runtree(dep, options, environment, runfilter) - # Note dep.result has now changed - if dep.result == TEST_WAIT: - return - elif (not options.force) and \ - (dep.result in [TEST_OMIT, TEST_FAIL, TEST_NOTSUP]): - t.result = Result(TEST_OMIT, - "Dependency %s had status %s." % \ - (dep, dep.result)) - return - t.run(environment, getattr(options, 'verbose', False)) - -def _import_by_name(name): - mod = __import__(name) - components = name.split('.') - for comp in components[1:]: - mod = getattr(mod, comp) - return mod - -def createtests(testdir): - """ Tests are functions that start with "test". Their docstring must - contain a line starting with "FLAGS:" and a line starting with "CODE:". - It may optionall contain a line starting with "DEPEND:". Each test must - have a unique code string. The space seperated list of flags must - not contain any code names. The depend list is a list of code names for - tests that must be run before the given test. - """ - # Find all tests in testdir - tests = [] - package = _import_by_name(testdir) - for testfile in package.__all__: - if testfile.endswith('.py'): - testfile = testfile[:-3] - testmod = ".".join([testdir, testfile]) - mod = _import_by_name(testmod) - for attr in dir(mod): - if attr.startswith("test"): - f = getattr(mod, attr) - tests.append(Test(f, testmod)) - # Reduce doc string info into format easier to work with - used_codes = {} - flag_dict = {} - bit = 1L - for t in tests: - if not t.flags_list: - raise("%s has no flags" % t.fullname) - for f in t.flags_list: - if f not in flag_dict: - flag_dict[f] = bit - bit <<= 1 - if len(t.code_list) != 1: - raise("%s needs exactly one code" % t.fullname) - t.code = t.code_list[0] - if t.code in used_codes: - raise("%s trying to use a code already used" % t.fullname) - used_codes[t.code] = t - del t.code_list - # Check that flags don't contain a code word - for f in flag_dict: - if f in used_codes: - raise("flag %s is also used as a test code" % f) - # Now turn dependency names into pointers, and flags into a bitmask - for t in tests: - t.flags = sum([flag_dict[x] for x in t.flags_list]) - t.dependencies = [] - for d in t.depend_list: - if d in used_codes: - t.dependencies.append(used_codes[d]) - else: - mod = _import_by_name(t.runtest.__module__) - if not hasattr(mod, d): - raise("Could not find reference to dependency %s" % str(d)) - funct = getattr(mod, d) - if not callable(funct): - raise("Dependency %s of %s does not exist" % - (d, t.fullname)) - funct.result = t._funct_result - 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 - for t in tests: - if not hasattr(t, "result"): - print dir(t) - print t.__dict__ - raise - if t.result == TEST_NOTRUN: - count[NOTRUN] += 1 - elif t.result == TEST_OMIT and t.result.default: - count[OMIT] += 1 - elif t.result in [TEST_WAIT, TEST_OMIT]: - count[SKIP] += 1 - elif t.result == TEST_FAIL: - count[FAIL] += 1 - elif t.result in [TEST_NOTSUP, TEST_WARN]: - count[WARN] += 1 - elif t.result == TEST_PASS: - count[PASS] += 1 - print >> file, "*"*50 - for t in tests: - if t.result == TEST_NOTRUN: - continue - if t.result == TEST_OMIT and t.result.default: - continue - if (not opts.showomit) and t.result == TEST_OMIT: - continue - if (not opts.showpass) and t.result == TEST_PASS: - continue - if (not opts.showwarn) and t.result in [TEST_NOTSUP, TEST_WARN]: - continue - if (not opts.showfail) and t.result == TEST_FAIL: - continue - print >> file, t.display(0,0) - print >> file, "*"*50 - if count[NOTRUN]: - print >> file, "Tests interrupted! Only %i tests run" % \ - sum(count[SKIP:]) - else: - print >> file, "Command line asked for %i of %i tests" % \ - (sum(count[SKIP:]), len(tests)) - print >> file, "Of those: %i Skipped, %i Failed, %i Warned, %i Passed" % \ - (count[SKIP], count[FAIL], count[WARN], count[PASS])
nfs4.0/lib/testmod.py new file +1 -0
@@ -0,0 +1 @@ +../../nfs4.1/testmod.py
Signature · 1 line
1.7.4.1
Quoted 5 lines · J. Bruce Fields
This fixes a
RECLAIM_COMPLETEbug that makes the tests work for me again.And also try sharing a few more things between 4.0 and 4.1.
Quoted 8 lines
The same patches are available from
git://linux-nfs.org/~bfields/pynfs.gitmasterMy biggest remaining annoyance is that the rename tests all go over the nfs server's maximum op count. pynfs should really be smart enough to do the lookups in reasonable chunks. Or we could probably find a simpler workaround for the rename case.
Here's a hack for the case of rename, also applied on top of the "master" branch above.
I'd also like to make all lookups relative to the root of the test tree--that just makes sense anyway, and it'd make the maximum length of paths used a property of the tests rather than of the environment (so somebody doesn't get different results just because their test tree is at a longer path).
The obstacle is the useblock/usechar/etc. options which take absolute paths. Maybe they should just be looked up once at the start.
--b.
Quoted 1 line
From
9a477cc5f3ffa3a956f68f5c5b08860f3360c2a4Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <[email protected]>
Date: Mon, 1 Aug 2011 18:05:43 -0400
Subject: [PATCH] server41tests: separate lookup from rename
The length of the rename compounds is ridiculous, and can cause spurious failures against the linux server, depending on the length of the path to the pynfs test root.
So do the lookups in separate compounds from the rename itself.
--- nfs4.1/server41tests/environment.py | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
nfs4.1/server41tests/environment.py +12 -5
@@ -545,12 +545,19 @@ def maketree(sess, tree, root=None, owner=None): else: create_confirm(sess, owner, root + [obj]) +def lookup_obj(sess, path): + compound = [op.putrootfh()] + compound += [op.lookup(comp) for comp in path] + compound += [op.getfh()] + res = sess.compound(compound) + check(res) + return res.resarray[-1].object + def rename_obj(sess, oldpath, newpath): - # Set (sfh) to olddir - ops = use_obj(oldpath[:-1]) + [op.savefh()] - # Set (cfh) to newdir - ops += use_obj(newpath[:-1]) - # Call rename + olddir = lookup_obj(sess, oldpath[:-1]) + newdir = lookup_obj(sess, newpath[:-1]) + ops = [op.putfh(olddir), op.savefh()] + ops += [op.putfh(newdir)] ops += [op.rename(oldpath[-1], newpath[-1])] return sess.compound(ops)
Signature · 1 line
1.7.4.1
two more minor pynfs patches
In reply to J. Bruce FieldsMinor rearranging of nfs4.0/, an update to the README. Please pull this and previously posted patches from
git://linux-nfs.org/~bfields/pynfs.git master
--b.
commit 8c1e8b6014b8680bdabd89948dd9de79504dec24
Author: J. Bruce Fields <[email protected]> Date: Tue Aug 9 11:55:41 2011 -0400
Move nfs4.0/lib/nfs4/* to nfs4.0/
Petr Benas points out that my commit 4a297d951 "Share testmod.py between nfs4.0 and nfs4.1", which replaced nfs4.0's copy of testmod.py by a symlink to nfs4.1's copy, didn't work because nfs4lib is in a different location in the two trees. He quite reasonably proposed replacing the symlink by a copy and fixing the import statment in the copy like:
- import nfs4lib
+ import nfs4.nfs4lib
However, that would require admitting a mistake on my part, which my giant ego does not permit me to do.
Instead, rearrange the rest of the world to match my original mistake.
My theory is:
- we aim to merge the two code bases over time, so anything that makes them a little more similar is probably good; and
- nfs4.1 is Newer, therefore Better, so nfs4.0 should be made to imitate it rather than the other way around.
nfs4.0/.gitignore +2 -2
@@ -4,7 +4,7 @@ /out_last # Generated files -/lib/nfs4/nfs4_ops.py +/nfs4_ops.py *_const.py *_type.py *_pack.py
@@ -17,4 +17,4 @@ # quilt files patches series -.pc +.pc
nfs4.0/lib/nfs4/__init__.py deleted +0 -1
@@ -1 +0,0 @@ -
nfs4.0/lib/ops_gen.py +2 -2
@@ -6,8 +6,8 @@ # Information Technology Integration # -from nfs4.nfs4_const import nfs_opnum4 -import nfs4.nfs4_type as nfs4_type +from nfs4_const import nfs_opnum4 +import nfs4_type as nfs4_type import time header = """\
nfs4.0/nfs4.x renamed from nfs4.0/lib/nfs4/nfs4.x +0 -0
nfs4.0/nfs4acl.py renamed from nfs4.0/lib/nfs4/nfs4acl.py +2 -2
@@ -10,8 +10,8 @@ # Taken from mapping description at # http://www.citi.umich.edu/projects/nfsv4/rfc/draft-ietf-nfsv4-acl-mapping-02.txt -from nfs4.nfs4_const import * -from nfs4.nfs4_type import * +from nfs4_const import * +from nfs4_type import * # Taken from mapping MODE_R = ACE4_READ_DATA | ACE4_READ_NAMED_ATTRS
nfs4.0/nfs4client.py +4 -4
@@ -27,10 +27,10 @@ except ImportError: # import rlcompleter # readline.parse_and_bind("tab: complete") #import cmd -import nfs4.nfs4lib as nfs4lib -import nfs4.nfs4_type as nfs4_type -import nfs4.nfs4_const as nfs4_const -import nfs4.nfs4_pack as nfs4_pack +import nfs4lib +import nfs4_type +import nfs4_const +import nfs4_pack import code import traceback
nfs4.0/nfs4lib.py renamed from nfs4.0/lib/nfs4/nfs4lib.py +0 -0
nfs4.0/nfs4server.py +6 -6
@@ -25,15 +25,15 @@ if __name__ == "__main__": if os.path.isfile(os.path.join(sys.path[0], 'lib', 'testmod.py')): sys.path.insert(1, os.path.join(sys.path[0], 'lib')) -from nfs4.nfs4_const import * -from nfs4.nfs4_type import * -import nfs4.nfs4_pack as nfs4_pack +from nfs4_const import * +from nfs4_type import * +import nfs4_pack import rpc.rpc as rpc -import nfs4.nfs4lib as nfs4lib +import nfs4lib import time, StringIO, random, traceback, codecs import StringIO -import nfs4.nfs4state as nfs4state -from nfs4.nfs4state import NFS4Error, printverf +import nfs4state +from nfs4state import NFS4Error, printverf from xdrlib import Error as XDRError unacceptable_names = [ "", ".", ".." ]
nfs4.0/nfs4state.py renamed from nfs4.0/lib/nfs4/nfs4state.py +0 -0
nfs4.0/servertests/__init__.py renamed from nfs4.0/lib/nfs4/servertests/__init__.py +0 -0
nfs4.0/servertests/environment.py renamed from nfs4.0/lib/nfs4/servertests/environment.py +3 -3
@@ -10,9 +10,9 @@ import time import testmod -from nfs4.nfs4lib import NFS4Client, get_attrbitnum_dict -from nfs4.nfs4_const import * -from nfs4.nfs4_type import fsid4, nfsace4, fs_locations4, fs_location4, \ +from nfs4lib import NFS4Client, get_attrbitnum_dict +from nfs4_const import * +from nfs4_type import fsid4, nfsace4, fs_locations4, fs_location4, \ specdata4, nfstime4, settime4, stateid4 import rpc import sys
nfs4.0/servertests/st_access.py renamed from nfs4.0/lib/nfs4/servertests/st_access.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check _maxval = ACCESS4_DELETE | ACCESS4_EXECUTE | ACCESS4_EXTEND | \
nfs4.0/servertests/st_close.py renamed from nfs4.0/lib/nfs4/servertests/st_close.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, makeStaleId
nfs4.0/servertests/st_commit.py renamed from nfs4.0/lib/nfs4/servertests/st_commit.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist _text = "Random data to write"
nfs4.0/servertests/st_compound.py renamed from nfs4.0/lib/nfs4/servertests/st_compound.py +3 -3
@@ -1,6 +1,6 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import nfs_argop4 -from nfs4.nfs4_pack import NFS4Packer +from nfs4_const import * +from nfs4_type import nfs_argop4 +from nfs4_pack import NFS4Packer from environment import check, checklist, get_invalid_utf8strings from rpc import RPCError
nfs4.0/servertests/st_create.py renamed from nfs4.0/lib/nfs4/servertests/st_create.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import createtype4, specdata4 +from nfs4_const import * +from nfs4_type import createtype4, specdata4 from environment import check, checklist def getDefaultAttr(c):
nfs4.0/servertests/st_delegation.py renamed from nfs4.0/lib/nfs4/servertests/st_delegation.py +3 -3
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import nfs_client_id4, clientaddr4, cb_client4 +from nfs4_const import * +from nfs4_type import nfs_client_id4, clientaddr4, cb_client4 from environment import check, checklist import os import threading
@@ -389,7 +389,7 @@ def testChangeDeleg(t, env, funct=_recall): FLAGS: delegations CODE: DELEG9 """ - from nfs4.nfs4lib import CBServer + from nfs4lib import CBServer c = env.c1 id = 'pynfs%i_%s' % (os.getpid(), t.code) c.init_connection(id, cb_ident=0)
nfs4.0/servertests/st_fslocations.py renamed from nfs4.0/lib/nfs4/servertests/st_fslocations.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4lib import list2bitmap +from nfs4_const import * +from nfs4lib import list2bitmap from environment import check def testReference(t, env):
nfs4.0/servertests/st_getattr.py renamed from nfs4.0/lib/nfs4/servertests/st_getattr.py +2 -2
@@ -1,6 +1,6 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist -from nfs4.nfs4lib import get_attr_name +from nfs4lib import get_attr_name def _try_mandatory(t, env, path): c = env.c1
nfs4.0/servertests/st_getfh.py renamed from nfs4.0/lib/nfs4/servertests/st_getfh.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def testFile(t, env):
nfs4.0/servertests/st_gss.py renamed from nfs4.0/lib/nfs4/servertests/st_gss.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check from socket import timeout import rpc
nfs4.0/servertests/st_link.py renamed from nfs4.0/lib/nfs4/servertests/st_link.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_utf8strings def _basictest(t, c, path, error=NFS4_OK):
nfs4.0/servertests/st_lock.py renamed from nfs4.0/lib/nfs4/servertests/st_lock.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import stateid4 +from nfs4_const import * +from nfs4_type import stateid4 from environment import check, checklist, get_invalid_clientid, makeStaleId import time
nfs4.0/servertests/st_lockt.py renamed from nfs4.0/lib/nfs4/servertests/st_lockt.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_clientid def testUnlockedFile(t, env):
nfs4.0/servertests/st_locku.py renamed from nfs4.0/lib/nfs4/servertests/st_locku.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import stateid4 +from nfs4_const import * +from nfs4_type import stateid4 from environment import check, checklist, makeStaleId def testFile(t, env):
nfs4.0/servertests/st_lookup.py renamed from nfs4.0/lib/nfs4/servertests/st_lookup.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_utf8strings def testDir(t, env):
nfs4.0/servertests/st_lookupp.py renamed from nfs4.0/lib/nfs4/servertests/st_lookupp.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_utf8strings def testDir(t, env):
nfs4.0/servertests/st_nverify.py renamed from nfs4.0/lib/nfs4/servertests/st_nverify.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_clientid, makeStaleId def _try_mand(env, path):
nfs4.0/servertests/st_open.py renamed from nfs4.0/lib/nfs4/servertests/st_open.py +2 -2
@@ -1,6 +1,6 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, checkdict, get_invalid_utf8strings -from nfs4.nfs4lib import get_bitnumattr_dict +from nfs4lib import get_bitnumattr_dict # Any test that uses create_confirm should depend on this test def testOpen(t, env):
nfs4.0/servertests/st_openconfirm.py renamed from nfs4.0/lib/nfs4/servertests/st_openconfirm.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import stateid4 +from nfs4_const import * +from nfs4_type import stateid4 from environment import check, checklist, makeStaleId def _confirm(t, c, file, stateid):
nfs4.0/servertests/st_opendowngrade.py renamed from nfs4.0/lib/nfs4/servertests/st_opendowngrade.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, makeStaleId def testRegularOpen(t, env):
nfs4.0/servertests/st_putfh.py renamed from nfs4.0/lib/nfs4/servertests/st_putfh.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def _try_put(t, c, path):
nfs4.0/servertests/st_putpubfh.py renamed from nfs4.0/lib/nfs4/servertests/st_putpubfh.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def testSupported(t, env):
nfs4.0/servertests/st_putrootfh.py renamed from nfs4.0/lib/nfs4/servertests/st_putrootfh.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def testSupported(t, env):
nfs4.0/servertests/st_read.py renamed from nfs4.0/lib/nfs4/servertests/st_read.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, makeBadID, makeStaleId def _compare(t, res, expect, eof=True):
nfs4.0/servertests/st_readdir.py renamed from nfs4.0/lib/nfs4/servertests/st_readdir.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4lib import get_attr_name +from nfs4_const import * +from nfs4lib import get_attr_name from environment import check def _compare(t, entries, expect, attrlist=[]):
nfs4.0/servertests/st_readlink.py renamed from nfs4.0/lib/nfs4/servertests/st_readlink.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def testReadlink(t, env):
nfs4.0/servertests/st_reboot.py renamed from nfs4.0/lib/nfs4/servertests/st_reboot.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist import os
nfs4.0/servertests/st_releaselockowner.py renamed from nfs4.0/lib/nfs4/servertests/st_releaselockowner.py +2 -2
@@ -1,5 +1,5 @@ -from nfs4.nfs4_const import * -from nfs4.nfs4_type import lock_owner4 +from nfs4_const import * +from nfs4_type import lock_owner4 from environment import check, checklist def testFile(t, env):
nfs4.0/servertests/st_remove.py renamed from nfs4.0/lib/nfs4/servertests/st_remove.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, get_invalid_utf8strings def testDir(t, env):
nfs4.0/servertests/st_rename.py renamed from nfs4.0/lib/nfs4/servertests/st_rename.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, get_invalid_utf8strings def testValidDir(t, env):
nfs4.0/servertests/st_renew.py renamed from nfs4.0/lib/nfs4/servertests/st_renew.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def testRenew(t, env):
nfs4.0/servertests/st_replay.py renamed from nfs4.0/lib/nfs4/servertests/st_replay.py +2 -2
@@ -1,6 +1,6 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist -from nfs4.nfs4_type import exist_lock_owner4, locker4 +from nfs4_type import exist_lock_owner4, locker4 def _replay(c, ops, error=NFS4_OK): # Can send in an error list, but replays must return same error as orig
nfs4.0/servertests/st_restorefh.py renamed from nfs4.0/lib/nfs4/servertests/st_restorefh.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def _try_sequence(t, c, path):
nfs4.0/servertests/st_savefh.py renamed from nfs4.0/lib/nfs4/servertests/st_savefh.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check # NOTE other tests in restorefh.py
nfs4.0/servertests/st_secinfo.py renamed from nfs4.0/lib/nfs4/servertests/st_secinfo.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, get_invalid_utf8strings # XXX Do this for each object type
nfs4.0/servertests/st_setattr.py renamed from nfs4.0/lib/nfs4/servertests/st_setattr.py +3 -3
@@ -1,7 +1,7 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_utf8strings -from nfs4.nfs4lib import bitmap2list, dict2fattr -from nfs4.nfs4_type import nfstime4, settime4 +from nfs4lib import bitmap2list, dict2fattr +from nfs4_type import nfstime4, settime4 def _set_mode(t, c, file, stateid=None, msg=" using stateid=0", warnlist=[]):
nfs4.0/servertests/st_setclientid.py renamed from nfs4.0/lib/nfs4/servertests/st_setclientid.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check import os import struct, time
nfs4.0/servertests/st_setclientidconfirm.py renamed from nfs4.0/lib/nfs4/servertests/st_setclientidconfirm.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check import os
nfs4.0/servertests/st_spoof.py renamed from nfs4.0/lib/nfs4/servertests/st_spoof.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check def testSpoofUser(t, env):
nfs4.0/servertests/st_verify.py renamed from nfs4.0/lib/nfs4/servertests/st_verify.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, checklist, get_invalid_clientid, makeStaleId def _try_mand(env, path):
nfs4.0/servertests/st_write.py renamed from nfs4.0/lib/nfs4/servertests/st_write.py +1 -1
@@ -1,4 +1,4 @@ -from nfs4.nfs4_const import * +from nfs4_const import * from environment import check, compareTimes, makeBadID, makeStaleId _text = 'write data' # len=10
nfs4.0/setup.py +2 -3
@@ -41,8 +41,7 @@ def use_xdr(dir, xdrfile): def generate_files(): home = os.getcwd() - dir = os.path.join(topdir, 'lib', 'nfs4') - use_xdr(dir, 'nfs4.x') + use_xdr(topdir, 'nfs4.x') import ops_gen # this must be delayed until nfs4.x is parsed sources = [ os.path.join(topdir, 'lib', 'ops_gen.py'), 'nfs4_const.py', 'nfs4_type.py' ]
@@ -94,7 +93,7 @@ setup(name = "newpynfs", ext_modules = [gssapi], package_dir = {'': 'lib'}, - packages = ['nfs4', 'nfs4.servertests', 'ply', 'rpc', 'rpc.rpcsec'], + packages = ['servertests', 'ply', 'rpc', 'rpc.rpcsec'], py_modules = ['testmod', 'rpcgen'], scripts = ['testserver.py', 'showresults.py'] )
nfs4.0/testserver.py +3 -3
@@ -38,7 +38,7 @@ if __name__ == "__main__": import re import testmod from optparse import OptionParser, OptionGroup, IndentedHelpFormatter -import nfs4.servertests.environment as environment +import servertests.environment as environment import socket import rpc import cPickle as pickle
@@ -260,7 +260,7 @@ def run_filter(test, options): def printflags(list): """Print all legal flag names, which are given in list""" - from nfs4.nfs4_const import nfs_opnum4 + from nfs4_const import nfs_opnum4 command_names = [s.lower()[3:].replace('_', '') \ for s in nfs_opnum4.values()] list.sort()
@@ -285,7 +285,7 @@ def main(): opt, args = scan_options(p) # Create test database - tests, fdict, cdict = testmod.createtests('nfs4.servertests') + tests, fdict, cdict = testmod.createtests('servertests') # Deal with any informational options if opt.showflags:
commit 9bcbd7d3e2ec918f65d8d33cbf6df4cc76229b85
Author: J. Bruce Fields <[email protected]> Date: Tue Aug 9 16:20:12 2011 -0400
Fix README setup instructions
This is what I have to do--perhaps it's not actually correct and the setup scripts need fixing.
README +2 -1
@@ -3,7 +3,8 @@ the merge of what were originally two independent projects--initially the 4.0 pynfs code was all moved into the nfs4.0 directory, but as time passes we expect to merge the two code bases. -You can prepare both for use with a single +You can prepare both for use with + ./setup.py build ./setup.py build_ext --inplace which will create auto-generated files and compile any shared libraries in place.
Re: two more minor pynfs patches
I have more changes available from:
git://linux-nfs.org/~bfields/pynfs.git master
Main changes since the last pull request are to require a NFS4ERR_SYMLINK return for OPEN of non-regular files, and to allow it (as opposed to INVAL or ISDIR or whatever) for various operations on symlinks. I think that's correct.
--b.
J. Bruce Fields (19):
CLNT: provide new_client_session shortcut
CLNT: send RECLAIM_COMPLETE when required
Share showresults.py between 4.0 and 4.1
Make top-level setup.py set up nfs4.0 as well Merge top-level READMEs
Share testmod.py between nfs4.0 and nfs4.1
server41tests: separate lookup from rename read+write+readwrite open test
check another odd linux server case
Move nfs4.0/lib/nfs4/* to nfs4.0/
Fix README setup instructions
Warn that pynfs is not authoritative
4.0 server tests: OPEN of special file should return SYMLINK 4.0 server tests: allow SYMLINK for more tests 4.0 server tests: check open result in OPEN29
4.1 server tests: RNM2a should allow NFS4ERR_SYMLINK 4.1 server tests: remove SEQ14
4.0 server tests: fix OPEN29
4.0 server tests: fix DELEG6 for short leases
README | 24 +-
README-4.1 | 8 -
nfs4.0/.gitignore | 4 +-
nfs4.0/lib/nfs4/__init__.py | 1 -
nfs4.0/lib/ops_gen.py | 4 +-
nfs4.0/lib/testmod.py | 417 +-------------------
nfs4.0/{lib/nfs4 => }/nfs4.x | 0
nfs4.0/{lib/nfs4 => }/nfs4acl.py | 4 +-
nfs4.0/nfs4client.py | 8 +-
nfs4.0/{lib/nfs4 => }/nfs4lib.py | 0
nfs4.0/nfs4server.py | 12 +-
nfs4.0/{lib/nfs4 => }/nfs4state.py | 0
nfs4.0/{lib/nfs4 => }/servertests/__init__.py | 0
nfs4.0/{lib/nfs4 => }/servertests/environment.py | 6 +-
nfs4.0/{lib/nfs4 => }/servertests/st_access.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_close.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_commit.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_compound.py | 6 +-
nfs4.0/{lib/nfs4 => }/servertests/st_create.py | 8 +-
nfs4.0/{lib/nfs4 => }/servertests/st_delegation.py | 8 +-
.../{lib/nfs4 => }/servertests/st_fslocations.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_getattr.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_getfh.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_gss.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_link.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_lock.py | 21 +-
nfs4.0/{lib/nfs4 => }/servertests/st_lockt.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_locku.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_lookup.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_lookupp.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_nverify.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_open.py | 40 ++-
.../{lib/nfs4 => }/servertests/st_openconfirm.py | 4 +-
.../{lib/nfs4 => }/servertests/st_opendowngrade.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_putfh.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_putpubfh.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_putrootfh.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_read.py | 6 +-
nfs4.0/{lib/nfs4 => }/servertests/st_readdir.py | 12 +-
nfs4.0/{lib/nfs4 => }/servertests/st_readlink.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_reboot.py | 2 +-
.../nfs4 => }/servertests/st_releaselockowner.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_remove.py | 6 +-
nfs4.0/{lib/nfs4 => }/servertests/st_rename.py | 8 +-
nfs4.0/{lib/nfs4 => }/servertests/st_renew.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_replay.py | 4 +-
nfs4.0/{lib/nfs4 => }/servertests/st_restorefh.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_savefh.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_secinfo.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_setattr.py | 6 +-
.../{lib/nfs4 => }/servertests/st_setclientid.py | 2 +-
.../nfs4 => }/servertests/st_setclientidconfirm.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_spoof.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_verify.py | 2 +-
nfs4.0/{lib/nfs4 => }/servertests/st_write.py | 6 +-
nfs4.0/setup.py | 5 +-
nfs4.0/testserver.py | 6 +-
nfs4.1/nfs4client.py | 6 +
nfs4.1/server41tests/environment.py | 20 +-
nfs4.1/server41tests/st_block.py | 16 +-
nfs4.1/server41tests/st_open.py | 23 +-
nfs4.1/server41tests/st_rename.py | 112 ++----
nfs4.1/server41tests/st_secinfo.py | 6 +-
nfs4.1/server41tests/st_sequence.py | 35 +--
nfs4.1/showresults.py | 74 ----
setup.py | 6 +-
nfs4.0/showresults.py => showresults.py | 4 +-
67 files changed, 256 insertions(+), 748 deletions(-)
delete mode 100644 README-4.1
delete mode 100644 nfs4.0/lib/nfs4/__init__.py
mode change 100644 => 120000 nfs4.0/lib/testmod.py
rename nfs4.0/{lib/nfs4 => }/nfs4.x (100%)
rename nfs4.0/{lib/nfs4 => }/nfs4acl.py (99%)
rename nfs4.0/{lib/nfs4 => }/nfs4lib.py (100%)
rename nfs4.0/{lib/nfs4 => }/nfs4state.py (100%)
rename nfs4.0/{lib/nfs4 => }/servertests/__init__.py (100%)
rename nfs4.0/{lib/nfs4 => }/servertests/environment.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_access.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_close.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_commit.py (96%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_compound.py (96%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_create.py (97%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_delegation.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_fslocations.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_getattr.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_getfh.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_gss.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_link.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_lock.py (97%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_lockt.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_locku.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_lookup.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_lookupp.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_nverify.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_open.py (93%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_openconfirm.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_opendowngrade.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_putfh.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_putpubfh.py (96%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_putrootfh.py (88%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_read.py (97%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_readdir.py (97%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_readlink.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_reboot.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_releaselockowner.py (88%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_remove.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_rename.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_renew.py (97%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_replay.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_restorefh.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_savefh.py (91%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_secinfo.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_setattr.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_setclientid.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_setclientidconfirm.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_spoof.py (98%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_verify.py (99%)
rename nfs4.0/{lib/nfs4 => }/servertests/st_write.py (98%)
delete mode 100755 nfs4.1/showresults.py
mode change 100644 => 100755 setup.py
rename nfs4.0/showresults.py => showresults.py (94%)