summaryrefslogtreecommitdiffstats
path: root/tests/utils
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2014-12-30 10:47:49 +0530
committerVijay Bellur <vbellur@redhat.com>2014-12-31 01:20:37 -0800
commit0250eb0698e567134ddd897b134bbe4f8da003a2 (patch)
tree8f0a05311fed1b3f89aad3c680d6c83590dc79c3 /tests/utils
parentc399cec72b9985f120a1495e93e1a380911547d9 (diff)
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>
Diffstat (limited to 'tests/utils')
-rwxr-xr-xtests/utils/gfid-access.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/utils/gfid-access.py b/tests/utils/gfid-access.py
index 4fd4b6dfa8d..81258073da1 100755
--- a/tests/utils/gfid-access.py
+++ b/tests/utils/gfid-access.py
@@ -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)