Date: Tue, 12 Nov 2013 19:15:07 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258063 - head/tools/regression/usr.sbin/etcupdate Message-ID: <201311121915.rACJF7DY069537@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Nov 12 19:15:06 2013 New Revision: 258063 URL: http://svnweb.freebsd.org/changeset/base/258063 Log: Add an -s option that specifies a path to an alternate etcupdate.sh script to test. This allows a non-installed version of the script to be tested more easily. 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/tests.sh Modified: head/tools/regression/usr.sbin/etcupdate/always.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/always.sh Tue Nov 12 19:10:28 2013 (r258062) +++ head/tools/regression/usr.sbin/etcupdate/always.sh Tue Nov 12 19:15:06 2013 (r258063) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: always.sh [-w workdir]" + echo "Usage: always.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -372,7 +376,7 @@ fi build_trees -etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out cat > $WORKDIR/correct.out <<EOF D /dirchange/fromdir/extradir/file @@ -492,7 +496,7 @@ fifo /dirchange/todir/difftype build_trees -etcupdate -r -A '/first*' -A '/second* /*di*' -d $WORKDIR -D $TEST > \ +$COMMAND -r -A '/first*' -A '/second* /*di*' -d $WORKDIR -D $TEST > \ $WORKDIR/test1.out cat > $WORKDIR/correct1.out <<EOF Modified: head/tools/regression/usr.sbin/etcupdate/conflicts.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/conflicts.sh Tue Nov 12 19:10:28 2013 (r258062) +++ head/tools/regression/usr.sbin/etcupdate/conflicts.sh Tue Nov 12 19:15:06 2013 (r258063) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: tests.sh [-w workdir]" + echo "Usage: conflicts.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -84,7 +88,7 @@ default:\\ :welcome=/etc/motd: EOF - etcupdate -r -d $WORKDIR -D $TEST >/dev/null + $COMMAND -r -d $WORKDIR -D $TEST >/dev/null } # This is used to verify special handling for /etc/mail/aliases and @@ -122,7 +126,7 @@ MAILER-DAEMON: postmaster postmaster: foo EOF - etcupdate -r -d $WORKDIR -D $TEST >/dev/null + $COMMAND -r -d $WORKDIR -D $TEST >/dev/null } # $1 - relative path to file that should be missing from TEST @@ -201,7 +205,7 @@ build_login_conflict # Verify that 'p' doesn't do anything. echo "Checking 'p':" -echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd missing /etc/login.conf.db @@ -209,7 +213,7 @@ conflict /etc/login.conf # Verify that 'mf' removes the conflict, but does nothing else. echo "Checking 'mf':" -echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd missing /etc/login.conf.db @@ -219,7 +223,7 @@ build_login_conflict # Verify that 'tf' installs the new version of the file. echo "Checking 'tf':" -echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 7774a0f9a3a372c7c109c32fd31c4b6b file /etc/login.conf.db @@ -238,7 +242,7 @@ default:\\ :welcome=/etc/motd: EOF -echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 966e25984b9b63da8eaac8479dcb0d4d file /etc/login.conf.db @@ -248,12 +252,12 @@ build_aliases_conflict # Verify that 'p' and 'mf' do not generate the newaliases warning. echo "Checking newalias warning for 'p'": -echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -eq 0 ]; then echo "+ Extra warning" fi echo "Checking newalias warning for 'mf'": -echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -eq 0 ]; then echo "+ Extra warning" fi @@ -261,14 +265,14 @@ fi # Verify that 'tf' and 'r' do generate the newaliases warning. build_aliases_conflict echo "Checking newalias warning for 'tf'": -echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -ne 0 ]; then echo "- Missing warning" fi build_aliases_conflict cp $TEST/etc/mail/aliases $CONFLICTS/etc/mail/aliases -echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -ne 0 ]; then echo "- Missing warning" fi Modified: head/tools/regression/usr.sbin/etcupdate/fbsdid.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/fbsdid.sh Tue Nov 12 19:10:28 2013 (r258062) +++ head/tools/regression/usr.sbin/etcupdate/fbsdid.sh Tue Nov 12 19:15:06 2013 (r258063) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: fbsdid.sh [-w workdir]" + echo "Usage: fbsdid.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -267,7 +271,7 @@ fi build_trees -etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out cat > $WORKDIR/correct.out <<EOF C /already @@ -300,7 +304,7 @@ file /local-already "" 0298b958a603049f4 build_trees -etcupdate -rF -d $WORKDIR -D $TEST > $WORKDIR/testF.out +$COMMAND -rF -d $WORKDIR -D $TEST > $WORKDIR/testF.out cat > $WORKDIR/correctF.out <<EOF D /remove Modified: head/tools/regression/usr.sbin/etcupdate/ignore.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/ignore.sh Tue Nov 12 19:10:28 2013 (r258062) +++ head/tools/regression/usr.sbin/etcupdate/ignore.sh Tue Nov 12 19:15:06 2013 (r258063) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: ignore.sh [-w workdir]" + echo "Usage: ignore.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -172,7 +176,7 @@ fi build_trees -etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out cat > $WORKDIR/correct.out <<EOF D /rmdir/file @@ -195,7 +199,7 @@ missing /rmdir build_trees -etcupdate -r -I '/tree/*' -d $WORKDIR -D $TEST > $WORKDIR/test1.out +$COMMAND -r -I '/tree/*' -d $WORKDIR -D $TEST > $WORKDIR/test1.out cat > $WORKDIR/correct1.out <<EOF D /rmdir/file @@ -215,7 +219,7 @@ missing /rmdir build_trees -etcupdate -r -I '/tree/*' -I '/rmdir*' -d $WORKDIR -D $TEST > \ +$COMMAND -r -I '/tree/*' -I '/rmdir*' -d $WORKDIR -D $TEST > \ $WORKDIR/test2.out cat > $WORKDIR/correct2.out <<EOF @@ -236,7 +240,7 @@ file /rmdir/file "foo" build_trees -etcupdate -r -I '/tree/* /rmdir/*' -d $WORKDIR -D $TEST > \ +$COMMAND -r -I '/tree/* /rmdir/*' -d $WORKDIR -D $TEST > \ $WORKDIR/test3.out cat > $WORKDIR/correct3.out <<EOF Modified: head/tools/regression/usr.sbin/etcupdate/tests.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/tests.sh Tue Nov 12 19:10:28 2013 (r258062) +++ head/tools/regression/usr.sbin/etcupdate/tests.sh Tue Nov 12 19:15:06 2013 (r258063) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: tests.sh [-w workdir]" + echo "Usage: tests.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -904,7 +908,7 @@ fi build_trees -etcupdate -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out +$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out cat > $WORKDIR/correct.out <<EOF D /dirchange/fromdir/extradir/file @@ -971,7 +975,7 @@ EOF echo "Differences for -n:" diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/testn.out -etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out +$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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311121915.rACJF7DY069537>