From owner-svn-src-head@FreeBSD.ORG Sun Mar 16 02:27:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB942E38; Sun, 16 Mar 2014 02:27:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B7FF5B2; Sun, 16 Mar 2014 02:27:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2G2RSt3010332; Sun, 16 Mar 2014 02:27:28 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2G2RRbb010324; Sun, 16 Mar 2014 02:27:27 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201403160227.s2G2RRbb010324@svn.freebsd.org> From: Julio Merino Date: Sun, 16 Mar 2014 02:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263221 - head/tools/regression/usr.sbin/etcupdate X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Mar 2014 02:27:29 -0000 Author: jmmv Date: Sun Mar 16 02:27:27 2014 New Revision: 263221 URL: http://svnweb.freebsd.org/changeset/base/263221 Log: Change etcupdate tests to return 1 on test failures. This is a prerequisite for hooking these tests into the test suite. And, fortunately, all tests seem to pass! Modified: head/tools/regression/usr.sbin/etcupdate/always.sh head/tools/regression/usr.sbin/etcupdate/conflicts.sh head/tools/regression/usr.sbin/etcupdate/fbsdid.sh head/tools/regression/usr.sbin/etcupdate/ignore.sh head/tools/regression/usr.sbin/etcupdate/preworld.sh head/tools/regression/usr.sbin/etcupdate/tests.sh head/tools/regression/usr.sbin/etcupdate/tzsetup.sh Modified: head/tools/regression/usr.sbin/etcupdate/always.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/always.sh Sun Mar 16 02:07:08 2014 (r263220) +++ head/tools/regression/usr.sbin/etcupdate/always.sh Sun Mar 16 02:27:27 2014 (r263221) @@ -29,6 +29,7 @@ # Various regression tests to test the -A flag to the 'update' command. +FAILED=no WORKDIR=work usage() @@ -275,6 +276,7 @@ missing() { if [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be missing" + FAILED=yes fi } @@ -283,6 +285,7 @@ present() { if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be present" + FAILED=yes fi } @@ -291,6 +294,7 @@ fifo() { if ! [ -p $TEST/$1 ]; then echo "File $1 should be a FIFO" + FAILED=yes fi } @@ -299,6 +303,7 @@ dir() { if ! [ -d $TEST/$1 ]; then echo "File $1 should be a directory" + FAILED=yes fi } @@ -310,10 +315,12 @@ link() if ! [ -L $TEST/$1 ]; then echo "File $1 should be a link" + FAILED=yes elif [ $# -gt 1 ]; then val=`readlink $TEST/$1` if [ "$val" != "$2" ]; then echo "Link $1 should link to \"$2\"" + FAILED=yes fi fi } @@ -327,15 +334,18 @@ file() if ! [ -f $TEST/$1 ]; then echo "File $1 should be a regular file" + FAILED=yes elif [ $# -eq 2 ]; then contents=`cat $TEST/$1` if [ "$contents" != "$2" ]; then echo "File $1 has wrong contents" + FAILED=yes fi elif [ $# -eq 3 ]; then sum=`md5 -q $TEST/$1` if [ "$sum" != "$3" ]; then echo "File $1 has wrong contents" + FAILED=yes fi fi } @@ -348,10 +358,12 @@ conflict() if ! [ -f $CONFLICTS/$1 ]; then echo "File $1 missing conflict" + FAILED=yes elif [ $# -gt 1 ]; then sum=`md5 -q $CONFLICTS/$1` if [ "$sum" != "$2" ]; then echo "Conflict $1 has wrong contents" + FAILED=yes fi fi } @@ -361,11 +373,13 @@ noconflict() { if [ -f $CONFLICTS/$1 ]; then echo "File $1 should not have a conflict" + FAILED=yes fi } if [ `id -u` -ne 0 ]; then echo "must be root" + exit 0 fi if [ -r /etc/etcupdate.conf ]; then @@ -413,7 +427,8 @@ Warnings: EOF echo "Differences for regular:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes ## /first/difftype/second: present /first/difftype/second/fifo @@ -533,7 +548,8 @@ Warnings: EOF echo "Differences for -A '/first*' -A '/second* /*di*':" -diff -u -L "correct" $WORKDIR/correct1.out -L "test" $WORKDIR/test1.out +diff -u -L "correct" $WORKDIR/correct1.out -L "test" $WORKDIR/test1.out \ + || FAILED=yes ## /first/difftype/second: present /first/difftype/second/fifo @@ -610,3 +626,5 @@ file /dirchange/todir/difffile/file "baz ## /dirchange/todir/difftype: file /dirchange/todir/difftype/file "baz" + +[ "${FAILED}" = no ] Modified: head/tools/regression/usr.sbin/etcupdate/conflicts.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/conflicts.sh Sun Mar 16 02:07:08 2014 (r263220) +++ head/tools/regression/usr.sbin/etcupdate/conflicts.sh Sun Mar 16 02:27:27 2014 (r263221) @@ -29,6 +29,7 @@ # Various regression tests to run for the 'resolve' command. +FAILED=no WORKDIR=work usage() @@ -134,6 +135,7 @@ missing() { if [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be missing" + FAILED=yes fi } @@ -142,6 +144,7 @@ present() { if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be present" + FAILED=yes fi } @@ -154,15 +157,18 @@ file() if ! [ -f $TEST/$1 ]; then echo "File $1 should be a regular file" + FAILED=yes elif [ $# -eq 2 ]; then contents=`cat $TEST/$1` if [ "$contents" != "$2" ]; then echo "File $1 has wrong contents" + FAILED=yes fi elif [ $# -eq 3 ]; then sum=`md5 -q $TEST/$1` if [ "$sum" != "$3" ]; then echo "File $1 has wrong contents" + FAILED=yes fi fi } @@ -175,10 +181,12 @@ conflict() if ! [ -f $CONFLICTS/$1 ]; then echo "File $1 missing conflict" + FAILED=yes elif [ $# -gt 1 ]; then sum=`md5 -q $CONFLICTS/$1` if [ "$sum" != "$2" ]; then echo "Conflict $1 has wrong contents" + FAILED=yes fi fi } @@ -188,11 +196,13 @@ resolved() { if [ -f $CONFLICTS/$1 ]; then echo "Conflict $1 should be resolved" + FAILED=yes fi } if [ `id -u` -ne 0 ]; then echo "must be root" + exit 0 fi if [ -r /etc/etcupdate.conf ]; then @@ -255,11 +265,13 @@ echo "Checking newalias warning for 'p'" echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -eq 0 ]; then echo "+ Extra warning" + FAILED=yes fi echo "Checking newalias warning for 'mf'": echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -eq 0 ]; then echo "+ Extra warning" + FAILED=yes fi # Verify that 'tf' and 'r' do generate the newaliases warning. @@ -268,6 +280,7 @@ echo "Checking newalias warning for 'tf' echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -ne 0 ]; then echo "- Missing warning" + FAILED=yes fi build_aliases_conflict @@ -275,4 +288,7 @@ cp $TEST/etc/mail/aliases $CONFLICTS/etc echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -ne 0 ]; then echo "- Missing warning" + FAILED=yes fi + +[ "${FAILED}" = no ] Modified: head/tools/regression/usr.sbin/etcupdate/fbsdid.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/fbsdid.sh Sun Mar 16 02:07:08 2014 (r263220) +++ head/tools/regression/usr.sbin/etcupdate/fbsdid.sh Sun Mar 16 02:27:27 2014 (r263221) @@ -29,6 +29,7 @@ # Various regression tests to test the -F flag to the 'update' command. +FAILED=no WORKDIR=work usage() @@ -213,6 +214,7 @@ missing() { if [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be missing" + FAILED=yes fi } @@ -221,6 +223,7 @@ present() { if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be present" + FAILED=yes fi } @@ -233,15 +236,18 @@ file() if ! [ -f $TEST/$1 ]; then echo "File $1 should be a regular file" + FAILED=yes elif [ $# -eq 2 ]; then contents=`cat $TEST/$1` if [ "$contents" != "$2" ]; then echo "File $1 has wrong contents" + FAILED=yes fi elif [ $# -eq 3 ]; then sum=`md5 -q $TEST/$1` if [ "$sum" != "$3" ]; then echo "File $1 has wrong contents" + FAILED=yes fi fi } @@ -254,10 +260,12 @@ conflict() if ! [ -f $CONFLICTS/$1 ]; then echo "File $1 missing conflict" + FAILED=yes elif [ $# -gt 1 ]; then sum=`md5 -q $CONFLICTS/$1` if [ "$sum" != "$2" ]; then echo "Conflict $1 has wrong contents" + FAILED=yes fi fi } @@ -267,11 +275,13 @@ noconflict() { if [ -f $CONFLICTS/$1 ]; then echo "File $1 should not have a conflict" + FAILED=yes fi } if [ `id -u` -ne 0 ]; then echo "must be root" + exit 0 fi if [ -r /etc/etcupdate.conf ]; then @@ -297,7 +307,8 @@ Warnings: EOF echo "Differences for regular:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes file /remove "" 1bb4776213af107077be78fead8a351c file /old "" 2f799a7addc4132563ef9b44adc66157 @@ -329,7 +340,8 @@ cat > $WORKDIR/correctF.out < $WORKDIR/correctAF.out < $WORKDIR/correct.out < $WORKDIR/correct1.out < $WORKDIR/correct.out < $WORKDIR/test.out echo "Differences for real:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes check_trees + +[ "${FAILED}" = no ] Modified: head/tools/regression/usr.sbin/etcupdate/tests.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/tests.sh Sun Mar 16 02:07:08 2014 (r263220) +++ head/tools/regression/usr.sbin/etcupdate/tests.sh Sun Mar 16 02:27:27 2014 (r263221) @@ -29,6 +29,7 @@ # Various regression tests to run for the 'update' command. +FAILED=no WORKDIR=work usage() @@ -653,6 +654,7 @@ missing() { if [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be missing" + FAILED=yes fi } @@ -661,6 +663,7 @@ present() { if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be present" + FAILED=yes fi } @@ -669,6 +672,7 @@ fifo() { if ! [ -p $TEST/$1 ]; then echo "File $1 should be a FIFO" + FAILED=yes fi } @@ -677,6 +681,7 @@ dir() { if ! [ -d $TEST/$1 ]; then echo "File $1 should be a directory" + FAILED=yes fi } @@ -688,10 +693,12 @@ link() if ! [ -L $TEST/$1 ]; then echo "File $1 should be a link" + FAILED=yes elif [ $# -gt 1 ]; then val=`readlink $TEST/$1` if [ "$val" != "$2" ]; then echo "Link $1 should link to \"$2\"" + FAILED=yes fi fi } @@ -705,15 +712,18 @@ file() if ! [ -f $TEST/$1 ]; then echo "File $1 should be a regular file" + FAILED=yes elif [ $# -eq 2 ]; then contents=`cat $TEST/$1` if [ "$contents" != "$2" ]; then echo "File $1 has wrong contents" + FAILED=yes fi elif [ $# -eq 3 ]; then sum=`md5 -q $TEST/$1` if [ "$sum" != "$3" ]; then echo "File $1 has wrong contents" + FAILED=yes fi fi } @@ -726,10 +736,12 @@ conflict() if ! [ -f $CONFLICTS/$1 ]; then echo "File $1 missing conflict" + FAILED=yes elif [ $# -gt 1 ]; then sum=`md5 -q $CONFLICTS/$1` if [ "$sum" != "$2" ]; then echo "Conflict $1 has wrong contents" + FAILED=yes fi fi } @@ -920,6 +932,7 @@ check_trees() if [ `id -u` -ne 0 ]; then echo "must be root" + exit 0 fi if [ -r /etc/etcupdate.conf ]; then @@ -994,11 +1007,15 @@ Warnings: EOF echo "Differences for -n:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out \ + || failed=YES $COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out echo "Differences for real:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || failed=YES check_trees + +[ "${FAILED}" = no ] Modified: head/tools/regression/usr.sbin/etcupdate/tzsetup.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/tzsetup.sh Sun Mar 16 02:07:08 2014 (r263220) +++ head/tools/regression/usr.sbin/etcupdate/tzsetup.sh Sun Mar 16 02:27:27 2014 (r263221) @@ -29,6 +29,7 @@ # Various regression tests for the tzsetup handling in the 'update' command. +FAILED=no WORKDIR=work usage() @@ -85,6 +86,7 @@ missing() { if [ -e $TEST/$1 -o -L $TEST/$1 ]; then echo "File $1 should be missing" + FAILED=yes fi } @@ -96,10 +98,12 @@ link() if ! [ -L $TEST/$1 ]; then echo "File $1 should be a link" + FAILED=yes elif [ $# -gt 1 ]; then val=`readlink $TEST/$1` if [ "$val" != "$2" ]; then echo "Link $1 should link to \"$2\"" + FAILED=yes fi fi } @@ -113,21 +117,25 @@ file() if ! [ -f $TEST/$1 ]; then echo "File $1 should be a regular file" + FAILED=yes elif [ $# -eq 2 ]; then contents=`cat $TEST/$1` if [ "$contents" != "$2" ]; then echo "File $1 has wrong contents" + FAILED=yes fi elif [ $# -eq 3 ]; then sum=`md5 -q $TEST/$1` if [ "$sum" != "$3" ]; then echo "File $1 has wrong contents" + FAILED=yes fi fi } if [ `id -u` -ne 0 ]; then echo "must be root" + exit 0 fi if [ -r /etc/etcupdate.conf ]; then @@ -144,12 +152,14 @@ cat > $WORKDIR/correct.out < $WORKDIR/test.out echo "Differences for no /etc/localtime:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes missing /etc/localtime missing /var/db/zoneinfo @@ -165,12 +175,14 @@ cat > $WORKDIR/correct.out < $WORKDIR/test.out echo "Differences for symlinked /etc/localtime:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes link /etc/localtime "/dev/null" missing /var/db/zoneinfo @@ -188,12 +200,14 @@ Warnings: EOF echo "Differences for missing /var/db/zoneinfo with -n:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out \ + || FAILED=yes $COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out echo "Differences for missing /var/db/zoneinfo:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes file /etc/localtime "bar" missing /var/db/zoneinfo @@ -210,12 +224,16 @@ cat > $WORKDIR/correct.out < $WORKDIR/test.out echo "Differences for real update:" -diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out \ + || FAILED=yes file /etc/localtime "foo" file /var/db/zoneinfo "foo" + +[ "${FAILED}" = no ]