Download raw body.
Make regress tests more POSIXy
On Mon, Nov 22, 2021 at 10:43:03PM +0000, Thomas Adam wrote:
> To help -portable out, it would be nice if the shell scripts didn't assume
> that equality checks are '==' rather than '=' (which works on any shell).
>
> Patch attched.
Indeed. Sorry, I keep putting == in, and others change them to =.
I will try to remember to use = here.
ok
> -----------------------------------------------
> commit 566e0ee7be3658e35381b86aee2469c0838c6985 (ta/fix-regress-portability)
> from: Thomas Adam <thomas@xteddy.org>
> date: Mon Nov 22 22:32:25 2021 UTC
>
> regress: make test operands POSIX compliant
>
> Since the interpreter for the regress shell scripts are using /bin/sh
> this will usually imply some level of POSIX compliance (that isn't
> bash-specific, for instance).
>
> Some systems use dash as their sh shell and as such is stricter POSIX
> compliance. To help -portable, make the shell test checks use a single
> '=' for equality, rather than '=='.
>
> diff b93f4b6eb6327216e57565cadbf70971803bc5a3 e49214037c8c52cb9f12c04f877f566181464b87
> blob - bb31a4ff0f60f6eae6b54b90abdbf7ce98b11618
> blob + ca1e787e193580d85479d0f3a60497b0559d95a8
> --- regress/cmdline/cherrypick.sh
> +++ regress/cmdline/cherrypick.sh
> @@ -588,7 +588,7 @@ EOF
> (cd $testroot/wt && got commit -m 'commit cherrypick result' \
> > /dev/null 2>$testroot/stderr)
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "got commit succeeded unexpectedly" >&2
> test_done "$testroot" "$ret"
> return 1
> blob - 7f88ca162b03984f506ec0612d4004a03f86c25f
> blob + 66d5c86494cc7a9c82ea9071428274079529ae7f
> --- regress/cmdline/diff.sh
> +++ regress/cmdline/diff.sh
> @@ -278,7 +278,7 @@ test_diff_basic() {
> # -P can only be used in a work tree
> got diff -r $testroot/repo -P new master 2> $testroot/stderr
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "diff succeeded unexpectedly" >&2
> test_done "$testroot" "1"
> return 1
> @@ -1092,7 +1092,7 @@ test_diff_commits() {
> (cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 -c foo \
> 2> $testroot/stderr)
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "diff succeeded unexpectedly" >&2
> test_done "$testroot" "1"
> return 1
> @@ -1110,7 +1110,7 @@ test_diff_commits() {
> (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 -P foo \
> 2> $testroot/stderr)
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "diff succeeded unexpectedly" >&2
> test_done "$testroot" "1"
> return 1
> @@ -1129,7 +1129,7 @@ test_diff_commits() {
> (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 -s foo \
> 2> $testroot/stderr)
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "diff succeeded unexpectedly" >&2
> test_done "$testroot" "1"
> return 1
> @@ -1148,7 +1148,7 @@ test_diff_commits() {
> (cd $testroot/repo && got diff $commit_id0 $commit_id1 foo \
> 2> $testroot/stderr)
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "diff succeeded unexpectedly" >&2
> test_done "$testroot" "1"
> return 1
> @@ -1167,7 +1167,7 @@ test_diff_commits() {
> (cd $testroot/wt && got diff $commit_id0 master foo \
> 2> $testroot/stderr)
> ret="$?"
> - if [ "$ret" == "0" ]; then
> + if [ "$ret" = "0" ]; then
> echo "diff succeeded unexpectedly" >&2
> test_done "$testroot" "1"
> return 1
>
Make regress tests more POSIXy