Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2014 02:27:27 +0000 (UTC)
From:      Julio Merino <jmmv@FreeBSD.org>
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
Message-ID:  <201403160227.s2G2RRbb010324@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <<EOF
 EOF
 
 echo "Differences for -F:"
-diff -u -L "correct" $WORKDIR/correctF.out -L "test" $WORKDIR/testF.out
+diff -u -L "correct" $WORKDIR/correctF.out -L "test" $WORKDIR/testF.out \
+    || FAILED=yes
 
 missing /remove
 file /old "" 6a9f34f109d94406a4de3bc5d72de259
@@ -363,7 +375,8 @@ cat > $WORKDIR/correctAF.out <<EOF
 EOF
 
 echo "Differences for -A '/*' -F:"
-diff -u -L "correct" $WORKDIR/correctAF.out -L "test" $WORKDIR/testAF.out
+diff -u -L "correct" $WORKDIR/correctAF.out -L "test" $WORKDIR/testAF.out \
+    || FAILED=yes
 
 missing /remove
 file /old "" 6a9f34f109d94406a4de3bc5d72de259
@@ -377,3 +390,5 @@ noconflict /conflict
 file /local "" 6a8fc5c2755b7a49015089f5e1dbe092
 file /local-already "" 49045f8b51542dd634655301cd296f66
 file /local-remove "" 5c38322efed4014797d7127f5c652d9d
+
+[ "${FAILED}" = no ]

Modified: head/tools/regression/usr.sbin/etcupdate/ignore.sh
==============================================================================
--- head/tools/regression/usr.sbin/etcupdate/ignore.sh	Sun Mar 16 02:07:08 2014	(r263220)
+++ head/tools/regression/usr.sbin/etcupdate/ignore.sh	Sun Mar 16 02:27:27 2014	(r263221)
@@ -29,6 +29,7 @@
 
 # Various regression tests to test the -I flag to the 'update' command.
 
+FAILED=no
 WORKDIR=work
 
 usage()
@@ -99,6 +100,7 @@ missing()
 {
 	if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
 		echo "File $1 should be missing"
+		FAILED=yes
 	fi
 }
 
@@ -107,6 +109,7 @@ present()
 {
 	if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
 		echo "File $1 should be present"
+		FAILED=yes
 	fi
 }
 
@@ -115,6 +118,7 @@ dir()
 {
 	if ! [ -d $TEST/$1 ]; then
 		echo "File $1 should be a directory"
+		FAILED=yes
 	fi
 }
 
@@ -127,15 +131,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
 }
@@ -148,10 +155,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
 }
@@ -161,11 +170,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
@@ -187,7 +198,8 @@ cat > $WORKDIR/correct.out <<EOF
 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
 
 missing /tree/remove
 file /tree/modify "new"
@@ -207,7 +219,8 @@ cat > $WORKDIR/correct1.out <<EOF
 EOF
 
 echo "Differences for -I '/tree/*':"
-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
 
 file /tree/remove "old"
 file /tree/modify "old"
@@ -227,7 +240,8 @@ EOF
 
 echo "Differences for -I '/tree/*' -I '/rmdir*':"
 
-diff -u -L "correct" $WORKDIR/correct2.out -L "test" $WORKDIR/test2.out
+diff -u -L "correct" $WORKDIR/correct2.out -L "test" $WORKDIR/test2.out \
+    || FAILED=yes
 
 file /tree/remove "old"
 file /tree/modify "old"
@@ -250,10 +264,13 @@ EOF
 
 echo "Differences for -I '/tree/* /rmdir/*':"
 
-diff -u -L "correct" $WORKDIR/correct3.out -L "test" $WORKDIR/test3.out
+diff -u -L "correct" $WORKDIR/correct3.out -L "test" $WORKDIR/test3.out \
+    || FAILED=yes
 
 file /tree/remove "old"
 file /tree/modify "old"
 missing /tree/add
 file /rmdir/file "foo"
 dir /rmdir
+
+[ "${FAILED}" = no ]

Modified: head/tools/regression/usr.sbin/etcupdate/preworld.sh
==============================================================================
--- head/tools/regression/usr.sbin/etcupdate/preworld.sh	Sun Mar 16 02:07:08 2014	(r263220)
+++ head/tools/regression/usr.sbin/etcupdate/preworld.sh	Sun Mar 16 02:27:27 2014	(r263221)
@@ -29,6 +29,7 @@
 
 # Regression tests for the pre-world (-p) mode 
 
+FAILED=no
 WORKDIR=work
 
 usage()
@@ -147,6 +148,7 @@ missing()
 {
 	if [ -e $TEST/$1 -o -L $TEST/$1 ]; then
 		echo "File $1 should be missing"
+		FAILED=yes
 	fi
 }
 
@@ -155,6 +157,7 @@ present()
 {
 	if ! [ -e $TEST/$1 -o -L $TEST/$1 ]; then
 		echo "File $1 should be present"
+		FAILED=yes
 	fi
 }
 
@@ -167,15 +170,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
 }
@@ -188,10 +194,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
 }
@@ -213,6 +221,7 @@ check_trees()
 
 if [ `id -u` -ne 0 ]; then
 	echo "must be root"
+	exit 0
 fi
 
 if [ -r /etc/etcupdate.conf ]; then
@@ -229,11 +238,15 @@ cat > $WORKDIR/correct.out <<EOF
 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 -p -s $SRC -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/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 <<EOF
 EOF
 
 echo "Differences for no /etc/localtime 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 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 <<EOF
 EOF
 
 echo "Differences for symlinked /etc/localtime 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 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 <<EOF
 EOF
 
 echo "Differences for real update 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 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 ]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403160227.s2G2RRbb010324>