diff --git a/tests/jcdb/oracle/subdir.err b/tests/jcdb/oracle/subdir.err
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/jcdb/oracle/subdir.res b/tests/jcdb/oracle/subdir.res
new file mode 100644
index 0000000000000000000000000000000000000000..db55f314d60304947e9a79782ccf41d22e986345
--- /dev/null
+++ b/tests/jcdb/oracle/subdir.res
@@ -0,0 +1 @@
+[kernel] Parsing PWD/../subdir.c (with preprocessing)
diff --git a/tests/jcdb/subdir.c b/tests/jcdb/subdir.c
new file mode 100644
index 0000000000000000000000000000000000000000..1729358186a7ea3555027ab353b3194e7a8692e5
--- /dev/null
+++ b/tests/jcdb/subdir.c
@@ -0,0 +1,13 @@
+/* run.config
+   NOFRAMAC:
+   EXECNOW: LOG subdir.res LOG subdir.err (cd @PTEST_DIR@/subdir1 && @frama-c@ -add-symbolic-path $PWD/..:PWD/.. -json-compilation-database ../subdir.json ../subdir.c) > @PTEST_RESULT@/subdir.res 2> @PTEST_RESULT@/subdir.err
+*/
+
+// this test must be run with PWD in subdir1
+#include "subdir1/header.h"
+#include "included.h" // in subdir2, via '-Isubdir2' in subdir.json
+#include "__fc_builtin.h" // to check that Frama-C's libc is correctly included
+
+int main() {
+  return ONE + TWO;
+}
diff --git a/tests/jcdb/subdir.json b/tests/jcdb/subdir.json
new file mode 100644
index 0000000000000000000000000000000000000000..4748ff19e6500726a0ab91d0f533d65b62607f13
--- /dev/null
+++ b/tests/jcdb/subdir.json
@@ -0,0 +1,6 @@
+[
+    { "directory": ".",
+      "command": "g++ -Isubdir2",
+      "file": "subdir.c"
+    }
+]
diff --git a/tests/jcdb/subdir1/header.h b/tests/jcdb/subdir1/header.h
new file mode 100644
index 0000000000000000000000000000000000000000..f01809a81bd36dc763f39331fbce25d55b2d5651
--- /dev/null
+++ b/tests/jcdb/subdir1/header.h
@@ -0,0 +1 @@
+#define ONE 1
diff --git a/tests/jcdb/subdir2/included.h b/tests/jcdb/subdir2/included.h
new file mode 100644
index 0000000000000000000000000000000000000000..80ba189555ec881b79013d40798117477b1086d0
--- /dev/null
+++ b/tests/jcdb/subdir2/included.h
@@ -0,0 +1,3 @@
+// to be included by subdir.c
+
+#define TWO 2