svn commit: r268030 - in head: etc/mtree usr.sbin/chown usr.sbin/chown/tests

Eitan Adler eadler at FreeBSD.org
Mon Jun 30 05:33:53 UTC 2014


Author: eadler
Date: Mon Jun 30 05:33:52 2014
New Revision: 268030
URL: http://svnweb.freebsd.org/changeset/base/268030

Log:
  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.

Added:
  head/usr.sbin/chown/tests/
  head/usr.sbin/chown/tests/Makefile   (contents, props changed)
  head/usr.sbin/chown/tests/chown-f_test.sh   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.sbin/chown/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==============================================================================
--- head/etc/mtree/BSD.tests.dist	Mon Jun 30 04:38:29 2014	(r268029)
+++ head/etc/mtree/BSD.tests.dist	Mon Jun 30 05:33:52 2014	(r268030)
@@ -21,6 +21,8 @@
     ..
     tests
         bin
+            chown
+            ..
             date
             ..
             mv

Modified: head/usr.sbin/chown/Makefile
==============================================================================
--- head/usr.sbin/chown/Makefile	Mon Jun 30 04:38:29 2014	(r268029)
+++ head/usr.sbin/chown/Makefile	Mon Jun 30 05:33:52 2014	(r268030)
@@ -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>

Added: head/usr.sbin/chown/tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/chown/tests/Makefile	Mon Jun 30 05:33:52 2014	(r268030)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/bin/chown
+
+TAP_TESTS_SH=			chown-f_test
+
+.include <bsd.test.mk>

Added: head/usr.sbin/chown/tests/chown-f_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/chown/tests/chown-f_test.sh	Mon Jun 30 05:33:52 2014	(r268030)
@@ -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


More information about the svn-src-head mailing list