Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions nfs4.0/servertests/st_acl.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
from nfs4_const import *
from environment import check, checklist
from nfs4_type import nfsace4
from nfs4lib import list2bitmap

# assuming server will accept any small positive integer as an owner
# name. In particular, these tests probably won't work over krb5,
# when string names are expected.

def testACL(t, env):
def testACLsupport(t, env):
"""SETATTR/GETATTR of a simple ACL

FLAGS: acl all
DEPEND: LOOKFILE
CODE: ACL0
"""
c = env.c1
c.init_connection()

supported = c.supportedAttrs(env.opts.usefile)
if supported & list2bitmap([FATTR4_ACL]):
t.fail_support("FATTR4_ACL not supported")

def testACL(t, env):
"""SETATTR/GETATTR of a simple ACL

FLAGS: acl all
DEPEND: LOOKFILE ACL0
CODE: ACL5
"""
c = env.c1
c.init_connection()

fh, stateid = c.create_confirm(t.code)
ops = c.use_obj(fh)
acl = [nfsace4(0, 0, 0,"123")]
Expand All @@ -30,11 +46,12 @@ def testLargeACL(t, env):
"""SETATTR/GETATTR of a large ACL

FLAGS: acl all
DEPEND: LOOKFILE
DEPEND: LOOKFILE ACL0
CODE: ACL10
"""
c = env.c1
c.init_connection()

fh, stateid = c.create_confirm(t.code)
ops = c.use_obj(fh)
acl = []
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def testGoodTag(t, env):
def testBadTags(t, env):
"""COMPOUND with invalid utf8 tags

FLAGS: compound utf8
FLAGS: compound utf8 ganesha
CODE: COMP3
"""
c = env.c1
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def testLongName(t, env):
def testInvalidUtf8(t, env):
"""LINK with bad UTF-8 name strings should return NFS4ERR_INVAL

FLAGS: link utf8
FLAGS: link utf8 ganesha
DEPEND: LINKS LOOKFILE MKDIR
CODE: LINK8
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ def testLockowner2(t, env):
Each lockowner must have its own seqid. Thus 2 file

# FLAGS: lock all
FLAGS:
FLAGS: ganesha
DEPEND: MKFILE MKDIR
CODE: LOCK13a
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_locku.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def testBadLockSeqid3(t, env):
"""LOCKU with a bad lockseqid should return NFS4ERR_BAD_SEQID

# FLAGS: locku seqid all
FLAGS:
FLAGS: ganesha
DEPEND: MKFILE
CODE: LKU6c
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def testNonAccessable(t, env):
def testInvalidUtf8(t, env):
"""LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL

FLAGS: lookup utf8
FLAGS: lookup utf8 ganesha
DEPEND:
CODE: LOOK7
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_lookupp.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def testXdev(t, env):
def testXdevHome(t, env):
"""LOOKUPP with dir on different fs

FLAGS: special
FLAGS: special ganesha
DEPEND:
CODE: LOOKP6
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def testNotDir(t, env):
def testInvalidUtf8(t, env):
"""OPEN with bad UTF-8 name strings should return NFS4ERR_INVAL

FLAGS: open utf8
FLAGS: open utf8 ganesha
DEPEND: MKDIR
CODE: OPEN13
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_putfh.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def testBadHandle(t, env):
def testStaleHandle(t, env):
"""PUTFH which nolonger exists should return NFS4ERR_STALE

FLAGS: putfh
FLAGS: putfh ganesha
DEPEND: MKFILE
CODE: PUTFH3
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def testWithOpen(t, env):
def testLargeCount(t, env):
"""READ a large dataset

FLAGS:
FLAGS: ganesha
DEPEND: MKFILE
CODE: RD4
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def testZeroLengthTarget(t, env):
def testNonUTF8(t, env):
"""REMOVE with non-UTF8 components should return NFS4ERR_INVAL

FLAGS: remove utf8
FLAGS: remove utf8 ganesha
DEPEND: MKDIR
CODE: RM5
"""
Expand Down
4 changes: 2 additions & 2 deletions nfs4.0/servertests/st_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def testZeroLengthNewname(t, env):
def testBadutf8Oldname(t, env):
"""RENAME with non-UTF8 oldname should return NFS4ERR_INVAL

