Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153570992
D40611.id126014.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D40611.id126014.diff
View Options
diff --git a/bin/pwd/Makefile b/bin/pwd/Makefile
--- a/bin/pwd/Makefile
+++ b/bin/pwd/Makefile
@@ -1,7 +1,12 @@
# @(#)Makefile 8.1 (Berkeley) 5/31/93
# $FreeBSD$
+.include <src.opts.mk>
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
PACKAGE=runtime
PROG= pwd
.include <bsd.prog.mk>
+
diff --git a/bin/pwd/tests/Makefile b/bin/pwd/tests/Makefile
new file mode 100644
--- /dev/null
+++ b/bin/pwd/tests/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= pwd_test
+BINDIR= ${TESTSDIR}
+
+.include <bsd.test.mk>
diff --git a/bin/pwd/tests/pwd_test.sh b/bin/pwd/tests/pwd_test.sh
new file mode 100644
--- /dev/null
+++ b/bin/pwd/tests/pwd_test.sh
@@ -0,0 +1,51 @@
+atf_test_case basic
+basic_head()
+{
+ atf_set "descr" "Test on common directory"
+}
+basic_body()
+{
+ mkdir directory
+ cd directory || exit
+ atf_check -o match:"^.*\/directory$" pwd
+ atf_check -o match:"^.*\/directory$" pwd -L
+ atf_check -o match:"^.*\/directory$" pwd -P
+}
+
+atf_test_case soft_link
+soft_link_head()
+{
+ atf_set "descr" "Test on the softlink directory"
+}
+soft_link_body()
+{
+ mkdir soft_link_src
+ ln -s soft_link_src soft_link_dst
+ cd soft_link_dst || exit
+ atf_check -o match:"^.*\/soft_link_src$" pwd
+ atf_check -o match:"^.*\/soft_link_dst$" pwd -L
+ atf_check -o match:"^.*\/soft_link_src$" pwd -P
+}
+
+atf_test_case broken_soft_link
+broken_soft_link_head()
+{
+ atf_set "descr" "Test on the broken softlink directory"
+}
+broken_soft_link_body()
+{
+ mkdir broken_soft_link_src
+ ln -s broken_soft_link_src broken_soft_link_dst
+ cd broken_soft_link_dst || exit
+ rm -r ../broken_soft_link_src
+ atf_check -s exit:1 -e inline:"pwd: .: No such file or directory\n" pwd
+ atf_check -s exit:1 -e inline:"pwd: .: No such file or directory\n" pwd -L
+ atf_check -s exit:1 -e inline:"pwd: .: No such file or directory\n" pwd -P
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case basic
+ atf_add_test_case soft_link
+ atf_add_test_case broken_soft_link
+}
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -39,6 +39,8 @@
rm
..
rmdir
+ ..
+ pwd
..
sh
builtins
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 23, 12:28 AM (12 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32004549
Default Alt Text
D40611.id126014.diff (2 KB)
Attached To
Mode
D40611: Add `pwd` test
Attached
Detach File
Event Timeline
Log In to Comment