diff --git a/src/kernel_services/ast_queries/file.ml b/src/kernel_services/ast_queries/file.ml
index 7c3f748eae65e7986d9c6fff548a84fe03c7b03b..63f07080b6ada3d40158adf4591e9fa4e25e269b 100644
--- a/src/kernel_services/ast_queries/file.ml
+++ b/src/kernel_services/ast_queries/file.ml
@@ -1697,14 +1697,40 @@ let source_hashes_of_json path =
       (Yojson.Basic.pretty_to_string v)
 
 let check_source_hashes expected actual_table =
-  Hashtbl.iter (fun fp hash ->
-      let fp = Filepath.Normalized.to_pretty_string fp in
-      let expected_hash = List.assoc_opt fp expected in
-      if Some hash <> expected_hash then
+  let checked, diffs =
+    Hashtbl.fold (fun fp hash (acc_checked, acc_diffs) ->
+        let fp = Filepath.Normalized.to_pretty_string fp in
+        let expected_hash = List.assoc_opt fp expected in
+        let checked = Datatype.String.Set.add fp acc_checked in
+        let diffs =
+          if Some hash = expected_hash then acc_diffs
+          else (fp, hash, expected_hash) :: acc_diffs
+        in
+        checked, diffs
+      ) actual_table (Datatype.String.Set.empty, [])
+  in
+  if diffs <> [] then begin
+    let diffs =
+      List.sort (fun (fp1, _, _) (fp2, _, _) ->
+          Extlib.compare_ignore_case fp1 fp2) diffs
+    in
+    List.iter (fun (fp, got, expected) ->
         Kernel.warning ~wkey:Kernel.wkey_audit
           "different hashes for %s: got %s, expected %s"
-          fp hash (Option.value ~default:("<none> (not in list)") expected_hash)
-    ) actual_table
+          fp got (Option.value ~default:("<none> (not in list)") expected)
+      ) diffs
+  end;
+  let expected_names = List.map fst expected in
+  let missing =
+    List.filter (fun fp -> not (Datatype.String.Set.mem fp checked))
+      expected_names
+  in
+  if missing <> [] then begin
+    let missing = List.sort Extlib.compare_ignore_case missing in
+    Kernel.warning ~wkey:Kernel.wkey_audit
+      "missing hashes for files:@\n%a"
+      (Pretty_utils.pp_list ~sep:"@\n" Format.pp_print_string) missing
+  end
 
 let print_and_exit cpp_commands =
   let print_cpp_cmd (cpp_cmd, _ppf, _) =
diff --git a/tests/value/audit-in.json b/tests/value/audit-in.json
index fc5e7af05417895b5f8bee995705938eec008b85..d6abf18d0ffb9f05e82b0d158058b8715f36f417 100644
--- a/tests/value/audit-in.json
+++ b/tests/value/audit-in.json
@@ -1,7 +1,8 @@
 {
   "sources": {
-    "tests/value/audit.c": "4574f9d5090319c57dab0c9cb81fda32",
-    "tests/value/audit_included.h": "6164442da331e54680e25ff2fe1ba74e"
+    "tests/value/audit.c": "01010101010101010101010101010101",
+    "tests/value/audit_included.h": "c2cc488143a476f69cf2ed04c3439e6e",
+    "tests/value/non_existing_file.h": "1234567890abcdef1234567890abcdef"
   },
   "kernel": {
     "warning-categories": {
@@ -73,4 +74,4 @@
       ]
     }
   }
-}
\ No newline at end of file
+}
diff --git a/tests/value/audit.c b/tests/value/audit.c
index 952edfab1ee28647cd3c00a9af19b4e89cee5381..7b3e27c0eb13ce8bf3de6099b21131006f9de2be 100644
--- a/tests/value/audit.c
+++ b/tests/value/audit.c
@@ -1,9 +1,10 @@
 /* run.config
    LOG: audit-out.json
-   STDOPT: #"-audit-check @PTEST_DIR@/audit-in.json -audit-prepare @PTEST_DIR@/result/audit-out.json"
+   STDOPT: #"-audit-check @PTEST_DIR@/audit-in.json -audit-prepare @PTEST_DIR@/result/audit-out.json -kernel-warn-key audit=active"
 */
 
 #include "audit_included.h"
+#include "audit_included_but_not_listed.h"
 
 void main() {
   float f = 2.1; // to trigger a syntactic warning
diff --git a/tests/value/audit_included.h b/tests/value/audit_included.h
index 0db378b820af41b54a597cf75f314a96921ec182..d4b481cc2ee4f9d292b6ea835cb8d09ef16780b7 100644
--- a/tests/value/audit_included.h
+++ b/tests/value/audit_included.h
@@ -1 +1 @@
-// This file is included by audit.i
+// This file is included by audit.c
diff --git a/tests/value/audit_included_but_not_listed.h b/tests/value/audit_included_but_not_listed.h
new file mode 100644
index 0000000000000000000000000000000000000000..d4b481cc2ee4f9d292b6ea835cb8d09ef16780b7
--- /dev/null
+++ b/tests/value/audit_included_but_not_listed.h
@@ -0,0 +1 @@
+// This file is included by audit.c
diff --git a/tests/value/oracle/audit-out.json b/tests/value/oracle/audit-out.json
index e12d53d0b0ea6c7d9221b84725499a38ed921dcf..f9aa254ce113486f162682dd6cebdc83f2a6768d 100644
--- a/tests/value/oracle/audit-out.json
+++ b/tests/value/oracle/audit-out.json
@@ -70,7 +70,9 @@
     }
   },
   "sources": {
-    "tests/value/audit.c": "d91c35d6c3eb02ede2ca2bdf92fda63d",
-    "tests/value/audit_included.h": "6164442da331e54680e25ff2fe1ba74e"
+    "tests/value/audit.c": "08f73691217888d926a0ee15cbe18159",
+    "tests/value/audit_included.h": "c2cc488143a476f69cf2ed04c3439e6e",
+    "tests/value/audit_included_but_not_listed.h":
+      "c2cc488143a476f69cf2ed04c3439e6e"
   }
 }
diff --git a/tests/value/oracle/audit.res.oracle b/tests/value/oracle/audit.res.oracle
index c599da1fc5ff4eba68a4e7b9449b747bb9dba689..8cb4e84028b629e4a6cc65903cc1a19329956380 100644
--- a/tests/value/oracle/audit.res.oracle
+++ b/tests/value/oracle/audit.res.oracle
@@ -1,8 +1,13 @@
 [kernel:audit] Warning: 
-  different hashes for tests/value/audit.c: got d91c35d6c3eb02ede2ca2bdf92fda63d, expected 4574f9d5090319c57dab0c9cb81fda32
+  different hashes for tests/value/audit.c: got 08f73691217888d926a0ee15cbe18159, expected 01010101010101010101010101010101
+[kernel:audit] Warning: 
+  different hashes for tests/value/audit_included_but_not_listed.h: got c2cc488143a476f69cf2ed04c3439e6e, expected <none> (not in list)
+[kernel:audit] Warning: 
+  missing hashes for files:
+  tests/value/non_existing_file.h
 [kernel] Audit: sources list written to: tests/value/result/audit-out.json
 [kernel] Parsing tests/value/audit.c (with preprocessing)
-[kernel:parser:decimal-float] tests/value/audit.c:9: Warning: 
+[kernel:parser:decimal-float] tests/value/audit.c:10: Warning: 
   Floating-point constant 2.1 is not represented exactly. Will use 0x1.0cccccccccccdp1.
   (warn-once: no further messages from category 'parser:decimal-float' will be emitted)
 [eva] Analyzing a complete application starting at main