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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: WIP Otto's Malloc Regression Integration
To:
Kyle Ackerman <kack@kyleackerman.net>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 11 Dec 2024 19:09:26 +0100

Download raw body.

Thread
On Thu, Dec 05, 2024 at 08:26:18PM +0000, Kyle Ackerman wrote:
> This is a WIP diff to give an option for regression tests.
> 
> Here is an example once you apply the patch
> 
> ```
> cd ./regress/cmdline/
> MEM_CHECK=1 ./send.sh
> ```
> 
> You can set MEM_CHECK to {1,2,3,4} which will be passed down to MALLOC_OPTIONS.
> If a regression produces a memory leak, then the kdump is left in $testroot, otherwise
> it is deleted with $testroot. The kdump is also printed.
> I currently only have this implemented in ./add.sh and ./send.sh. Trying to enable 
> MEM_CHECK on a regress without it being implemented will cause it to fail.
> The current pain point with the diff below is that ktrace(1) has a return value, so 
> it may cause issues as we check got's return value in some regressions.

Thanks a lot! This is a great starting point.

Below is a diff against the main branch, which I based on yours.
There are some simplications, and I would like to separate out the
memory leak tests from the rest, for two reasons:

1) We don't want to carry the burden of thinking about memleaks
testing while writing tests for other bugs. That would just get
in the way of regular bug fixing. And this solves the problem of
dealing with ktrace-specific exit codes since the memleak tests
can be written to take this into account.

2) We can run memleak checks by default when they're separated out.

Attached is a patch relative to the one you sent, showing the tweaks
I made on top of yours. Both diffs applied together produce the diff
below.

If you're happy with this I would commit these 2 diffs in a series and
we can keep tweaking it in-tree, adding more memleak tests over time.

diff refs/heads/main refs/heads/memleak
commit - 75bd1d8cea00a4cbdbdf6bcea2eb272df2fef76e
commit + f432cdf424b63d4701af6c0170531a713e82d83c
blob - 8625a7dfe8434206263677cae6d47f88935f4a43
blob + ccd394f290990926dc51bb4e6ef639915cb5eeb0
--- regress/cmdline/Makefile
+++ regress/cmdline/Makefile
@@ -1,7 +1,7 @@
 REGRESS_TARGETS=checkout update status log add rm diff blame branch tag \
 	ref commit revert cherrypick backout rebase init import histedit \
 	integrate merge stage unstage cat clone fetch send tree patch pack \
-	cleanup dump load
+	cleanup dump load memleak
 NOOBJ=Yes
 
 GOT_TEST_ROOT=/tmp
@@ -105,4 +105,7 @@ dump:
 load:
 	./load.sh -q -r "$(GOT_TEST_ROOT)"
 
+memleak:
+	./memleak.sh -q -r "$(GOT_TEST_ROOT)"
+
 .include <bsd.regress.mk>
blob - 156415b56edfb4ef165638477f4d1a02d4b5d86f
blob + 772f6211b358c90a8350c2c2703196dbbc2f3c13
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -32,7 +32,11 @@ export GOT_TEST_ALGO="${GOT_TEST_ALGO:-sha1}"
 
 export LC_ALL=C
 
-export MALLOC_OPTIONS=S
+if [ -n "$MEM_CHECK" ] && [ "$MEM_CHECK" -gt 0 ] && [ "$MEM_CHECK" -lt 5 ]; then
+	export MALLOC_OPTIONS="$MEM_CHECK"S
+else
+	export MALLOC_OPTIONS=S
+fi
 
 git_init()
 {
@@ -300,3 +304,33 @@ test_done()
 		echo "test failed; leaving test data in $testroot"
 	fi
 }