FLAGS: rename utf8
FLAGS: rename utf8 ganesha
DEPEND: MKDIR
CODE: RNM8
"""
Expand All @@ -327,7 +327,7 @@ def testBadutf8Oldname(t, env):
def testBadutf8Newname(t, env):
"""RENAME with non-UTF8 newname should return NFS4ERR_INVAL

FLAGS: rename utf8
FLAGS: rename utf8 ganesha
DEPEND: MKDIR
CODE: RNM9
"""
Expand Down
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_secinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def testZeroLenName(t, env):
def testInvalidUtf8(t, env):
"""SECINFO with bad UTF-8 name strings should return NFS4ERR_INVAL

FLAGS: secinfo utf8
FLAGS: secinfo utf8 ganesha
DEPEND: SEC1
CODE: SEC6
"""
Expand Down
12 changes: 2 additions & 10 deletions nfs4.0/servertests/st_setattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def testFifo(t, env):
def testSocket(t, env):
"""SETATTR(FATTR4_MODE) on socket

FLAGS: setattr socketall
FLAGS: setattr socketall ganesha
DEPEND: MODE MKSOCK
CODE: SATT1s
"""
Expand Down Expand Up @@ -412,7 +412,7 @@ def testNonUTF8(t, env):
OWNER and GROUP are subject to too many restrictions to use.
Similarly for ACL.

FLAGS: setattr utf8
FLAGS: setattr utf8 ganesha
DEPEND: MKFILE
CODE: SATT9
"""
Expand Down Expand Up @@ -701,11 +701,3 @@ def testChangeGranularity(t, env):
chattr4 = res.resarray[7].obj_attributes
if chattr1 == chattr2 or chattr2 == chattr3 or chattr3 == chattr4:
t.fail("consecutive SETATTR(mode)'s don't all change change attribute")

# TODO:
# - This test would be better done with async writes; synchronous
# setattrs may not execute quickly enough to trigger a problem.
# But Linux server (in violation of spec) doesn't allow multiple
# IO's per compound! For now we test Linux server with async export
# option if we want to reproduce this problem.
# - We should try the same tests on directories.
2 changes: 1 addition & 1 deletion nfs4.0/servertests/st_setclientidconfirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def testStale(t, env):
def testBadConfirm(t, env):
"""SETCLIENTID_CONFIRM with case not covered in RFC

FLAGS:
FLAGS: ganesha
CODE: CIDCF2
"""
c = env.c1
Expand Down
46 changes: 44 additions & 2 deletions nfs4.0/servertests/st_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from nfs4_type import *
from environment import check, checklist, compareTimes, makeBadID, makeBadIDganesha, makeStaleId
import struct
import rpc

_text = 'write data' # len=10

Expand Down Expand Up @@ -388,7 +389,7 @@ def testSizes(t, env):
def testLargeReadWrite(t, env):
"""Compound with large READ and large WRITE

FLAGS: write
FLAGS: write ganesha
DEPEND: MKFILE
CODE: WRT16
"""
Expand Down Expand Up @@ -419,7 +420,7 @@ def testLargeReadWrite(t, env):
def testMultipleReadWrites(t,env):
"""Compound with multiple writes, then compound with multiple reads

FLAGS: write
FLAGS: write ganesha
DEPEND: MKFILE
CODE: WRT17
"""
Expand Down Expand Up @@ -457,3 +458,44 @@ def testMultipleReadWrites(t,env):
if resdata != expect:
t.fail("READ %d returned %s, expected %s" %
(i+1, repr(resdata), repr(expect)))

