diff options
author | brd <brd@FreeBSD.org> | 2014-12-09 21:43:03 +0000 |
---|---|---|
committer | brd <brd@FreeBSD.org> | 2014-12-09 21:43:03 +0000 |
commit | 37438c711e987be47bbbbc259c9c3c56f8e9dcd3 (patch) | |
tree | 31bb1489f4c84e14ebd7a07f256a110c19de0c2c /usr.sbin | |
parent | eced0880b980b894032bcf0547bb97c7ea50f3fa (diff) | |
download | FreeBSD-src-37438c711e987be47bbbbc259c9c3c56f8e9dcd3.zip FreeBSD-src-37438c711e987be47bbbbc259c9c3c56f8e9dcd3.tar.gz |
Break out the tests into a file per command and clean up some long lines
Approved by: will
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pw/tests/Makefile | 8 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_groupdel.sh | 24 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_groupmod.sh (renamed from usr.sbin/pw/tests/pw_modify.sh) | 0 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_useradd.sh (renamed from usr.sbin/pw/tests/pw_add.sh) | 0 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_userdel.sh (renamed from usr.sbin/pw/tests/pw_delete.sh) | 20 |
5 files changed, 33 insertions, 19 deletions
diff --git a/usr.sbin/pw/tests/Makefile b/usr.sbin/pw/tests/Makefile index aa774ef..c490059 100644 --- a/usr.sbin/pw/tests/Makefile +++ b/usr.sbin/pw/tests/Makefile @@ -5,11 +5,11 @@ TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.sbin/useradd TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_add pw_delete pw_etcdir pw_lock pw_modify +ATF_TESTS_SH= pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel -TEST_METADATA.pw_add+= required_user="root" -TEST_METADATA.pw_delete+= required_user="root" -TEST_METADATA.pw_modify+= required_user="root" +TEST_METADATA.pw_groupmod+= required_user="root" +TEST_METADATA.pw_useradd+= required_user="root" +TEST_METADATA.pw_userdel+= required_user="root" FILES= group helper_functions.shin master.passwd FILESDIR= ${TESTSDIR} diff --git a/usr.sbin/pw/tests/pw_groupdel.sh b/usr.sbin/pw/tests/pw_groupdel.sh new file mode 100755 index 0000000..75b063a --- /dev/null +++ b/usr.sbin/pw/tests/pw_groupdel.sh @@ -0,0 +1,24 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + + +# Test to make sure we do not accidentially delete wheel when trying to delete +# an unknown group +atf_test_case group_do_not_delete_wheel_if_group_unknown +group_do_not_delete_wheel_if_group_unknown_head() { + atf_set "descr" "Make sure we do not consider gid 0 an unknown group" +} +group_do_not_delete_wheel_if_group_unknown_body() { + populate_etc_skel + atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel + atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x \ + ${PW} groupdel -g I_do_not_exist + atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel +} + + +atf_init_test_cases() { + atf_add_test_case group_do_not_delete_wheel_if_group_unknown +} diff --git a/usr.sbin/pw/tests/pw_modify.sh b/usr.sbin/pw/tests/pw_groupmod.sh index ad7ad0a..ad7ad0a 100755 --- a/usr.sbin/pw/tests/pw_modify.sh +++ b/usr.sbin/pw/tests/pw_groupmod.sh diff --git a/usr.sbin/pw/tests/pw_add.sh b/usr.sbin/pw/tests/pw_useradd.sh index fb2e33f..fb2e33f 100755 --- a/usr.sbin/pw/tests/pw_add.sh +++ b/usr.sbin/pw/tests/pw_useradd.sh diff --git a/usr.sbin/pw/tests/pw_delete.sh b/usr.sbin/pw/tests/pw_userdel.sh index 832ec93..71a7033 100755 --- a/usr.sbin/pw/tests/pw_delete.sh +++ b/usr.sbin/pw/tests/pw_userdel.sh @@ -3,6 +3,7 @@ # Import helper functions . $(atf_get_srcdir)/helper_functions.shin + # Test that a user can be deleted when another user is part of this # user's default group and does not go into an infinate loop. # PR: 191427 @@ -18,30 +19,19 @@ rmuser_seperate_group_body() { ${PW} userdel test || atf_fail "Delete the test user" } -atf_test_case group_do_not_delete_wheel_if_group_unknown -group_do_not_delete_wheel_if_group_unknown_head() { - atf_set "descr" "Make sure we do not consider gid 0 an unknown group" -} - -group_do_not_delete_wheel_if_group_unknown_body() { - populate_etc_skel - atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel - atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x ${PW} groupdel -g I_do_not_exist - atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel -} atf_test_case user_do_not_try_to_delete_root_if_user_unknown user_do_not_try_to_delete_root_if_user_unknown_head() { - atf_set "descr" "Make sure not to try to remove root if deleting an unknown user" + atf_set "descr" \ + "Make sure not to try to remove root if deleting an unknown user" } - user_do_not_try_to_delete_root_if_user_unknown_body() { populate_etc_skel - atf_check -e inline:"pw: -u expects a number\n" -s exit:64 -x ${PW} userdel -u plop + atf_check -e inline:"pw: -u expects a number\n" -s exit:64 -x \ + ${PW} userdel -u plop } atf_init_test_cases() { atf_add_test_case rmuser_seperate_group - atf_add_test_case group_do_not_delete_wheel_if_group_unknown atf_add_test_case user_do_not_try_to_delete_root_if_user_unknown } |