Skip to content

Commit

Permalink
Restore cropping cache, heap_mbytes for behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
xvw committed Mar 4, 2024
1 parent 5081e21 commit cebb853
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
5 changes: 4 additions & 1 deletion lib/backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ let behavior config =
List.map
(fun resp ->
Merlin.Response.(
strip_file @@ crop_arbitrary_keys [ "timing" ] resp))
strip_file
@@ crop_arbitrary_keys
[ "timing"; "cache"; "heap_mbytes" ]
resp))
responses
in
{ Query_response.sample_id = id; cmd; responses }
Expand Down
24 changes: 12 additions & 12 deletions test/behavior.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

(* FIXME: This is a problem in all tests: The build artefacts aren't found.*)
$ cat test-data/full_responses.json | sed "/No config found for file/d"
{"sample_id":12,"cmd":" ocamlmerlin server locate -look-for ml -position '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":{"file":"stdlib.ml","pos":{"line":94,"col":0}},"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":{"reused":1,"typed":1},"cmt":{"hit":2,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":12}]}
{"sample_id":11,"cmd":"ocamlmerlin server expand-prefix -prefix '( +' -position '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":{"entries":[{"name":"()","kind":"Constructor","desc":"","info":"","deprecated":false}],"context":null},"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":"miss","cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":11}]}
{"sample_id":10,"cmd":"ocamlmerlin server complete-prefix -prefix '( +' -position '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":{"entries":[],"context":["application",{"argument_type":"'a","labels":[]}]},"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":"miss","cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":10}]}
{"sample_id":9,"cmd":"ocamlmerlin server occurrences -identifier-at '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":12},"end":{"line":3,"col":13}}],"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":{"reused":2,"typed":0},"cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":9}]}
{"sample_id":8,"cmd":"ocamlmerlin server type-enclosing -position '1:8' -index 0 -filename test1.ml < test1.ml","responses":[{"class":"return","value":[{"start":{"line":1,"col":8},"end":{"line":1,"col":9},"type":"int","tail":"no"}],"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":{"reused":2,"typed":0},"cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":8}]}
{"sample_id":7,"cmd":"ocamlmerlin server case-analysis -start '1:8' -end '1:8' -filename test1.ml < test1.ml","responses":[{"class":"return","value":[{"start":{"line":1,"col":8},"end":{"line":1,"col":9}},"match 1 with | 0 -> _ | _ -> _"],"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":"miss","cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":7}]}
{"sample_id":5,"cmd":" ocamlmerlin server locate -look-for ml -position '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":{"file":"stdlib.ml","pos":{"line":94,"col":0}},"notifications":[],"heap_mbytes":4,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":{"reused":1,"typed":1},"cmt":{"hit":1,"miss":1},"cmi":{"hit":1,"miss":0}},"query_num":5}]}
{"sample_id":4,"cmd":"ocamlmerlin server expand-prefix -prefix '( +' -position '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":{"entries":[{"name":"()","kind":"Constructor","desc":"","info":"","deprecated":false}],"context":null},"notifications":[],"heap_mbytes":1,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":"miss","cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":4}]}
{"sample_id":3,"cmd":"ocamlmerlin server complete-prefix -prefix '( +' -position '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":{"entries":[],"context":["application",{"argument_type":"'a","labels":[]}]},"notifications":[],"heap_mbytes":1,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":"miss","cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":3}]}
{"sample_id":2,"cmd":"ocamlmerlin server occurrences -identifier-at '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":12},"end":{"line":3,"col":13}}],"notifications":[],"heap_mbytes":1,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":{"reused":2,"typed":0},"cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":2}]}
{"sample_id":1,"cmd":"ocamlmerlin server type-enclosing -position '3:12' -index 0 -filename test.ml < test.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":12},"end":{"line":3,"col":13},"type":"int -> int -> int","tail":"no"},{"start":{"line":3,"col":12},"end":{"line":3,"col":13},"type":1,"tail":"no"},{"start":{"line":3,"col":10},"end":{"line":3,"col":15},"type":2,"tail":"no"},{"start":{"line":3,"col":6},"end":{"line":3,"col":15},"type":3,"tail":"no"}],"notifications":[],"heap_mbytes":1,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":{"reused":2,"typed":0},"cmt":{"hit":0,"miss":0},"cmi":{"hit":1,"miss":0}},"query_num":1}]}
{"sample_id":0,"cmd":"ocamlmerlin server case-analysis -start '3:14' -end '3:14' -filename test.ml < test.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":14},"end":{"line":3,"col":15}},"(match 3 with | 0 -> _ | _ -> _)"],"notifications":[],"heap_mbytes":1,"cache":{"reader_phase":"miss","ppx_phase":"miss","typer":"miss","cmt":{"hit":0,"miss":0},"cmi":{"hit":0,"miss":1}},"query_num":0}]}
{"sample_id":12,"cmd":" ocamlmerlin server locate -look-for ml -position '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":{"file":"stdlib.ml","pos":{"line":94,"col":0}},"notifications":[],"query_num":12}]}
{"sample_id":11,"cmd":"ocamlmerlin server expand-prefix -prefix '( +' -position '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":{"entries":[{"name":"()","kind":"Constructor","desc":"","info":"","deprecated":false}],"context":null},"notifications":[],"query_num":11}]}
{"sample_id":10,"cmd":"ocamlmerlin server complete-prefix -prefix '( +' -position '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":{"entries":[],"context":["application",{"argument_type":"'a","labels":[]}]},"notifications":[],"query_num":10}]}
{"sample_id":9,"cmd":"ocamlmerlin server occurrences -identifier-at '3:12' -filename test1.ml < test1.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":12},"end":{"line":3,"col":13}}],"notifications":[],"query_num":9}]}
{"sample_id":8,"cmd":"ocamlmerlin server type-enclosing -position '1:8' -index 0 -filename test1.ml < test1.ml","responses":[{"class":"return","value":[{"start":{"line":1,"col":8},"end":{"line":1,"col":9},"type":"int","tail":"no"}],"notifications":[],"query_num":8}]}
{"sample_id":7,"cmd":"ocamlmerlin server case-analysis -start '1:8' -end '1:8' -filename test1.ml < test1.ml","responses":[{"class":"return","value":[{"start":{"line":1,"col":8},"end":{"line":1,"col":9}},"match 1 with | 0 -> _ | _ -> _"],"notifications":[],"query_num":7}]}
{"sample_id":5,"cmd":" ocamlmerlin server locate -look-for ml -position '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":{"file":"stdlib.ml","pos":{"line":94,"col":0}},"notifications":[],"query_num":5}]}
{"sample_id":4,"cmd":"ocamlmerlin server expand-prefix -prefix '( +' -position '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":{"entries":[{"name":"()","kind":"Constructor","desc":"","info":"","deprecated":false}],"context":null},"notifications":[],"query_num":4}]}
{"sample_id":3,"cmd":"ocamlmerlin server complete-prefix -prefix '( +' -position '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":{"entries":[],"context":["application",{"argument_type":"'a","labels":[]}]},"notifications":[],"query_num":3}]}
{"sample_id":2,"cmd":"ocamlmerlin server occurrences -identifier-at '3:12' -filename test.ml < test.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":12},"end":{"line":3,"col":13}}],"notifications":[],"query_num":2}]}
{"sample_id":1,"cmd":"ocamlmerlin server type-enclosing -position '3:12' -index 0 -filename test.ml < test.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":12},"end":{"line":3,"col":13},"type":"int -> int -> int","tail":"no"},{"start":{"line":3,"col":12},"end":{"line":3,"col":13},"type":1,"tail":"no"},{"start":{"line":3,"col":10},"end":{"line":3,"col":15},"type":2,"tail":"no"},{"start":{"line":3,"col":6},"end":{"line":3,"col":15},"type":3,"tail":"no"}],"notifications":[],"query_num":1}]}
{"sample_id":0,"cmd":"ocamlmerlin server case-analysis -start '3:14' -end '3:14' -filename test.ml < test.ml","responses":[{"class":"return","value":[{"start":{"line":3,"col":14},"end":{"line":3,"col":15}},"(match 3 with | 0 -> _ | _ -> _)"],"notifications":[],"query_num":0}]}

0 comments on commit cebb853

Please sign in to comment.