test: Make gfid-access.py more generic.
Few of the hard coded values, uid, gid and file permissions are made as arguments to make the script more generic. Also fixes the permission issue which was hard coded as integer instead of octal. Change-Id: Icec700770de2b7cae00e02f783d072860e6d5e2b BUG: 1176934 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/9366 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Aravinda VK <avishwan@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
c399cec72b
commit
0250eb0698
@ -17,7 +17,7 @@ TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 --aux-gfid-mount
|
||||
# create file with specific gfid
|
||||
uuid=`uuidgen`
|
||||
EXPECT "File creation OK" $PYTHON $(dirname $0)/../utils/gfid-access.py \
|
||||
$M0 ROOT file0 $uuid file
|
||||
$M0 ROOT file0 $uuid file 10 10 0644
|
||||
|
||||
# check gfid
|
||||
EXPECT "$uuid" getfattr --only-values -n glusterfs.gfid.string $M0/file0
|
||||
@ -29,6 +29,6 @@ TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 --aux-gfid-mount
|
||||
|
||||
# touch the file again (gfid-access.py handles errno)
|
||||
EXPECT "File creation OK" $PYTHON $(dirname $0)/../utils/gfid-access.py \
|
||||
$M0 ROOT file0 $uuid file
|
||||
$M0 ROOT file0 $uuid file 10 10 0644
|
||||
|
||||
cleanup;
|
||||
|
@ -52,14 +52,18 @@ def entry_pack_symlink(gf, bn, lnk, mo, uid, gid):
|
||||
uid, gid, gf, mo, bn, lnk)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 6:
|
||||
print("USAGE: %s <mount> <pargfid|ROOT> <filename> <GFID> <file type>" % (sys.argv[0]))
|
||||
if len(sys.argv) < 9:
|
||||
print("USAGE: %s <mount> <pargfid|ROOT> <filename> <GFID> <file type>"
|
||||
" <uid> <gid> <file permission(octal str)>" % (sys.argv[0]))
|
||||
sys.exit(-1) # nothing to do
|
||||
mtpt = sys.argv[1]
|
||||
pargfid = sys.argv[2]
|
||||
fname = sys.argv[3]
|
||||
randomgfid = sys.argv[4]
|
||||
ftype = sys.argv[5]
|
||||
uid = int(sys.argv[6])
|
||||
gid = int(sys.argv[7])
|
||||
perm = int(sys.argv[8],8)
|
||||
|
||||
os.chdir(mtpt)
|
||||
if pargfid == 'ROOT':
|
||||
@ -71,11 +75,11 @@ if __name__ == '__main__':
|
||||
|
||||
# entry op: use non-zero uid/gid (to catch gfid-access xlator bugs)
|
||||
if ftype == 'file':
|
||||
mode = stat.S_IFREG | 644
|
||||
blob = entry_pack_reg(randomgfid, fname, mode, 10, 10)
|
||||
mode = stat.S_IFREG | perm
|
||||
blob = entry_pack_reg(randomgfid, fname, mode, uid, gid)
|
||||
elif ftype =='dir':
|
||||
mode = stat.S_IFDIR | 755
|
||||
blob = entry_pack_dir(randomgfid, fname, mode, 10, 10)
|
||||
mode = stat.S_IFDIR | perm
|
||||
blob = entry_pack_dir(randomgfid, fname, mode, uid, gid)
|
||||
else: # not yet...
|
||||
sys.exit(-1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user