From bcd362f5454c45d596ebeb7f84033b3d04abeeec Mon Sep 17 00:00:00 2001 From: Andre Maroneze <andre.maroneze@cea.fr> Date: Thu, 3 Dec 2020 14:59:33 +0100 Subject: [PATCH] [Metrics] ensure JSON output terminates with a newline --- src/plugins/metrics/metrics_cilast.ml | 3 ++- tests/metrics/oracle/libc.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/metrics/metrics_cilast.ml b/src/plugins/metrics/metrics_cilast.ml index 8c737e2c13e..bbc73b7f5df 100644 --- a/src/plugins/metrics/metrics_cilast.ml +++ b/src/plugins/metrics/metrics_cilast.ml @@ -745,7 +745,8 @@ let compute_on_cilast ~libc = | Text -> pp_with_funinfo fmt cil_visitor | Json -> let json = json_of_funinfo cil_visitor in - Yojson.pretty_print fmt json + Yojson.pretty_print fmt json; + Format.fprintf fmt "@." (* ensure the file ends with a newline *) ); close_out oc; with Sys_error _ -> diff --git a/tests/metrics/oracle/libc.json b/tests/metrics/oracle/libc.json index 5f7f5afbe20..beaef667824 100644 --- a/tests/metrics/oracle/libc.json +++ b/tests/metrics/oracle/libc.json @@ -138,4 +138,4 @@ "__fc_stdout", "__fc_ttyname", "optarg", "opterr", "optind", "optopt" ], "entry-points": [ "f", "main" ] -} \ No newline at end of file +} -- GitLab