diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2017-03-23 03:28:24 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2017-03-23 03:28:24 +0000 |
commit | a5efa210b291630d838878b8d5e7d2ab0bf8b384 (patch) | |
tree | 395dd27057c93ec6f91809efc770f39fd526bf9e /pw/tests/pw_usernext_test.sh | |
parent | e9b9941bd76fcfbac2d1898de8f05cd48d8468ed (diff) | |
download | pw-darwin-a5efa210b291630d838878b8d5e7d2ab0bf8b384.tar.gz pw-darwin-a5efa210b291630d838878b8d5e7d2ab0bf8b384.tar.zst pw-darwin-a5efa210b291630d838878b8d5e7d2ab0bf8b384.zip |
Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme
usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Diffstat (limited to 'pw/tests/pw_usernext_test.sh')
-rwxr-xr-x | pw/tests/pw_usernext_test.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pw/tests/pw_usernext_test.sh b/pw/tests/pw_usernext_test.sh new file mode 100755 index 0000000..89f938e --- /dev/null +++ b/pw/tests/pw_usernext_test.sh @@ -0,0 +1,45 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test usernext after adding a random number of new users. +atf_test_case usernext +usernext_body() { + populate_etc_skel + + 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${CURRENT} + CURRENT=`expr ${CURRENT} + 1` + done + atf_check -s exit:0 -o match:"${CURRENT}:${CURRENT}" \ + ${PW} usernext +} + +# Test usernext when multiple users are added to the same group so +# that group id doesn't increment at the same pace as new users. +atf_test_case usernext_assigned_group +usernext_assigned_group_body() { + populate_etc_skel + + 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${CURRENT} -g 0 + CURRENT=`expr ${CURRENT} + 1` + done + atf_check -s exit:0 -o match:"${CURRENT}:${CURRENTGID}" \ + ${PW} usernext +} + +atf_init_test_cases() { + atf_add_test_case usernext + atf_add_test_case usernext_assigned_group +} |