diff options
author | John Baldwin <jhb@FreeBSD.org> | 2013-11-12 19:15:06 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2013-11-12 19:15:06 +0000 |
commit | c387a450ac7cfc23dabd082ceda256a7bff4a5f4 (patch) | |
tree | c204c1d7f8555960445aa7f4682b4ab767113311 /tools/regression | |
parent | 25c58526a3a93eafe5a5f84eb7878980d601c56d (diff) | |
download | src-c387a450ac7cfc23dabd082ceda256a7bff4a5f4.tar.gz src-c387a450ac7cfc23dabd082ceda256a7bff4a5f4.zip |
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.
Notes
Notes:
svn path=/head/; revision=258063
Diffstat (limited to 'tools/regression')
-rwxr-xr-x | tools/regression/usr.sbin/etcupdate/always.sh | 14 | ||||
-rwxr-xr-x | tools/regression/usr.sbin/etcupdate/conflicts.sh | 30 | ||||
-rwxr-xr-x | tools/regression/usr.sbin/etcupdate/fbsdid.sh | 14 | ||||
-rwxr-xr-x | tools/regression/usr.sbin/etcupdate/ignore.sh | 18 | ||||
-rwxr-xr-x | tools/regression/usr.sbin/etcupdate/tests.sh | 14 |
5 files changed, 55 insertions, 35 deletions
diff --git a/tools/regression/usr.sbin/etcupdate/always.sh b/tools/regression/usr.sbin/etcupdate/always.sh index 5f5e586819f7..b67fd8b74e80 100755 --- a/tools/regression/usr.sbin/etcupdate/always.sh +++ b/tools/regression/usr.sbin/etcupdate/always.sh @@ -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 diff --git a/tools/regression/usr.sbin/etcupdate/conflicts.sh b/tools/regression/usr.sbin/etcupdate/conflicts.sh index 0c1932345f78..ec4692739e88 100755 --- a/tools/regression/usr.sbin/etcupdate/conflicts.sh +++ b/tools/regression/usr.sbin/etcupdate/conflicts.sh @@ -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 diff --git a/tools/regression/usr.sbin/etcupdate/fbsdid.sh b/tools/regression/usr.sbin/etcupdate/fbsdid.sh index 3a90a1e280c0..07df248f54ad 100755 --- a/tools/regression/usr.sbin/etcupdate/fbsdid.sh +++ b/tools/regression/usr.sbin/etcupdate/fbsdid.sh @@ -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 "" 0298b958a603049f45ae6a109c4f7fea 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 diff --git a/tools/regression/usr.sbin/etcupdate/ignore.sh b/tools/regression/usr.sbin/etcupdate/ignore.sh index e2249fb6986b..d6bd2ffa038b 100755 --- a/tools/regression/usr.sbin/etcupdate/ignore.sh +++ b/tools/regression/usr.sbin/etcupdate/ignore.sh @@ -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 diff --git a/tools/regression/usr.sbin/etcupdate/tests.sh b/tools/regression/usr.sbin/etcupdate/tests.sh index 798302099a57..8edabb3c64c4 100755 --- a/tools/regression/usr.sbin/etcupdate/tests.sh +++ b/tools/regression/usr.sbin/etcupdate/tests.sh @@ -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 |