[test] Minor
diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 3208007..c63374e 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -86,10 +86,6 @@
 AM_TESTS_ENVIRONMENT = \
 	EXEEXT="$(EXEEXT)"; \
 	export EXEEXT; \
-	srcdir="$(srcdir)"; \
-	export srcdir; \
-	builddir="$(builddir)"; \
-	export builddir; \
 	$(NULL)
 
 if AUTOMAKE_OLDER_THAN_1_13
diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index 7f53e49..76c1bd3 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -20,7 +20,7 @@
 
 builddir = os.environ.get ("builddir", ".")
 top_builddir = os.environ.get ("top_builddir",
-	os.path.normpath (os.path.join (os.getcwd (), "..", "..")))
+	os.path.normpath (os.path.join (builddir, "..", "..")))
 utildir = os.environ.get ("utildir", "util")
 EXEEXT = os.environ.get ("EXEEXT", "")
 
@@ -30,7 +30,7 @@
 args = sys.argv[1:]
 
 if not os.path.exists (hb_shape):
-	if len (sys.argv) == 1 or not os.path.exists (sys.argv[1]):
+	if len (sys.argv) == 1 or sys.argv[1].find('hb-shape') == -1 or not os.path.exists (sys.argv[1]):
 		print ("""Failed to find hb-shape binary automatically,
 please provide it as the first argument to the tool""")
 		sys.exit (1)