summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-11-12 22:27:53 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-11-12 22:27:53 +0000
commitbcd9ef6b1872f72a7932f3a2554348ec81e7e42d (patch)
treec9fb97c7dc6e9f7ab2ae2901274bca2100194ecf /pw/tests
parentcf28a17818058981489f2d7b9146b87ffd2b5049 (diff)
downloadpw-darwin-bcd9ef6b1872f72a7932f3a2554348ec81e7e42d.tar.gz
pw-darwin-bcd9ef6b1872f72a7932f3a2554348ec81e7e42d.tar.zst
pw-darwin-bcd9ef6b1872f72a7932f3a2554348ec81e7e42d.zip
Fix wrong message when using pw -V with a non existent directory
Add a regression test about it PR: 194971 Submitted by: Freddy DISSAUX <bugzilla@dsx.bsdsx.fr>
Diffstat (limited to 'pw/tests')
-rw-r--r--pw/tests/Makefile2
-rwxr-xr-xpw/tests/pw_etcdir.sh18
2 files changed, 19 insertions, 1 deletions
diff --git a/pw/tests/Makefile b/pw/tests/Makefile
index fabf624..0391d1f 100644
--- a/pw/tests/Makefile
+++ b/pw/tests/Makefile
@@ -5,7 +5,7 @@ TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.sbin/useradd
TESTSDIR= ${TESTSBASE}/usr.sbin/pw
-ATF_TESTS_SH= pw_delete pw_modify
+ATF_TESTS_SH= pw_delete pw_modify pw_etcdir
TEST_METADATA.pw_delete+= required_user="root"
TEST_METADATA.pw_modify+= required_user="root"
diff --git a/pw/tests/pw_etcdir.sh b/pw/tests/pw_etcdir.sh
new file mode 100755
index 0000000..edb97fe
--- /dev/null
+++ b/pw/tests/pw_etcdir.sh
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+# When provide -V dir, dir must exists
+atf_test_case etcdir_must_exists
+etcdir_must_exists_head() {
+ atf_set "descr" "When provide -V dir, dir must exists"
+}
+
+etcdir_must_exists_body() {
+ local fakedir="/this_directory_does_not_exists"
+ atf_check -e inline:"pw: no such directory \`$fakedir'\n" \
+ -s exit:72 -x pw -V ${fakedir} usershow root
+}
+
+atf_init_test_cases() {
+ atf_add_test_case etcdir_must_exists
+}
+