summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorBrad Davis <brd@FreeBSD.org>2015-02-15 21:42:10 +0000
committerBrad Davis <brd@FreeBSD.org>2015-02-15 21:42:10 +0000
commit8234852f2ea14bde97b020f23a80f0288c8b460a (patch)
tree58f88536c358f51453e940831e58cfefd767706c /pw/tests
parent69df4a425d2289e18ce12aa7d617271c6228abb8 (diff)
downloadpw-darwin-8234852f2ea14bde97b020f23a80f0288c8b460a.tar.gz
pw-darwin-8234852f2ea14bde97b020f23a80f0288c8b460a.tar.zst
pw-darwin-8234852f2ea14bde97b020f23a80f0288c8b460a.zip
Really fix the pw_usernext tests.
PR: 197612 Approved by: will
Diffstat (limited to 'pw/tests')
-rwxr-xr-xpw/tests/pw_usernext.sh27
1 files changed, 15 insertions, 12 deletions
diff --git a/pw/tests/pw_usernext.sh b/pw/tests/pw_usernext.sh
index ac9cae5..89f938e 100755
--- a/pw/tests/pw_usernext.sh
+++ b/pw/tests/pw_usernext.sh
@@ -8,14 +8,15 @@ atf_test_case usernext
usernext_body() {
populate_etc_skel
- var0=1
- LIMIT=`jot -r 1 2 10`
- while [ "$var0" -lt "$LIMIT" ]
+ CURRENT=`${PW} usernext | sed -e 's/:.*//'`
+ RANDOM=`jot -r 1 1 150`
+ MAX=`expr ${CURRENT} + ${RANDOM}`
+ while [ "${CURRENT}" -lt "${MAX}" ]
do
- atf_check -s exit:0 ${PW} useradd test$var0
- var0=`expr $var0 + 1`
+ atf_check -s exit:0 ${PW} useradd test${CURRENT}
+ CURRENT=`expr ${CURRENT} + 1`
done
- atf_check -s exit:0 -o match:"100${LIMIT}:100${LIMIT}" \
+ atf_check -s exit:0 -o match:"${CURRENT}:${CURRENT}" \
${PW} usernext
}
@@ -25,14 +26,16 @@ atf_test_case usernext_assigned_group
usernext_assigned_group_body() {
populate_etc_skel
- var0=1
- LIMIT=`jot -r 1 2 10`
- while [ "$var0" -lt "$LIMIT" ]
+ CURRENT=`${PW} usernext | sed -e 's/:.*//'`
+ CURRENTGID=`${PW} groupnext`
+ RANDOM=`jot -r 1 1 150`
+ MAX=`expr ${CURRENT} + ${RANDOM}`
+ while [ "${CURRENT}" -lt "${MAX}" ]
do
- atf_check -s exit:0 ${PW} useradd -n test$var0 -g 0
- var0=`expr $var0 + 1`
+ atf_check -s exit:0 ${PW} useradd -n test${CURRENT} -g 0
+ CURRENT=`expr ${CURRENT} + 1`
done
- atf_check -s exit:0 -o match:"100${LIMIT}:1001" \
+ atf_check -s exit:0 -o match:"${CURRENT}:${CURRENTGID}" \
${PW} usernext
}