Exemplo n.º 1
0
def testDotsNewname(t, env):
    """RENAME into . or .. should return _BADNAME or NFS4_OK

    FLAGS: rename dots all
    CODE: RNM11
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, [name]])
    res = rename_obj(sess, basedir + [name], basedir + ['.'])
    check(res, NFS4ERR_BADNAME, "RENAME into '.'", [NFS4_OK])
    res = rename_obj(sess, basedir + [name], basedir + ['..'])
    check(res, NFS4ERR_BADNAME, "RENAME into '..'", [NFS4_OK])
Exemplo n.º 2
0
def testDotsOldname(t, env):
    """RENAME from nonexistant . or .. should return _NOENT/_BADNAME

    FLAGS: rename dots all
    CODE: RNM10
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, [name]])
    res = rename_obj(sess, basedir + ['.'], basedir + [name])
    check(res, NFS4ERR_BADNAME, "RENAME from nonexistant '.'", [NFS4ERR_NOENT])
    res = rename_obj(sess, basedir + ['..'], basedir + [name])
    check(res, NFS4ERR_BADNAME, "RENAME from nonexistant '..'",
          [NFS4ERR_NOENT])
Exemplo n.º 3
0
def testDotsOldname(t, env):
    """RENAME from nonexistant . or .. should return _NOENT/_BADNAME

    FLAGS: rename dots all
    CODE: RNM10
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, [name]])
    res = rename_obj(sess, basedir + ['.'], basedir + [name])
    check(res, NFS4ERR_BADNAME, "RENAME from nonexistant '.'",
          [NFS4ERR_NOENT])
    res = rename_obj(sess, basedir + ['..'], basedir + [name])
    check(res, NFS4ERR_BADNAME, "RENAME from nonexistant '..'",
          [NFS4ERR_NOENT])
Exemplo n.º 4
0
def testDotsNewname(t, env):
    """RENAME into . or .. should return _BADNAME or NFS4_OK

    FLAGS: rename dots all
    CODE: RNM11
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, [name]])
    res = rename_obj(sess, basedir + [name], basedir + ['.'])
    check(res, NFS4ERR_BADNAME, "RENAME into '.'",
          [NFS4_OK])
    res = rename_obj(sess, basedir + [name], basedir + ['..'])
    check(res, NFS4ERR_BADNAME, "RENAME into '..'",
          [NFS4_OK])
