--- a/tests/libzscanner/test_zscanner.in
+++ b/tests/libzscanner/test_zscanner.in
@@ -3,16 +3,15 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # For more information, see <https://www.knot-dns.cz/>
 
-SOURCE=@top_srcdir@/tests/libzscanner
-BUILD=@top_builddir@/tests/libzscanner
+SOURCE="."
+BUILD="/tmp/knot-test"
+mkdir -p "$BUILD"
 
-. @top_srcdir@/tests/tap/libtap.sh
-
-cd "$BUILD"
+. ../tap/libtap.sh
 
 TMPDIR=$(test_tmpdir)
 TESTS_DIR="$SOURCE"/data
-ZSCANNER_TOOL="$BUILD"/zscanner-tool
+ZSCANNER_TOOL="$SOURCE"/zscanner-tool
 
 plan 90
 
