summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2017-01-22 20:03:18 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2017-01-22 20:03:18 +0000
commite18f3da5e35c62cbf864d1717e6ae25bb6014dba (patch)
treee5e7fc139b4d4232f3befcd932c4026a9324f619 /pw/tests
parentf856c3ca12b9891190c15f332513b70a0a2044b5 (diff)
downloadpw-darwin-e18f3da5e35c62cbf864d1717e6ae25bb6014dba.tar.gz
pw-darwin-e18f3da5e35c62cbf864d1717e6ae25bb6014dba.tar.zst
pw-darwin-e18f3da5e35c62cbf864d1717e6ae25bb6014dba.zip
Really restore the old behaviour for pw usermod -m
It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days
Diffstat (limited to 'pw/tests')
-rwxr-xr-xpw/tests/pw_usermod.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/pw/tests/pw_usermod.sh b/pw/tests/pw_usermod.sh
index df056e0..6a13130 100755
--- a/pw/tests/pw_usermod.sh
+++ b/pw/tests/pw_usermod.sh
@@ -253,6 +253,26 @@ user_mod_w_yes_body() {
$(atf_get_srcdir)/crypt $passhash "foo"
}
+atf_test_case user_mod_m
+user_mod_m_body() {
+ populate_root_etc_skel
+
+ mkdir -p ${HOME}/home
+ mkdir -p ${HOME}/skel
+ echo "entry" > ${HOME}/skel/.file
+ atf_check -s exit:0 ${RPW} useradd foo
+ ! test -d ${HOME}/home/foo || atf_fail "Directory should not have been created"
+ atf_check -s exit:0 ${RPW} usermod foo -m -k /skel
+ test -d ${HOME}/home/foo || atf_fail "Directory should have been created"
+ test -f ${HOME}/home/foo/.file || atf_fail "Skell files not added"
+ echo "entry" > ${HOME}/skel/.file2
+ atf_check -s exit:0 ${RPW} usermod foo -m -k /skel
+ test -f ${HOME}/home/foo/.file2 || atf_fail "Skell files not added"
+ echo > ${HOME}/home/foo/.file2
+ atf_check -s exit:0 ${RPW} usermod foo -m -k /skel
+ atf_check -s exit:0 -o inline:"\n" cat ${HOME}/home/foo/.file2
+}
+
atf_init_test_cases() {
atf_add_test_case user_mod
@@ -275,4 +295,5 @@ atf_init_test_cases() {
atf_add_test_case user_mod_w_none
atf_add_test_case user_mod_w_random
atf_add_test_case user_mod_w_yes
+ atf_add_test_case user_mod_m
}