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.
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
..
|
||||
tests
|
||||
bin
|
||||
chown
|
||||
..
|
||||
date
|
||||
..
|
||||
mv
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/bin/chown
|
||||
|
||||
TAP_TESTS_SH= chown-f_test
|
||||
|
||||
.include <bsd.test.mk>
|
||||
Executable
+21
@@ -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
|
||||
Reference in New Issue
Block a user