def testChangeGranularityWrite(t, env):
"""Rapidly repeated WRITE(UNSTABLE4) should change changeattr

FLAGS: write all
DEPEND: MODE MKFILE
CODE: WRT18
"""
c = env.c1
c.init_connection()
fh, stateid = c.create_confirm(t.code)
ops = c.use_obj(fh) + [c.getattr([FATTR4_CHANGE])] \
+ [c.write_op(stateid, 0, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \
+ [c.write_op(stateid, 10, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \
+ [c.write_op(stateid, 20, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \
+ [c.write_op(stateid, 30, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])]
res = c.compound(ops)
check(res)
chattr1 = res.resarray[1].obj_attributes
chattr2 = res.resarray[3].obj_attributes
chattr3 = res.resarray[5].obj_attributes
chattr4 = res.resarray[7].obj_attributes
if chattr1 == chattr2 or chattr2 == chattr3 or chattr3 == chattr4:
t.fail("consecutive SETATTR(mode)'s don't all change change attribute")

def testStolenStateid(t, env):
"""WRITE with incorrect permissions and somebody else's stateid

FLAGS: write all
DEPEND: MKFILE
CODE: WRT19
"""
c = env.c1
c.init_connection()
res = c.create_file(t.code, attrs={FATTR4_MODE: 0600})
fh, stateid = c.confirm(t.code, res)
security=c.security
c.security=rpc.SecAuthSys(0, "whatever", 3912, 2422, [])
res = c.write_file(fh, _text, stateid=stateid)
c.security=security
checklist(res, [NFS4ERR_ACCESS, NFS4ERR_PERM], "WRITE with stolen stateid")
2 changes: 1 addition & 1 deletion nfs4.1/server41tests/st_compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def testGoodTag(t, env):
def testBadTags(t, env):
"""COMPOUND with invalid utf8 tags

FLAGS: compound utf8
FLAGS: compound utf8 ganesha
CODE: COMP3
"""
c = env.c1
Expand Down
4 changes: 2 additions & 2 deletions nfs4.1/server41tests/st_create_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def testManyClients(t, env):
def testCallbackProgram(t, env):
"""Check server can handle random transient program number

FLAGS:
FLAGS: ganesha
CODE: CSESS20
"""
cb_occurred = threading.Event()
Expand All @@ -360,7 +360,7 @@ def mycheck(prog):
def testCallbackVersion(t, env):
"""Check server sends callback program with a version listed in nfs4client.py

FLAGS:
FLAGS: ganesha
CODE: CSESS21
"""
cb_occurred = threading.Event()
Expand Down
10 changes: 5 additions & 5 deletions nfs4.1/server41tests/st_destroy_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def testDestroy(t, env):
- Send a DESTROY_SESSION over the new tcp connection.
- This time it should succeed.

FLAGS: destroy_session
FLAGS: destroy_session ganesha
CODE: DSESS9001
"""
c = env.c1.new_client(env.testname(t))
Expand All @@ -39,7 +39,7 @@ def testDestroy2(t, env):
tests for example)
- check that we get the callback

FLAGS: destroy_session
FLAGS: destroy_session ganesha
CODE: DSESS9002
"""
recall = threading.Event()
Expand Down Expand Up @@ -86,7 +86,7 @@ def testDestroy3(t, env):
- check that a new callback is sent over the new session. Some
servers will do this very quickly, some might take longer.

FLAGS: destroy_session
FLAGS: destroy_session ganesha
CODE: DSESS9003
"""
recall = threading.Event()
Expand Down Expand Up @@ -139,7 +139,7 @@ def testDestoryNotFinalOps(t, env):
MUST be the final operation in the COMPOUND request.
rfc5661 18.37.3

FLAGS: destroy_session
FLAGS: destroy_session ganesha
CODE: DSESS9004
"""
c = env.c1.new_client(env.testname(t))
Expand All @@ -156,7 +156,7 @@ def testDestoryNotSoleOps(t, env):
and DESTROY_SESSION is not the sole operation,
then server MUST return NFS4ERR_NOT_ONLY_OP. rfc5661 18.37.3

FLAGS: destroy_session
FLAGS: destroy_session ganesha
CODE: DSESS9005
"""
c = env.c1.new_client(env.testname(t))
Expand Down
4 changes: 2 additions & 2 deletions nfs4.1/server41tests/st_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def testZeroLengthNewname(t, env):
def testBadutf8Oldname(t, env):
"""RENAME with non-UTF8 oldname should return NFS4ERR_INVAL

FLAGS: rename utf8
FLAGS: rename utf8 ganesha
CODE: RNM8
"""
name = env.testname(t)
Expand All @@ -332,7 +332,7 @@ def testBadutf8Oldname(t, env):
def testBadutf8Newname(t, env):
"""RENAME with non-UTF8 newname should return NFS4ERR_INVAL

FLAGS: rename utf8
FLAGS: rename utf8 ganesha
CODE: RNM9
"""
name = env.testname(t)
Expand Down