Home | History | Annotate | Download | only in acl
      1 '''
      2 	Access Control Lists testing based on newpynfs framework
      3 	Aurelien Charbon - Bull SA
      4 '''
      5 from random_gen import *
      6 from optparse import OptionParser
      7 import commands
      8 import os
      9 import threading
     10 import time
     11 import random
     12 
     13 alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-() ~'
     14 t_alphabet=len(alphabet)
     15 
     16 
     17 
     18 def test_longacl(l,path):
     19 	# mesures sur le getfacl
     20 	test = RandomGen()
     21 
     22 	u = commands.getoutput('rm ' + path + "/*")	# clean directory
     23 	print "test acl getfacl\n"
     24 	for i in range(l):
     25 		test.getUserList()
     26 		testfile = 'testfile' + str(i)
     27 		u = commands.getoutput('touch ' + path + "/" + testfile)
     28 		print "setfacl with " + str(i) + " entries\n " + u
     29 		for j in range(i):
     30 			user = test.uList.pop()
     31 			mode = test.createRandomMode()
     32                         u = commands.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + testfile)
     33 	                if u != "":
     34                                 print "setfacl -m u:" + user + ':' + mode + " " + path + "/" + testfile
     35                                 print u
     36 def main():
     37 	parser = OptionParser()
     38 	parser.add_option("-l", "--length", dest="length",type="int",help="max lentgh of ACL")
     39 	parser.add_option("-p", "--path", dest="path",help="path of test file")
     40 	(options, args) = parser.parse_args()
     41 	test_longacl(options.length,options.path)
     42 main()
     43 
     44