Skip to content

Commit

Permalink
Add output dir and tables in zulip notification
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom authored and zapashcanon committed Aug 3, 2024
1 parent 9888171 commit 55f7fa8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
25 changes: 25 additions & 0 deletions bench/report/runs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,31 @@ let pp_quick_results fmt results =
"Nothing: %6i Reached: %6i Timeout: %6i Other: %6i Killed: %6i"
!nothing !reached !timeout !other !killed

let pp_table_results fmt results =
let nothing = count_nothing results in
let reached = count_reached results in
let timeout = count_timeout results in
let other = count_other results in
let killed = count_killed results in
let total = count_all results in
Format.fprintf fmt
"| Nothing | Reached | Timeout | Other | Killed | Total |@\n\
|:-------:|:-------:|:-------:|:-----:|:------:|:-----:|@\n\
| %6i | %6i | %6i | %6i | %6i | %6i |" nothing reached timeout other killed
total

let pp_table_statistics fmt results =
let total = sum_clock results in
let mean = mean_clock results in
let median = median_clock results in
let min = min_clock results in
let max = max_clock results in
Format.fprintf fmt
"| Total | Mean | Median | Min | Max |@\n\
|:-----:|:----:|:------:|:---:|:---:|@\n\
| %0.2f | %0.2f | %0.2f | %0.2f | %0.2f |@\n"
total mean median min max

let map = List.map

let files = List.map (fun run -> run.Run.file)
4 changes: 4 additions & 0 deletions bench/report/runs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ val to_distribution : max_time:int -> t -> float list

val pp_quick_results : Format.formatter -> t -> unit

val pp_table_results : Format.formatter -> t -> unit

val pp_table_statistics : Format.formatter -> t -> unit

val map : (Run.t -> 'a) -> t -> 'a list

val files : t -> Fpath.t list
20 changes: 16 additions & 4 deletions bench/testcomp/testcomp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ let notify_finished runs =
let headers =
let headers = Header.init () in
Header.add_list headers
[ ("Content-type", "application/json"); ("User-Agent", "Owibot/1.0") ]
[ ("Content-type", "application/json"); ("User-Agent", "Owibot/1.1") ]
in
let send url body =
let body = Cohttp_lwt.Body.of_string (Yojson.to_string body) in
Expand All @@ -172,9 +172,21 @@ let notify_finished runs =
"unknown"
in
let text =
Format.asprintf "Using tool=*%s* and timeout=*%F*@\n@\n%a@."
(Tool.to_reference_name tool)
timeout Report.Runs.pp_quick_results runs
Format.asprintf
"@[<v>Using:@;\
- Tool: `%s`@;\
- Timeout: `%F`@;\
- Output dir: `%a`@]@\n\
@\n\
Results:@\n\
@\n\
%a@\n\
@\n\
Time stats (in seconds):@\n\
@\n\
%a@."
reference_name timeout Fpath.pp output_dir Report.Runs.pp_table_results
runs Report.Runs.pp_table_statistics runs
in
(* Notify on `ZULIP_WEBHOOK` *)
match Bos.OS.Env.var "ZULIP_WEBHOOK" with
Expand Down

0 comments on commit 55f7fa8

Please sign in to comment.