- Add a test for bug 191427 where pw(8) will go into an infinite loop
Reviewed by: will MFC after: 1 month
This commit is contained in:
parent
313a0c13ef
commit
a85f6c3043
@ -287,6 +287,8 @@
|
||||
..
|
||||
newsyslog
|
||||
..
|
||||
pw
|
||||
..
|
||||
sa
|
||||
..
|
||||
..
|
||||
|
@ -11,4 +11,10 @@ WARNS?= 2
|
||||
DPADD= ${LIBCRYPT} ${LIBUTIL}
|
||||
LDADD= -lcrypt -lutil
|
||||
|
||||
.include <src.opts.mk>
|
||||
|
||||
.if ${MK_TESTS} != "no"
|
||||
SUBDIR+= tests
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
10
usr.sbin/pw/tests/Makefile
Normal file
10
usr.sbin/pw/tests/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
# $FreeBSD$
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.sbin/pw
|
||||
|
||||
ATF_TESTS_SH= pw_delete
|
||||
|
||||
FILES= group helper_functions.shin master.passwd
|
||||
FILESDIR= ${TESTSDIR}
|
||||
|
||||
.include <bsd.test.mk>
|
3
usr.sbin/pw/tests/group
Normal file
3
usr.sbin/pw/tests/group
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
wheel:*:0:root
|
15
usr.sbin/pw/tests/helper_functions.shin
Executable file
15
usr.sbin/pw/tests/helper_functions.shin
Executable file
@ -0,0 +1,15 @@
|
||||
# $FreeBSD$
|
||||
|
||||
# Workdir to run tests in
|
||||
TESTDIR=$(atf_get_srcdir)
|
||||
|
||||
# Populate the files pw needs to use into $HOME/etc
|
||||
populate_etc_skel() {
|
||||
cp ${TESTDIR}/master.passwd ${HOME} || \
|
||||
atf_fail "Populating master.passwd in ${HOME}"
|
||||
cp ${TESTDIR}/group ${HOME} || atf_fail "Populating group in ${HOME}"
|
||||
|
||||
# Generate the passwd file
|
||||
pwd_mkdb -p -d ${HOME} ${HOME}/master.passwd || \
|
||||
atf_fail "generate passwd from master.passwd"
|
||||
}
|
4
usr.sbin/pw/tests/master.passwd
Normal file
4
usr.sbin/pw/tests/master.passwd
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
root:*:0:0::0:0:Charlie &:/root:/bin/csh
|
||||
toor:*:0:0::0:0:Bourne-again Superuser:/root:
|
24
usr.sbin/pw/tests/pw_delete.sh
Executable file
24
usr.sbin/pw/tests/pw_delete.sh
Executable file
@ -0,0 +1,24 @@
|
||||
# $FreeBSD$
|
||||
|
||||
# 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
|
||||
atf_test_case rmuser_seperate_group cleanup
|
||||
rmuser_seperate_group_head() {
|
||||
atf_set "timeout" "30"
|
||||
}
|
||||
rmuser_seperate_group_body() {
|
||||
populate_etc_skel
|
||||
pw -V ${HOME} useradd test || atf_fail "Creating test user"
|
||||
pw -V ${HOME} groupmod test -M 'test,root' || \
|
||||
atf_fail "Modifying the group"
|
||||
pw -V ${HOME} userdel test || atf_fail "delete the user"
|
||||
}
|
||||
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case rmuser_seperate_group
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user