1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci#
3f08c3bdfSopenharmony_ci#       @(#)runtests
4f08c3bdfSopenharmony_ci#
5f08c3bdfSopenharmony_ci# runtests script for ACL testing
6f08c3bdfSopenharmony_ciREMOTEHOST=nfsserver
7f08c3bdfSopenharmony_ciMAXLENGTH=30 # maximum ACL length - NB: the current NFSv4 acl implementation does not allow ACL greater than one page (about 35 entries with 6 character user name length and 10 character domain name)
8f08c3bdfSopenharmony_ciNFSMNTDIR=/mnt/nfs-acl
9f08c3bdfSopenharmony_ciecho "Test on NFS server $REMOTEHOST"
10f08c3bdfSopenharmony_ciACLTESTDIR=testdir
11f08c3bdfSopenharmony_ciACLTESTFILE=testfile
12f08c3bdfSopenharmony_ci
13f08c3bdfSopenharmony_ciUSER_NB=20 # total number of users to create
14f08c3bdfSopenharmony_ciGRP_NB=20 # total number of groups to create
15f08c3bdfSopenharmony_ciFILE_NB=10 # total number of files for the test
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci# creation of users on the local machine
18f08c3bdfSopenharmony_cifor i in 1 2 3 4 5
19f08c3bdfSopenharmony_cido
20f08c3bdfSopenharmony_ci	groupadd -g 60$i grp$i
21f08c3bdfSopenharmony_ci	useradd -u 60$i  user$i
22f08c3bdfSopenharmony_cidone
23f08c3bdfSopenharmony_ci
24f08c3bdfSopenharmony_ci#  creation of users on the remote machine (removed only at the end of the tests)
25f08c3bdfSopenharmony_cirsh -n $REMOTEHOST python3 $PWD/create_users.py -u 50 -g 50
26f08c3bdfSopenharmony_ci
27f08c3bdfSopenharmony_ciecho "Starting ACL testing"
28f08c3bdfSopenharmony_ci
29f08c3bdfSopenharmony_ciecho "Starting BASIC tests"
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_ciecho "Creating testing file and directory"
32f08c3bdfSopenharmony_citouch $NFSMNTDIR/$ACLTESTFILE
33f08c3bdfSopenharmony_cimkdir $NFSMNTDIR/$ACLTESTDIR
34f08c3bdfSopenharmony_ciif test ! -d $NFSMNTDIR/$ACLTESTDIR
35f08c3bdfSopenharmony_cithen
36f08c3bdfSopenharmony_ci	echo "Can't make directory $ACLTESTDIR"
37f08c3bdfSopenharmony_ci	exit 1
38f08c3bdfSopenharmony_cifi
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci# File and Directory tree creation test
41f08c3bdfSopenharmony_ciecho "Execute acl1 $NFSMNTDIR/$ACLTESTFILE $NFSMNTDIR/$ACLTESTDIR"
42f08c3bdfSopenharmony_ci./acl1 $NFSMNTDIR/$ACLTESTFILE $NFSMNTDIR/$ACLTESTDIR
43f08c3bdfSopenharmony_ci#./stress $ACLTESTFILE
44f08c3bdfSopenharmony_cifor i in 1 2 3 4 5
45f08c3bdfSopenharmony_ci    do
46f08c3bdfSopenharmony_ci        userdel user$i
47f08c3bdfSopenharmony_ci        groupdel grp$i
48f08c3bdfSopenharmony_ci    done
49f08c3bdfSopenharmony_ci
50f08c3bdfSopenharmony_ciecho "Basic tests finished"
51f08c3bdfSopenharmony_ci
52f08c3bdfSopenharmony_ciecho "LONG ACL TEST"
53f08c3bdfSopenharmony_ciecho "creating necessary users and groups"
54f08c3bdfSopenharmony_cipython3 create_users.py -u 50 -g 50
55f08c3bdfSopenharmony_ciecho "creating necessary users and groups on the remote host"
56f08c3bdfSopenharmony_cimkdir $NFSMNTDIR/lacl-testdir
57f08c3bdfSopenharmony_cipython3 test_long_acl.py -l $MAXLENGTH -p $NFSMNTDIR/lacl-testdir
58f08c3bdfSopenharmony_cirm -rf $NFSMNTDIR/lacl-testdir
59f08c3bdfSopenharmony_ciecho "Long ACL test OK with $MAXLENGTH entries"
60f08c3bdfSopenharmony_ciecho "ACL STRESSING TEST"
61f08c3bdfSopenharmony_cipython3 setacl_stress.py -n 100 -u $USER_NB -g $GRP_NB -f $FILE_NB -p $NFSMNTDIR
62f08c3bdfSopenharmony_ci
63f08c3bdfSopenharmony_ci# remove local an remote users
64f08c3bdfSopenharmony_cipython3 cleanusers.py
65f08c3bdfSopenharmony_cipython3 cleangroups.py
66f08c3bdfSopenharmony_cirsh -n $REMOTEHOST python3 $PWD/cleanusers.py
67f08c3bdfSopenharmony_ci
68f08c3bdfSopenharmony_ciecho "Test OK"
69f08c3bdfSopenharmony_ci
70f08c3bdfSopenharmony_ciexit 0
71