Skip to content

Commit

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

let pp_table fmt results =
let nothing = ref 0 in
let reached = ref 0 in
let timeout = ref 0 in
let killed = ref 0 in
let other = ref 0 in
List.iter
(fun result ->
match result.Run.res with
| Nothing _ -> incr nothing
| Reached _ -> incr reached
| Timeout _ -> incr timeout
| Signaled _ | Stopped _ -> incr killed
| Other _ -> incr other )
results;
Format.fprintf fmt
"| Nothing | Reached | Timeout | Other | Killed |@\n\
|:-------:|:-------:|:-------:|:-----:|:------:|@\n\
| %6i | %6i | %6i | %6i | %6i |" !nothing !reached !timeout !other !killed

let map = List.map

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

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

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

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

val files : t -> Fpath.t list
15 changes: 11 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,16 @@ 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@."
reference_name timeout Fpath.pp output_dir Report.Runs.pp_table runs
in
(* Notify on `ZULIP_WEBHOOK` *)
match Bos.OS.Env.var "ZULIP_WEBHOOK" with
Expand Down

0 comments on commit 1f4604c

Please sign in to comment.