1''' 2 Access Control Lists testing based on newpynfs framework 3 Aurelien Charbon - Bull SA 4''' 5from random_gen import * 6from optparse import OptionParser 7import commands 8import os 9import threading 10import time 11import random 12 13alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-() ~' 14t_alphabet=len(alphabet) 15 16 17 18def 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 36def 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) 42main() 43 44