3 # Import helper functions
4 . $(atf_get_srcdir)/helper_functions.shin
6 # Test usernext after adding a random number of new users.
11 CURRENT=`${PW} usernext | sed -e 's/:.*//'`
12 RANDOM=`jot -r 1 1 150`
13 MAX=`expr ${CURRENT} + ${RANDOM}`
14 while [ "${CURRENT}" -lt "${MAX}" ]
16 atf_check -s exit:0 ${PW} useradd test${CURRENT}
17 CURRENT=`expr ${CURRENT} + 1`
19 atf_check -s exit:0 -o match:"${CURRENT}:${CURRENT}" \
23 # Test usernext when multiple users are added to the same group so
24 # that group id doesn't increment at the same pace as new users.
25 atf_test_case usernext_assigned_group
26 usernext_assigned_group_body() {
29 CURRENT=`${PW} usernext | sed -e 's/:.*//'`
30 CURRENTGID=`${PW} groupnext`
31 RANDOM=`jot -r 1 1 150`
32 MAX=`expr ${CURRENT} + ${RANDOM}`
33 while [ "${CURRENT}" -lt "${MAX}" ]
35 atf_check -s exit:0 ${PW} useradd -n test${CURRENT} -g 0
36 CURRENT=`expr ${CURRENT} + 1`
38 atf_check -s exit:0 -o match:"${CURRENT}:${CURRENTGID}" \
42 atf_init_test_cases() {
43 atf_add_test_case usernext
44 atf_add_test_case usernext_assigned_group