コード例 #1
0
def testCfhSocket(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename socket all
    CODE: RNM3s
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    res = create_obj(sess, env.c1.homedir + [name])
    check(res)
    res = rename_obj(sess, env.c1.homedir + [name], env.opts.usesocket + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
コード例 #2
0
def testCfhLink(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename symlink all
    CODE: RNM3a
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    res = create_obj(sess, env.c1.homedir + [name])
    check(res)
    res = rename_obj(sess, env.c1.homedir + [name], env.opts.uselink + [name])
    check(res, [NFS4ERR_NOTDIR, NFS4ERR_SYMLINK], "RENAME with non-dir <cfh>")
コード例 #3
0
def testZeroLengthNewname(t, env):
    """RENAME with zero length newname should return NFS4ERR_INVAL

    FLAGS: rename all
    CODE: RNM7
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    res = create_obj(sess, basedir)
    check(res)
    res = rename_obj(sess, basedir + ['foo'], basedir + [''])
    check(res, NFS4ERR_INVAL, "RENAME with zero length newname")
コード例 #4
0
def testNonExistent(t, env):
    """RENAME on non-existing object should return NFS4ERR_NOENT

    FLAGS: rename all
    CODE: RNM5
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    res = create_obj(sess, basedir)
    check(res)
    res = rename_obj(sess, basedir + ['foo'], basedir + ['bar'])
    check(res, NFS4ERR_NOENT, "RENAME on non-existing object %s/foo" % name)
コード例 #5
0
ファイル: st_rename.py プロジェクト: bongiojp/pynfs
def testCfhLink(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename symlink all
    CODE: RNM3a
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    res = create_obj(sess, env.c1.homedir + [name])
    check(res)
    res = rename_obj(sess, env.c1.homedir + [name], env.opts.uselink + [name])
    checklist(res, [NFS4ERR_NOTDIR, NFS4ERR_SYMLINK],
                                "RENAME with non-dir <cfh>")
コード例 #6
0
def testCfhFifo(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename fifo all
    CODE: RNM3f
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    res = create_obj(sess, [name])
    check(res)
    res = rename_obj(sess, env.c1.homedir + [name], env.opts.usefifo + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
コード例 #7
0
def testZeroLengthOldname(t, env):
    """RENAME with zero length oldname should return NFS4ERR_INVAL

    FLAGS: rename all
    CODE: RNM6
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    basedir = env.c1.homedir + [name]
    res = create_obj(sess, basedir)
    check(res)
    res = rename_obj(sess, basedir + [''], basedir + ['bar'])
    check(res, NFS4ERR_INVAL, "RENAME with zero length oldname")
コード例 #8
0
def testValidSocket(t, env):
    """RENAME : normal operation

    FLAGS: rename socket all
    CODE: RNM1s
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1'], ['dir2']])
    res = create_obj(sess, basedir + ['dir1', 'foo'], NF4SOCK)
    check(res)
    res = rename_obj(sess, basedir + ['dir1', 'foo'], basedir + ['dir2', 'bar'])
    check(res, msg="RENAME of socket %s/dir1/foo to %s/dir2/bar" %
          (name, name))
コード例 #9
0
def testValidChar(t, env):
    """RENAME : normal operation

    FLAGS: rename char all
    CODE: RNM1c
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1'], ['dir2']])
    res = create_obj(sess, basedir + ['dir1', 'foo'], createtype4(NF4BLK, devdata=specdata4(1, 2)))
    check(res)
    res = rename_obj(sess, basedir + ['dir1', 'foo'], basedir + ['dir2', 'bar'])
    check(res, msg="RENAME of character device %s/dir1/foo to %s/dir2/bar" %
          (name, name))
コード例 #10
0
def testValidLink(t, env):
    """RENAME : normal operation

    FLAGS: rename symlink all
    CODE: RNM1a
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1'], ['dir2']])
    res = create_obj(sess, basedir + ['dir1', 'foo'], createtype4(NF4LNK, linkdata=env.linkdata))
    check(res)
    res = rename_obj(sess, basedir + ['dir1', 'foo'], basedir + ['dir2', 'bar'])
    check(res, msg="RENAME of symlink %s/dir1/foo to %s/dir2/bar" %
          (name, name))
コード例 #11
0
def testBadutf8Oldname(t, env):
    """RENAME with non-UTF8 oldname should return NFS4ERR_INVAL

    FLAGS: rename utf8
    CODE: RNM8
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    res = create_obj(sess, basedir)
    check(res)
    for bad_utf8 in get_invalid_utf8strings():
        res = rename_obj(sess, basedir + [bad_utf8], basedir + [name])
        check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 oldname %s/%s" %
                                   (name, repr(bad_utf8)[1:-1]))
コード例 #12
0
def testValidFifo(t, env):
    """RENAME : normal operation

    FLAGS: rename fifo all
    CODE: RNM1f
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1'], ['dir2']])
    res = create_obj(sess, basedir + ['dir1', 'foo'], NF4FIFO)
    check(res)
    res = rename_obj(sess, basedir + ['dir1', 'foo'],
                     basedir + ['dir2', 'bar'])
    check(res, msg="RENAME of fifo %s/dir1/foo to %s/dir2/bar" % (name, name))