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