From: Jeff Layton <jlayton@poochiereds.net>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/2] nfs41: add some READ/WRITE tests for special stateids
Date: Tue, 20 Oct 2015 12:01:00 -0400 [thread overview]
Message-ID: <1445356861-13860-1-git-send-email-jeff.layton@primarydata.com> (raw)
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
---
nfs4.1/server41tests/st_open.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open.py
index 24f051e75e8f..235212cccaed 100644
--- a/nfs4.1/server41tests/st_open.py
+++ b/nfs4.1/server41tests/st_open.py
@@ -9,6 +9,7 @@ from xdrdef.nfs4_type import open_to_lock_owner4
import nfs_ops
op = nfs_ops.NFS4ops()
import threading
+import nfs4lib
def expect(res, seqid):
"""Verify that open result has expected stateid.seqid"""
@@ -77,6 +78,31 @@ def testReadWrite(t, env):
if res.resarray[-1].data != desired:
fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
+def testAnonReadWrite(t, env):
+ """Do a simple READ and WRITE using anonymous stateid
+
+ FLAGS: open all
+ CODE: OPEN31
+ """
+ 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)
+ expect(res, seqid=1)
+ fh = res.resarray[-1].object
+ data = "write test data"
+ stateid = res.resarray[-2].stateid
+ res = close_file(sess1, fh, stateid=stateid)
+ res = sess1.compound([op.putfh(fh), op.write(nfs4lib.state00, 5, FILE_SYNC4, data)])
+ check(res)
+ res = sess1.compound([op.putfh(fh), op.read(nfs4lib.state00, 0, 1000)])
+ check(res)
+ if not res.resarray[-1].eof:
+ fail("EOF not set on read")
+ desired = "\0"*5 + data
+ if res.resarray[-1].data != desired:
+ fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
+
def testEXCLUSIVE4AtNameAttribute(t, env):
"""If the file does exist,but the stored verifier does not match,
then an error of NFS4ERR_EXIST is returned from server.
--
2.4.3
next reply other threads:[~2015-10-20 16:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 16:01 Jeff Layton [this message]
2015-10-20 16:01 ` [PATCH 2/2] create_session: ensure that we send an auth flavor in CREATE_SESSION call Jeff Layton
2015-10-21 15:59 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445356861-13860-1-git-send-email-jeff.layton@primarydata.com \
--to=jlayton@poochiereds.net \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox