Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output dir and table in zulip notification #395

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading