Commit 693719bce20f84e8ab48d17e3e58f2c0c35f51b9

Stefan Sperling 2019-01-03T01:00:30

don't clobber cmp's exit code with diff's exit code

diff --git a/regress/cmdline/checkout.sh b/regress/cmdline/checkout.sh
index 165d22e..15e1d04 100755
--- a/regress/cmdline/checkout.sh
+++ b/regress/cmdline/checkout.sh
@@ -46,10 +46,11 @@ function test_checkout_basic {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp $testroot/content.expected $testroot/content
-	if [ "$?" != "0" ]; then
+	ret="$?"
+	if [ "$ret" != "0" ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
-	test_done "$testroot" "$?"
+	test_done "$testroot" "$ret"
 }
 
 run_test test_checkout_basic
diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh
index 644f3de..67fd426 100755
--- a/regress/cmdline/update.sh
+++ b/regress/cmdline/update.sh
@@ -50,10 +50,11 @@ function test_update_basic {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp $testroot/content.expected $testroot/content
-	if [ "$?" != "0" ]; then
+	ret="$?"
+	if [ "$ret" != "0" ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
-	test_done "$testroot" "$?"
+	test_done "$testroot" "$ret"
 }
 
 function test_update_adds_file {
@@ -92,10 +93,11 @@ function test_update_adds_file {
 	    $testroot/wt/gamma/delta $testroot/wt/gamma/new > $testroot/content
 
 	cmp $testroot/content.expected $testroot/content
-	if [ "$?" != "0" ]; then
+	ret="$?"
+	if [ "$ret" != "0" ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
-	test_done "$testroot" "$?"
+	test_done "$testroot" "$ret"
 }
 
 function test_update_deletes_file {
@@ -136,10 +138,11 @@ function test_update_deletes_file {
 	    $testroot/wt/gamma/delta > $testroot/content
 
 	cmp $testroot/content.expected $testroot/content
-	if [ "$?" != "0" ]; then
+	ret="$?"
+	if [ "$ret" != "0" ]; then
 		diff -u $testroot/content.expected $testroot/content
 	fi
-	test_done "$testroot" "$?"
+	test_done "$testroot" "$ret"
 }
 
 run_test test_update_basic