+
+test_memleak_done()
+{
+	local testroot="$1"
+	local result="$2"
+
+	if kdump -u malloc -f $testroot/ktrace.out | grep -q " got 0x"; then
+		kdump -u malloc -f $testroot/ktrace.out
+		result=1
+	fi
+
+	test_done "$testroot" "$result"
+}
+
+check_memleak()
+{
+	local testroot="$1"
+
+	if [ -z "$1" ]; then
+		echo "Testroot not passed"
+		exit 1
+	fi
+
+	if [ ! -d "$testroot" ]; then
+		echo "Directory does not exist"	
+		exit 1
+	fi
+
+	echo "ktrace -dtu -f $testroot/ktrace.out"
+}
blob - /dev/null
blob + a85fc92460f40b533e431fdbb513a5cc625a94c9 (mode 755)
--- /dev/null
+++ regress/cmdline/memleak.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# Copyright (c) 2024 Kyle Ackerman <kack@kyleackerman.net>
+# Copyright (c) 2024 Stefan Sperling <stsp@openbsd.org>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+export MEM_CHECK=1
+
+. ./common.sh
+
+test_memleak_add_basic() {
+	local testroot=`test_init memleak_add_basic`
+
+	got checkout $testroot/repo $testroot/wt > /dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	echo "new file" > $testroot/wt/foo
+
+	echo 'A  foo' > $testroot/stdout.expected
+	(cd $testroot/wt && $(check_memleak $testroot) \
+		got add foo > $testroot/stdout)
+
+	test_memleak_done "$testroot" "$ret"
+}
+
+test_memleak_send_basic() {
+	local testroot=`test_init send_basic`
+	local testurl=ssh://127.0.0.1/$testroot
+	local commit_id=`git_show_head $testroot/repo`
+	got clone -q $testurl/repo $testroot/repo-clone
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "got clone command failed unexpectedly" >&2
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+	cat > $testroot/repo/.git/got.conf <<EOF
+remote "origin" {
+	protocol ssh
+	server 127.0.0.1
+	repository "$testroot/repo-clone"
+}
+EOF
+	got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
+	tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
+		| tr -d ' ' | cut -d: -f2`
+
+	echo "modified alpha" > $testroot/repo/alpha
+	git -C $testroot/repo rm -q beta
+	(cd $testroot/repo && ln -s epsilon/zeta symlink)
+	git -C $testroot/repo add symlink
+	echo "new file alpha" > $testroot/repo/new
+	git -C $testroot/repo add new
+	git_commit $testroot/repo -m "modified alpha"
+	local commit_id2=`git_show_head $testroot/repo`
+
+	$(check_memleak $testroot) got send -q -r $testroot/repo \
+		> $testroot/stdout 2> $testroot/stderr
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "got send command failed unexpectedly" >&2
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	test_memleak_done "$testroot" "$ret"
+}
+
+test_parseargs "$@"
+run_test test_memleak_add_basic
+run_test test_memleak_send_basic

commit f432cdf424b63d4701af6c0170531a713e82d83c (memleak)
from: Stefan Sperling <stsp@stsp.name>
date: Wed Dec 11 18:01:01 2024 UTC

move memory leak tests into a separate test suite script

This allows us to keep writing tests without worrying about checking for
memory all the time.

Enable the new memory leak regress tests by default.
For now, only run the add_basic and send_basic tests. More to follow.

Simplify kdump grepping a bit. The previous version didn't work with
MEM_CHECK=1 or MEM_CHECK=2. We now also show the whole kdump output
when a memleak is found, without any post-processing. This can be
improved again later.

M  regress/cmdline/Makefile    |   4+   1-
M  regress/cmdline/add.sh      |   9+   9-
M  regress/cmdline/common.sh   |  27+  23-
A  regress/cmdline/memleak.sh  |  86+   0-
M  regress/cmdline/send.sh     |  19+  17-

5 files changed, 145 insertions(+), 50 deletions(-)

commit - 3b647a6382adaef049676caaa05c64fe4e9c88cd
commit + f432cdf424b63d4701af6c0170531a713e82d83c
blob - 8625a7dfe8434206263677cae6d47f88935f4a43
blob + ccd394f290990926dc51bb4e6ef639915cb5eeb0
--- regress/cmdline/Makefile
+++ regress/cmdline/Makefile
@@ -1,7 +1,7 @@
 REGRESS_TARGETS=checkout update status log add rm diff blame branch tag \
 	ref commit revert cherrypick backout rebase init import histedit \
 	integrate merge stage unstage cat clone fetch send tree patch pack \
-	cleanup dump load
+	cleanup dump load memleak
 NOOBJ=Yes
 
 GOT_TEST_ROOT=/tmp
@@ -105,4 +105,7 @@ dump:
 load:
 	./load.sh -q -r "$(GOT_TEST_ROOT)"
 
+memleak:
+	./memleak.sh -q -r "$(GOT_TEST_ROOT)"
+
 .include <bsd.regress.mk>
blob - 7720966abd677bd77f4523cefbc5a522b8d7b78f
blob + ebba1caf39b7ef4c28dcefcc7bb43a6ec5597c76
--- regress/cmdline/add.sh
+++ regress/cmdline/add.sh
@@ -29,7 +29,7 @@ test_add_basic() {
 	echo "new file" > $testroot/wt/foo
 
 	echo 'A  foo' > $testroot/stdout.expected
-	(cd $testroot/wt && $(SHIM $testroot) got add foo > $testroot/stdout)
+	(cd $testroot/wt && got add foo > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
@@ -52,7 +52,7 @@ test_double_add() {
 	echo "new file" > $testroot/wt/foo
 	(cd $testroot/wt && got add foo > /dev/null)
 
-	(cd $testroot/wt && $(SHIM $testroot) got add foo > $testroot/stdout)
+	(cd $testroot/wt && got add foo > $testroot/stdout)
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got add failed unexpectedly" >&2
@@ -100,7 +100,7 @@ test_add_multiple() {
 	echo "new file" > $testroot/wt/foo
 	echo "new file" > $testroot/wt/bar
 	echo "new file" > $testroot/wt/baz
-	(cd $testroot/wt && $(SHIM $testroot) got add foo bar baz > $testroot/stdout)
+	(cd $testroot/wt && got add foo bar baz > $testroot/stdout)
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got add failed unexpectedly" >&2
@@ -155,7 +155,7 @@ test_add_file_in_new_subdir() {
 	echo "new file" > $testroot/wt/new/foo
 
 	echo 'A  new/foo' > $testroot/stdout.expected
-	(cd $testroot/wt && $(SHIM $testroot) got add new/foo > $testroot/stdout)
+	(cd $testroot/wt && got add new/foo > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
@@ -178,7 +178,7 @@ test_add_deleted() {
 	(cd $testroot/wt && got rm beta > /dev/null)
 
 	echo -n > $testroot/stdout.expected
-	(cd $testroot/wt && $(SHIM $testroot) got add beta > $testroot/stdout 2> $testroot/stderr)
+	(cd $testroot/wt && got add beta > $testroot/stdout 2> $testroot/stderr)
 	ret=$?
 	if [ $ret -eq 0 ]; then
 		echo "got add command succeeded unexpectedly" >&2
@@ -239,7 +239,7 @@ test_add_force_delete_commit() {
 	# File 'new' was once in A status (locally added) but is now
 	# in "!" (missing) status since it was never committed.
 	# Removing it effectively reverts the local addition.
-	(cd $testroot/wt && $(SHIM $testroot) got remove -f new > $testroot/stdout \
+	(cd $testroot/wt && got remove -f new > $testroot/stdout \
 		2> $testroot/stderr)
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -334,7 +334,7 @@ test_add_directory() {
 		return 1
 	fi
 
-	(cd $testroot/wt && $(SHIM $testroot) got add -RI tree1 > $testroot/stdout)
+	(cd $testroot/wt && got add -RI tree1 > $testroot/stdout)
 
 	echo 'A  tree1/foo' > $testroot/stdout.expected
 
@@ -401,7 +401,7 @@ test_add_clashes_with_submodule() {
 	(cd $testroot/wt && got update > /dev/null)
 
 	# This currently fails with "work tree must be updated"...
-	(cd $testroot/wt && $(SHIM $testroot) got commit -m 'add file repo2' \
+	(cd $testroot/wt && got commit -m 'add file repo2' \
 		> $testroot/stdout 2> $testroot/stderr)
 	ret=$?
 	if [ $ret -eq 0 ]; then
@@ -476,7 +476,7 @@ test_add_symlink() {
 	fi
 
 	echo "A  nonexistent.link" > $testroot/stdout.expected
-	(cd $testroot/wt && $(SHIM $testroot) got add nonexistent.link > $testroot/stdout)
+	(cd $testroot/wt && got add nonexistent.link > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
 	if [ $ret -ne 0 ]; then
blob - 9e9318d46ca7d6bf52ca7f7f11aa6b5e1be8e31b
blob + 772f6211b358c90a8350c2c2703196dbbc2f3c13
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -32,11 +32,10 @@ export GOT_TEST_ALGO="${GOT_TEST_ALGO:-sha1}"
 
 export LC_ALL=C
 
-if [ -n "$MEM_CHECK" ]  &&  [ "$MEM_CHECK" -gt 0 ] && [ "$MEM_CHECK" -lt 5 ]; then
-		export MALLOC_OPTIONS="$MEM_CHECK"S
-		echo $MALLOC_OPTIONS
+if [ -n "$MEM_CHECK" ] && [ "$MEM_CHECK" -gt 0 ] && [ "$MEM_CHECK" -lt 5 ]; then
+	export MALLOC_OPTIONS="$MEM_CHECK"S
 else
-export MALLOC_OPTIONS=S
+	export MALLOC_OPTIONS=S
 fi
 
 git_init()
@@ -292,13 +291,6 @@ test_done()
 {
 	local testroot="$1"
 	local result="$2"
-	if [ -n "$MEM_CHECK" ]; then
-		if [ $(kdump -u malloc -f $testroot/ktrace.out | awk -v LINE="$MEM_CHECK" 'NR%LINE==1' | grep -c "got" ) -gt 2 ] ; then
-			kdump -u malloc -f $testroot/ktrace.out | sed 's/got/~\/bin\/got/' #| malloc_p
-			echo "FOUND MEMORY LEAK; leaving test data in $testroot"
-			return 1
-		fi
-	fi
 	if [ "$result" = "0" ]; then
 		test_cleanup "$testroot" || return 1
 		if [ -z "$GOT_TEST_QUIET" ]; then
@@ -313,20 +305,32 @@ test_done()
 	fi
 }
 
-SHIM()
+test_memleak_done()
 {
-	if [ -n "$MEM_CHECK" ]; then
+	local testroot="$1"
+	local result="$2"
 
-		if [ -z "$1" ]; then
-			echo "Testroot not passed"
-			exit 1
-		fi
-		local testroot="$1"
-		if [ ! -d "$testroot" ]; then
-			echo "Directory does not exist"	
-			exit 1
-		fi
-		echo "ktrace -dtu -f $testroot/ktrace.out"
+	if kdump -u malloc -f $testroot/ktrace.out | grep -q " got 0x"; then
+		kdump -u malloc -f $testroot/ktrace.out
+		result=1
 	fi
+
+	test_done "$testroot" "$result"
 }
 
+check_memleak()
+{
+	local testroot="$1"
+
+	if [ -z "$1" ]; then
+		echo "Testroot not passed"
+		exit 1
+	fi
+
+	if [ ! -d "$testroot" ]; then
+		echo "Directory does not exist"	
+		exit 1
+	fi
+
+	echo "ktrace -dtu -f $testroot/ktrace.out"
+}
blob - /dev/null
blob + a85fc92460f40b533e431fdbb513a5cc625a94c9 (mode 755)
--- /dev/null
+++ regress/cmdline/memleak.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# Copyright (c) 2024 Kyle Ackerman <kack@kyleackerman.net>
+# Copyright (c) 2024 Stefan Sperling <stsp@openbsd.org>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+export MEM_CHECK=1
+
+. ./common.sh
+
+test_memleak_add_basic() {
+	local testroot=`test_init memleak_add_basic`
+
+	got checkout $testroot/repo $testroot/wt > /dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	echo "new file" > $testroot/wt/foo
+
+	echo 'A  foo' > $testroot/stdout.expected
+	(cd $testroot/wt && $(check_memleak $testroot) \
+		got add foo > $testroot/stdout)
+
+	test_memleak_done "$testroot" "$ret"
+}
+
+test_memleak_send_basic() {
+	local testroot=`test_init send_basic`
+	local testurl=ssh://127.0.0.1/$testroot
+	local commit_id=`git_show_head $testroot/repo`
+	got clone -q $testurl/repo $testroot/repo-clone
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "got clone command failed unexpectedly" >&2
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+	cat > $testroot/repo/.git/got.conf <<EOF
+remote "origin" {
+	protocol ssh
+	server 127.0.0.1
+	repository "$testroot/repo-clone"
+}
+EOF
+	got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
+	tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
+		| tr -d ' ' | cut -d: -f2`
+
+	echo "modified alpha" > $testroot/repo/alpha
+	git -C $testroot/repo rm -q beta
+	(cd $testroot/repo && ln -s epsilon/zeta symlink)
+	git -C $testroot/repo add symlink
+	echo "new file alpha" > $testroot/repo/new
+	git -C $testroot/repo add new
+	git_commit $testroot/repo -m "modified alpha"
+	local commit_id2=`git_show_head $testroot/repo`
+
+	$(check_memleak $testroot) got send -q -r $testroot/repo \
+		> $testroot/stdout 2> $testroot/stderr
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "got send command failed unexpectedly" >&2
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	test_memleak_done "$testroot" "$ret"
+}
+
+test_parseargs "$@"
+run_test test_memleak_add_basic
+run_test test_memleak_send_basic
blob - 281962da0bea2b3ea4ea86ea3250a2c870385be7
blob + 9d3971a3148f13aa50c0b1e2ec9a992d1f859e29
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
@@ -20,6 +20,7 @@ test_send_basic() {
 	local testroot=`test_init send_basic`
 	local testurl=ssh://127.0.0.1/$testroot
 	local commit_id=`git_show_head $testroot/repo`
+
 	got clone -q $testurl/repo $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -47,7 +48,7 @@ EOF
 	git_commit $testroot/repo -m "modified alpha"
 	local commit_id2=`git_show_head $testroot/repo`
 
-	$(SHIM $testroot) got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
+	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -149,6 +150,7 @@ test_send_rebase_required() {
 	local testroot=`test_init send_rebase_required`
 	local testurl=ssh://127.0.0.1/$testroot
 	local commit_id=`git_show_head $testroot/repo`
+
 	got clone -q $testurl/repo $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -171,7 +173,7 @@ EOF
 	echo "modified alpha, too" > $testroot/wt-clone/alpha
 	(cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
 
-	$(SHIM $testroot ) got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
+	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2
@@ -239,7 +241,7 @@ EOF
 	local commit_id3=`git_show_head $testroot/repo-clone`
 
 	# non-default remote requires an explicit argument
-	$(SHIM $testroot ) got send -q -r $testroot/repo -f > $testroot/stdout \
+	got send -q -r $testroot/repo -f > $testroot/stdout \
 		2> $testroot/stderr
 	ret=$?
 	if [ $ret -eq 0 ]; then
@@ -357,7 +359,7 @@ test_send_merge_commit() {
 
 	git -C $testroot/repo config receive.denyCurrentBranch ignore
 
-	$(SHIM $testroot ) got send -q -r $testroot/repo-clone
+	got send -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		test_done "$testroot" "$ret"
@@ -407,7 +409,7 @@ EOF
 
 	# Sending changes for a branch and deleting it at the same
 	# time is not allowed.
-	$(SHIM $testroot ) got send -q -r $testroot/repo -d branch1 -b branch1 \
+	got send -q -r $testroot/repo -d branch1 -b branch1 \
 		> $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -eq 0 ]; then
@@ -570,7 +572,7 @@ test_send_clone_and_send() {
 	(cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
 	local commit_id2=`git_show_head $testroot/repo-clone`
 
-	(cd $testroot/wt && $(SHIM $testroot ) got send -q > $testroot/stdout 2> $testroot/stderr)
+	(cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -669,7 +671,7 @@ EOF
 	tag_id2=`got ref -r $testroot/repo -l | grep "^refs/tags/2.0" \
 		| tr -d ' ' | cut -d: -f2`
 
-	$(SHIM $testroot ) got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
+	got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -845,7 +847,7 @@ EOF
 	(cd $testroot/wt && got commit -m 'changing file alpha' > /dev/null)
 
 	# Send the new commit in isolation.
-	$(SHIM $testroot ) got send -q -r $testroot/repo > $testroot/stdout \
+	got send -q -r $testroot/repo > $testroot/stdout \
 		2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -930,7 +932,7 @@ EOF
 	git_commit $testroot/repo -m "modified alpha"
 	local commit_id3=`git_show_head $testroot/repo`
 
-	$(SHIM $testroot ) got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
+	got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1034,7 +1036,7 @@ test_send_new_branch() {
 	(cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
 	local commit_id2=`git_show_branch_head $testroot/repo-clone foo`
 
-	(cd $testroot/wt && $(SHIM $testroot ) got send -q > $testroot/stdout 2> $testroot/stderr)
+	(cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1169,7 +1171,7 @@ test_send_all_branches() {
 		return 1
 	fi
 
-	$(SHIM $testroot ) got send -a -q -r $testroot/repo-clone > $testroot/stdout \
+	got send -a -q -r $testroot/repo-clone > $testroot/stdout \
 		2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -1330,7 +1332,7 @@ EOF
 		return 1
 	fi
 
-	$(SHIM $testroot ) got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
+	got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1441,7 +1443,7 @@ EOF
 	fi
 
 	# send tag 1.0 to repo-clone
-	$(SHIM $testroot ) got send -q -r $testroot/repo -t 1.0 > $testroot/stdout
+	got send -q -r $testroot/repo -t 1.0 > $testroot/stdout
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1524,7 +1526,7 @@ EOF
 
 	got branch -r $testroot/repo foo
 
-	$(SHIM $testroot ) got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
+	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1584,7 +1586,7 @@ cat >> $testroot/repo/.git/config <<EOF
 EOF
 
 	# unset in a subshell to avoid affecting our environment
-	(unset GOT_IGNORE_GITCONFIG && $(SHIM $testroot ) got send -q -r $testroot/repo foo)
+	(unset GOT_IGNORE_GITCONFIG && got send -q -r $testroot/repo foo)
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1641,7 +1643,7 @@ EOF
 	echo "modified alpha" >$testroot/repo/alpha
 	git_commit "$testroot/repo" -m "modified alpha"
 
-	$(SHIM $testroot ) got send -q -r "$testroot/repo" >$testroot/stdout 2>$testroot/stderr
+	got send -q -r "$testroot/repo" >$testroot/stdout 2>$testroot/stderr
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo "got send command failed unexpectedly" >&2
@@ -1711,7 +1713,7 @@ EOF
 	git_commit $testroot/repo -m "modified alpha"
 	local commit_id2=`git_show_head $testroot/repo`
 
-	$(SHIM $testroot ) got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
+	got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
 	ret=$?
 	if [ $ret -eq 0 ]; then
 		echo "got send command succeeded unexpectedly" >&2