summaryrefslogtreecommitdiffstats
path: root/usr.sbin/chown/tests
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2014-06-30 05:33:52 +0000
committereadler <eadler@FreeBSD.org>2014-06-30 05:33:52 +0000
commit253aaa13c29f9c3cba61d6cafd082813dad0cfec (patch)
tree1f574d1c5c4c4f53f9d67b787f900ffc22d0546c /usr.sbin/chown/tests
parent6ffa0d594309453f08a9432c4bede71848667751 (diff)
downloadFreeBSD-src-253aaa13c29f9c3cba61d6cafd082813dad0cfec.zip
FreeBSD-src-253aaa13c29f9c3cba61d6cafd082813dad0cfec.tar.gz
chown: add a test
Add a test for the chown utility. This sets up chown(8) to be capable of being tested. As such, only add one test for now as an example.
Diffstat (limited to 'usr.sbin/chown/tests')
-rw-r--r--usr.sbin/chown/tests/Makefile9
-rwxr-xr-xusr.sbin/chown/tests/chown-f_test.sh21
2 files changed, 30 insertions, 0 deletions
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