s4-selftest/drs: Confirm GetNCChanges full replication works with a DummyDN and real...
[Samba.git] / examples / ad-bench / time_user.sh
blob5fedb7ab30ea22371b9e3f34cd6efcfc912151e0
1 #!/bin/bash
2 # AD-Bench user add/remove benchmark
4 # Copyright (C) 2009 Kai Blin <kai@samba.org>
6 # This file is part of AD-Bench, an Active Directory benchmark tool
8 # AD-Bench is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # AD-Bench is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with AD-Bench. If not, see <http://www.gnu.org/licenses/>.
21 ITERATIONS=100
23 source $(dirname $0)/utils.sh
25 PRINCIPAL=$(get_principal $1)
26 PASSWORD=$(get_password $1)
27 REALM=$(get_realm $1)
28 NT_DOM=$(get_nt_dom $1)
29 SERVER=$2
31 add_user()
33 USER=$1
34 ${NET} ads user add "${USER}" 'Sup3rS3cr3T!' -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null
35 RET=$?
36 if [ $RET -ne 0 ]; then
37 echo "${NET} ads user add returned error: $RET"
38 exit 1
42 del_user()
44 USER=$1
45 ${NET} ads user delete "${USER}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null
46 RET=$?
47 if [ $RET -ne 0 ]; then
48 echo "${NET} returned error: $RET"
49 exit 1
53 enum_user()
55 ${NET} ads user -k --configfile=$CONFIG_FILE -S $SERVER >/dev/null
56 RET=$?
57 if [ $RET -ne 0 ]; then
58 echo "${NET} returned error: $RET"
59 exit 1
63 info_user()
65 USER=$1
66 ${NET} ads user info "${USER}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null
67 RET=$?
68 if [ $RET -ne 0 ]; then
69 echo "${NET} returned error: $RET"
70 exit 1
74 set_up()
76 set_krb_env
77 setup_kinit
78 call_kinit "${PRINCIPAL}" "${PASSWORD}"
79 write_configfile "${REALM}" "${NT_DOM}"
82 tear_down()
84 ${KDESTROY}
85 restore_krb_env
88 set_up
90 echo -e "\tUSER $SERVER"
92 START_TIME=$(start_timer)
94 echo -en "\t"
95 for i in $(${SEQ} 1 $ITERATIONS); do
96 USER=$(echo "ad_test_$(pad_number $i 3)")
97 add_user $USER
98 echo -n "."
99 done
100 echo "done"
102 enum_user
104 # Requires winbind, which requires root perms to start. Skip this for now
105 #echo -en "\t"
106 #for i in $( ${SEQ} 1 $ITERATIONS ); do
107 # USER=$( echo "ad_test_$(pad_number $i 3)" )
108 # info_user $USER
109 # echo -n "."
110 #done
111 #echo "done"
113 echo -en "\t"
114 for i in $(${SEQ} 1 $ITERATIONS); do
115 USER=$(echo "ad_test_$(pad_number $i 3)")
116 del_user $USER
117 echo -n "."
118 done
119 echo "done"
121 STOP_TIME=$(stop_timer)
123 TOTAL_TIME=$(total_time $START_TIME $STOP_TIME)
125 echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s"
127 LOGINS_PER_MINUTE=$(iterations_per_minute $START_TIME $STOP_TIME $ITERATIONS)
129 echo -e "\t\titerations/min:\t\t$LOGINS_PER_MINUTE"
131 tear_down