diff options
author | phk <phk@FreeBSD.org> | 2003-11-05 22:26:39 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-11-05 22:26:39 +0000 |
commit | 7b725c873ee43cac7734753c602e2ba8fb308f1e (patch) | |
tree | 4b14296fcbb74a3d786cb6a99e024e1571e3cb54 /usr.sbin/mtree | |
parent | 7a3cd410f3a16da94524b5c7e8e18c0f38f820dd (diff) | |
download | FreeBSD-src-7b725c873ee43cac7734753c602e2ba8fb308f1e.zip FreeBSD-src-7b725c873ee43cac7734753c602e2ba8fb308f1e.tar.gz |
Add a small testcase for the new -f-f mode.
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r-- | usr.sbin/mtree/test/test03.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/usr.sbin/mtree/test/test03.sh b/usr.sbin/mtree/test/test03.sh new file mode 100644 index 0000000..e320c4f --- /dev/null +++ b/usr.sbin/mtree/test/test03.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright (c) 2003 Poul-Henning Kamp +# All rights reserved. +# +# Please see src/share/examples/etc/bsd-style-copyright. +# +# $FreeBSD$ +# + +set -e + +TMP=/tmp/mtree.$$ + +rm -rf ${TMP} +mkdir -p ${TMP} + +K=uid,uname,gid,gname,flags,md5digest,size,ripemd160digest,sha1digest,cksum + +rm -rf _FOO +mkdir _FOO +touch _FOO/_uid +touch _FOO/_size +touch _FOO/zztype + +touch _FOO/_bar +mtree -c -K $K -p .. > ${TMP}/_r +mtree -c -K $K -p .. > ${TMP}/_r2 +rm -rf _FOO/_bar + +rm -rf _FOO/zztype +mkdir _FOO/zztype + +date > _FOO/_size + +chown nobody _FOO/_uid + +touch _FOO/_foo +mtree -c -K $K -p .. > ${TMP}/_t + +rm -fr _FOO + +if mtree -f ${TMP}/_r -f ${TMP}/_r2 ; then + true +else + echo "ERROR Compare identical failed" 1>&2 + exit 1 +fi + +if mtree -f ${TMP}/_r -f ${TMP}/_t > ${TMP}/_ ; then + echo "ERROR Compare different succeeded" 1>&2 + exit 1 +fi + +if [ `wc -l < ${TMP}/_` -ne 10 ] ; then + echo "ERROR wrong number of lines: `wc -l ${TMP}/_`" 1>&2 + exit 1 +fi + +exit 0 |