summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/mtree/BSD.tests.dist2
-rw-r--r--usr.sbin/chown/Makefile6
-rw-r--r--usr.sbin/chown/tests/Makefile9
-rwxr-xr-xusr.sbin/chown/tests/chown-f_test.sh21
4 files changed, 38 insertions, 0 deletions
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index f325fe3..5c54598 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -21,6 +21,8 @@
..
tests
bin
+ chown
+ ..
date
..
mv
diff --git a/usr.sbin/chown/Makefile b/usr.sbin/chown/Makefile
index 97972e5..7bcb677 100644
--- a/usr.sbin/chown/Makefile
+++ b/usr.sbin/chown/Makefile
@@ -1,8 +1,14 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
+.include <src.opts.mk>
+
PROG= chown
LINKS= ${BINDIR}/chown /usr/bin/chgrp
MAN= chgrp.1 chown.8
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/chown/tests/Makefile b/usr.sbin/chown/tests/Makefile
new file mode 100644
index 0000000..fb13f3f
--- /dev/null
+++ b/usr.sbin/chown/tests/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/bin/chown
+
+TAP_TESTS_SH= chown-f_test
+
+.include <bsd.test.mk>
diff --git a/usr.sbin/chown/tests/chown-f_test.sh b/usr.sbin/chown/tests/chown-f_test.sh
new file mode 100755
index 0000000..e9ef2bc
--- /dev/null
+++ b/usr.sbin/chown/tests/chown-f_test.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# $FreeBSD$
+
+base=`basename $0`
+
+echo "1..1"
+
+name="chown -f root:wheel file"
+if [ `id -u` -eq 0 ]; then
+ echo "ok 3 - $name # skip Test must not be uid 0."
+else
+ touch file
+ output=$(chown -f root:wheel file 2>&1)
+ if [ $? -eq 0 -a -z "$output" ]
+ then
+ echo "ok 1 - $name"
+ else
+ echo "not ok 1 - $name"
+ fi
+ rm file
+fi
OpenPOWER on IntegriCloud