Exemplo n.º 5
0
def testSfhLink(t, env):
    """RENAME with non-dir (sfh) should return NFS4ERR_NOTDIR

    FLAGS: rename symlink all
    CODE: RNM2a
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    res = rename_obj(sess, env.opts.uselink + [name], env.c1.homedir + [name])
    checklist(res, [NFS4ERR_SYMLINK, NFS4ERR_NOTDIR], "RENAME with non-dir <sfh>")
Exemplo n.º 6
0
def testSfhSocket(t, env):
    """RENAME with non-dir (sfh) should return NFS4ERR_NOTDIR

    FLAGS: rename socket all
    CODE: RNM2s
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    res = rename_obj(sess, env.opts.usesocket + [name], env.c1.homedir + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <sfh>")
Exemplo n.º 7
0
def testSfhFifo(t, env):
    """RENAME with non-dir (sfh) should return NFS4ERR_NOTDIR

    FLAGS: rename fifo all
    CODE: RNM2f
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    res = rename_obj(sess, env.opts.usefifo + [name], env.c1.homedir + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <sfh>")
Exemplo n.º 8
0
def testDirToDir(t, env):
    """RENAME dir into existing, empty dir should retrun NFS4_OK

    FLAGS: rename all
    CODE: RNM13
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1', ['foo']], ['dir2']])
    res = rename_obj(sess, basedir + ['dir1'], basedir + ['dir2'])
    check(res, msg="RENAME dir1 into existing, empty dir2")
Exemplo n.º 9
0
def testFileToFile(t, env):
    """RENAME file into existing file should return NFS4_OK

    FLAGS: rename all
    CODE: RNM15
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, 'file1', 'file2'])
    res = rename_obj(sess, basedir + ['file1'], basedir + ['file2'])
    check(res, msg="RENAME file1 into existing file2")
Exemplo n.º 10
0
def testDirToFullDir(t, env):
    """RENAME dir into existing, nonempty dir should return NFS4ERR_EXIST

    FLAGS: rename all
    CODE: RNM16
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1'], ['dir2', ['foo']]])
    res = rename_obj(sess, basedir + ['dir1'], basedir + ['dir2'])
    checklist(res, [NFS4ERR_EXIST, NFS4ERR_NOTEMPTY], "RENAME dir1 into existing, nonempty dir2")
Exemplo n.º 11
0
def testDirToObj(t, env):
    """RENAME dir into existing nondir should return NFS4ERR_EXIST

    FLAGS: rename all
    CODE: RNM12
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir'], 'file'])
    res = rename_obj(sess, basedir + ['dir'], basedir + ['file'])
    check(res, NFS4ERR_EXIST, "RENAME dir into existing file")
Exemplo n.º 12
0
def testFileToFullDir(t, env):
    """RENAME file into existing, nonempty dir should return NFS4ERR_EXIST

    FLAGS: rename all
    CODE: RNM17
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, 'file', ['dir', ['foo']]])
    res = rename_obj(sess, basedir + ['file'], basedir + ['dir'])
    check(res, NFS4ERR_EXIST, "RENAME file into existing, nonempty dir")
Exemplo n.º 13
0
def testCfhFifo(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename fifo all
    CODE: RNM3f
    """
    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.usefifo + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
Exemplo n.º 14
0
def testCfhChar(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename char all
    CODE: RNM3c
    """
    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.usechar + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
Exemplo n.º 15
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")
Exemplo n.º 16
0
def testCfhBlock(t, env):
    """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR

    FLAGS: rename block all
    CODE: RNM3b
    """
    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.useblock + [name])
    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
Exemplo n.º 17
0
def testDirToObj(t, env):
    """RENAME dir into existing nondir should return NFS4ERR_EXIST

    FLAGS: rename all
    CODE: RNM12
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir'], 'file'])
    res = rename_obj(sess, basedir + ['dir'], basedir + ['file'])
    check(res, NFS4ERR_EXIST, "RENAME dir into existing file")
Exemplo n.º 18
0
def testFileToFullDir(t, env):
    """RENAME file into existing, nonempty dir should return NFS4ERR_EXIST

    FLAGS: rename all
    CODE: RNM17
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, 'file', ['dir', ['foo']]])
    res = rename_obj(sess, basedir + ['file'], basedir + ['dir'])
    check(res, NFS4ERR_EXIST, "RENAME file into existing, nonempty dir")
Exemplo n.º 19
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)
Exemplo n.º 20
0
def testFileToFullDir(t, env):
    """RENAME file into existing, nonempty dir should fail

    FLAGS: rename all
    CODE: RNM17
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, 'file', ['dir', ['foo']]])
    res = rename_obj(sess, basedir + ['file'], basedir + ['dir'])
    # note rfc 3530 and 1813 specify EXIST, but posix specifies ISDIR
    checklist(res, [NFS4ERR_EXIST, NFS4ERR_ISDIR], "RENAME file into existing, nonempty dir")
Exemplo n.º 21
0
def testValidDir(t, env):
    """RENAME : normal operation

    FLAGS: rename dir all
    CODE: RNM1d
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1', ['foo']], ['dir2']])
    res = rename_obj(sess, basedir + ['dir1', 'foo'], basedir + ['dir2', 'bar'])
    check(res, msg="RENAME of directory %s/dir1/foo to %s/dir2/bar" %
          (name, name))
