"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Re: fix some test_done when $ret is 0
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 3 Jun 2022 12:42:01 -0600

Download raw body.

Thread
On Fri, Jun 03, 2022 at 05:20:25PM +0200, Omar Polo wrote:
> there are also some places where ret is not set; again, found with some
> grepping, i may have missed some other cases.
> 

ok. This fixed the problem mentioned on irc. Thanks!

> diff 1b8a517627aabf6aeb4fe3a196772f101c011afb /home/op/w/got
> blob - 435304c10a3b415ec9295b0260316b311b220682
> file + regress/cmdline/cherrypick.sh
> --- regress/cmdline/cherrypick.sh
> +++ regress/cmdline/cherrypick.sh
> @@ -910,6 +910,7 @@ test_cherrypick_symlink_conflicts() {
>  	echo "M  new.link" >> $testroot/stdout.expected
>  	echo "D  nonexistent.link" >> $testroot/stdout.expected
>  	(cd $testroot/wt && got status > $testroot/stdout)
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		diff -u $testroot/stdout.expected $testroot/stdout
>  		test_done "$testroot" "$ret"
> blob - 7a0c9fac946246753a140a7bcc326eb9d7dd52a0
> file + regress/cmdline/clone.sh
> --- regress/cmdline/clone.sh
> +++ regress/cmdline/clone.sh
> @@ -30,12 +30,14 @@ test_clone_basic() {
>  	fi
>  
>  	got log -l0 -p -r $testroot/repo > $testroot/log-repo
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got log command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
>  		return 1
>  	fi
>  	got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got log command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -50,6 +52,7 @@ test_clone_basic() {
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -68,6 +71,7 @@ test_clone_basic() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> blob - a47da6f0af1aa406f84e1d46e3d290ad42d50012
> file + regress/cmdline/fetch.sh
> --- regress/cmdline/fetch.sh
> +++ regress/cmdline/fetch.sh
> @@ -34,6 +34,7 @@ test_fetch_basic() {
>  	local commit_id2=`git_show_head $testroot/repo`
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -60,12 +61,14 @@ test_fetch_basic() {
>  	fi
>  
>  	got log -l0 -p -r $testroot/repo > $testroot/log-repo
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got log command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
>  		return 1
>  	fi
>  	got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got log command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -80,6 +83,7 @@ test_fetch_basic() {
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -98,6 +102,7 @@ test_fetch_basic() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1200,6 +1205,7 @@ test_fetch_delete_remote_refs() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1262,6 +1268,7 @@ test_fetch_delete_remote_refs() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> blob - 5b7231fd5e9a81e444ef0abfde043e2d565cc61b
> file + regress/cmdline/send.sh
> --- regress/cmdline/send.sh
> +++ regress/cmdline/send.sh
> @@ -65,6 +65,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -86,6 +87,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -267,6 +269,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -287,6 +290,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -343,6 +347,7 @@ EOF
>  	got branch -r $testroot/repo-clone branch2
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -447,8 +452,9 @@ EOF
>  		test_done "$testroot" "$ret"
>  		return 1
>  	fi
> -	
> +
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -468,6 +474,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -534,6 +541,7 @@ test_send_clone_and_send() {
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -552,6 +560,7 @@ test_send_clone_and_send() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -631,6 +640,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -653,6 +663,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -890,6 +901,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -915,6 +927,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -992,6 +1005,7 @@ test_send_new_branch() {
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1011,6 +1025,7 @@ test_send_new_branch() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1077,6 +1092,7 @@ test_send_all_branches() {
>  	local commit_id4=`git_show_branch_head $testroot/repo-clone bar`
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1125,6 +1141,7 @@ test_send_all_branches() {
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1145,6 +1162,7 @@ test_send_all_branches() {
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1226,6 +1244,7 @@ EOF
>  	got ref -r $testroot/repo2 -s refs/heads/master HEAD
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1246,6 +1265,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo2 > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1321,6 +1341,7 @@ remote "origin" {
>  }
>  EOF
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1348,6 +1369,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1378,8 +1400,9 @@ EOF
>  		test_done "$testroot" "$ret"
>  		return 1
>  	fi
> -	
> +
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1429,6 +1452,7 @@ remote "origin" {
>  }
>  EOF
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> @@ -1461,6 +1485,7 @@ EOF
>  	fi
>  
>  	got ref -l -r $testroot/repo-clone > $testroot/stdout
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		echo "got ref command failed unexpectedly" >&2
>  		test_done "$testroot" "$ret"
> blob - 914cb847c018254515703871e7f5f4db64b790b0
> file + regress/cmdline/update.sh
> --- regress/cmdline/update.sh
> +++ regress/cmdline/update.sh
> @@ -2263,6 +2263,7 @@ test_update_symlink_conflicts() {
>  	echo "M  new.link" >> $testroot/stdout.expected
>  	echo "D  nonexistent.link" >> $testroot/stdout.expected
>  	(cd $testroot/wt && got status > $testroot/stdout)
> +	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		diff -u $testroot/stdout.expected $testroot/stdout
>  		test_done "$testroot" "$ret"
> 

-- 

Tracey Emery