diff --git a/tests/dune b/tests/dune
new file mode 100644
index 0000000000000000000000000000000000000000..0f0ac396c805659ea8c811f1f7039012aa1ead79
--- /dev/null
+++ b/tests/dune
@@ -0,0 +1,3 @@
+(rule
+ (target "path-to-wp-cache")
+ (action (run %{dep:./set-path-to-wp-cache.sh})))
diff --git a/tests/set-path-to-wp-cache.sh b/tests/set-path-to-wp-cache.sh
new file mode 100755
index 0000000000000000000000000000000000000000..faea381a0bcff338ec445de9c451e3f6df85a8ce
--- /dev/null
+++ b/tests/set-path-to-wp-cache.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+pwd -P | sed 's:\(.*\)/_build/[^/]*\(/.*$\):\1\2/wp-cache:' > path-to-wp-cache
+echo "MetaACSL: using WP cache dir:"
+cat path-to-wp-cache
diff --git a/tests/test_config b/tests/test_config
index 213b04dd4df3abcec23faa64891f2a7406ad1e0f..5aa5875b38f0e6cd94a0923b5e501b3b484a44c3 100644
--- a/tests/test_config
+++ b/tests/test_config
@@ -1,5 +1,9 @@
+# note: the file @WP_CACHE@ must contain an absolute path to the source
+#       worktree 'tests/wp-cache'. This is done in a rule of 'tests/dune' file.
+MACRO: WP_CACHE ../../../tests/path-to-wp-cache
+
 MACRO: META -meta
-MACRO: WP -then-last -wp -wp-timeout 1 -wp-par 1 -wp-msg-key shell  -wp-cache update -wp-session @PTEST_SUITE_DIR@/../wp-cache
+MACRO: WP -then-last -wp -wp-timeout 1 -wp-par 1 -wp-msg-key shell  -wp-cache update -wp-session=%{read:@WP_CACHE@}
 MACRO: PRINT -then-last -print
 
 MACRO: EVA_PLUGINS eva,scope,inout variadic