Exemplo n.º 22
0
def testDirToObj(t, env):
    """RENAME dir into existing nondir should fail

    FLAGS: rename all
    CODE: RNM12
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir'], 'file'])
    res = rename_obj(sess, basedir + ['dir'], basedir + ['file'])
    # note rfc 3530 and 1813 specify EXIST, but posix specifies NOTDIR
    checklist(res, [NFS4ERR_EXIST, NFS4ERR_NOTDIR], "RENAME dir into existing file")
Exemplo n.º 23
0
def testValidFile(t, env):
    """RENAME : normal operation

    FLAGS: rename file all
    CODE: RNM1r
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, ['dir1', 'foo'], ['dir2']])
    res = rename_obj(sess, basedir + ['dir1', 'foo'],
                     basedir + ['dir2', 'bar'])
    check(res, msg="RENAME of file %s/dir1/foo to %s/dir2/bar" % (name, name))
Exemplo n.º 24
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")
Exemplo n.º 25
0
def testBadutf8Newname(t, env):
    """RENAME with non-UTF8 newname should return NFS4ERR_INVAL

    FLAGS: rename utf8
    CODE: RNM9
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    basedir = env.c1.homedir + [name]
    maketree(sess, [name, [name]])
    for bad_utf8 in get_invalid_utf8strings():
        res = rename_obj(sess, basedir + [name], basedir + [bad_utf8])
        check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 newname %s/%s" %
                                   (name, repr(bad_utf8)[1:-1]))
Exemplo n.º 26
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))
Exemplo n.º 27
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))
Exemplo n.º 28
0
def testBadutf8Oldname(t, env):
    """RENAME with non-UTF8 oldname should return NFS4ERR_INVAL

    FLAGS: rename utf8 ganesha
    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]))
Exemplo n.º 29
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))
Exemplo n.º 30
0
def testSelfRenameFile(t, env):
    """RENAME that does nothing

    FLAGS: rename all
    CODE: RNM19
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    fh, stateid = create_confirm(sess, name)
    basedir = env.c1.homedir + [name]
    res = rename_obj(sess, basedir, basedir)
    check(res)
    scinfo = res.resarray[-1].source_cinfo
    tcinfo = res.resarray[-1].target_cinfo
    if scinfo.before != scinfo.after or tcinfo.before != tcinfo.after:
        t.fail("RENAME of file %s into itself should do nothing, "
               "but cinfo was changed" % name)
Exemplo n.º 31
0
def testSelfRenameDir(t, env):
    """RENAME that does nothing

    FLAGS: rename all
    CODE: RNM18
    """
    name = env.testname(t)
    c = env.c1.new_client(name)
    sess = c.create_session()
    maketree(sess, [name])
    basedir = env.c1.homedir + [name]
    res = rename_obj(sess, basedir, basedir)
    check(res)
    scinfo = res.resarray[-1].source_cinfo
    tcinfo = res.resarray[-1].target_cinfo
    if scinfo.before != scinfo.after or tcinfo.before != tcinfo.after:
        t.fail("RENAME of dir %s into itself should do nothing, "
               "but cinfo was changed" % name)
Exemplo n.º 32
0
def testLinkRename(t, env):
    """RENAME of file into its hard link should do nothing

    FLAGS: rename all
    CODE: RNM20
    """
    name = env.testname(t)
    sess = env.c1.new_client_session(name)
    maketree(sess, [name, 'file'])
    basedir = env.c1.homedir + [name]
    res = link(sess, basedir + ['file'], basedir + ['link'])
    check(res)
    res = rename_obj(sess, basedir + ['file'], basedir + ['link'])
    check(res, msg="RENAME of file into its hard link")
    scinfo = res.resarray[-1].source_cinfo
    tcinfo = res.resarray[-1].target_cinfo
    if scinfo.before != scinfo.after or tcinfo.before != tcinfo.after:
        t.fail("RENAME of file into its hard link should do nothing, "
               "but cinfo was changed")