diff --git a/Makefile b/Makefile
index 299b6e9b1b707bbf22565f3669132113159e1024..3a1ecb6829e81e41277a83940555829727fc11c3 100644
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,10 @@ goatherd: goatherd.go
 	go build goatherd.go
 
 test_pg: goatherd.go goatherd_test.go test_pg.sh goatherd
-	sh test_pg.sh --start-pg
+	sh test_pg.sh
 
 test_pam_goatherd: goatherd pam_goatherd.so test_pam_goatherd.sh
-	sh test_pam_goatherd.sh --start-pg
+	sh test_pam_goatherd.sh
 
 test: test_pg test_pam_goatherd
 
diff --git a/test_pam_goatherd.sh b/test_pam_goatherd.sh
index 468ea7b1bbfc0e28c035c28910fb23f0d82f88b9..0550324fbfdf3993e97befc6582946f0abaec246 100644
--- a/test_pam_goatherd.sh
+++ b/test_pam_goatherd.sh
@@ -4,7 +4,7 @@ set -eu
 
 PAMWRAPPER=/usr/lib/x86_64-linux-gnu/libpam_wrapper.so
 
-if [ "${1:-x}" = "--start-pg" ]; then
+if [ "${DB_URL:-x}" = "x" ]; then
     export PGHOST="$PWD/pg_pam_test"
     . ./start_pg.sh
     export DB_URL="host=$PGHOST"
diff --git a/test_pg.sh b/test_pg.sh
index 19bf202489dce4fa64f6cc14c2b6c21debe058ab..008df83da99162542c8e9cd8bb7bf8d3b3f77294 100644
--- a/test_pg.sh
+++ b/test_pg.sh
@@ -4,8 +4,7 @@ set -eu
 
 go test -c -o ./goatherd.test &
 
-if [ "${1:-x}" = "--start-pg" ]; then
-    shift
+if [ "${DB_URL:-x}" = "x" ]; then
     PGHOST="$PWD/postgres_test"
     if [ $# -ge 1 ]; then
         PGHOST="$(realpath -- "$1")"