mirror of
https://github.com/opnsense/src.git
synced 2026-04-27 00:58:36 -04:00
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:
parent
7063e348ab
commit
4bfdbb0b56
4 changed files with 38 additions and 0 deletions
|
|
@ -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>
|
||||
|
|
|
|||
9
usr.sbin/chown/tests/Makefile
Normal file
9
usr.sbin/chown/tests/Makefile
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/bin/chown
|
||||
|
||||
TAP_TESTS_SH= chown-f_test
|
||||
|
||||
.include <bsd.test.mk>
|
||||
21
usr.sbin/chown/tests/chown-f_test.sh
Executable file
21
usr.sbin/chown/tests/chown-f_test.sh
Executable file
|
|
@ -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
|
||||
Loading…
Reference in a new issue