diff --git a/tezt/lib_tezos/accuser.ml b/tezt/lib_tezos/accuser.ml index c07798c38bb20bb6b70e31baf9d9e1445d249622..5140b8257269dceaed0237b0a71371b6aa1c242f 100644 --- a/tezt/lib_tezos/accuser.ml +++ b/tezt/lib_tezos/accuser.ml @@ -60,15 +60,15 @@ let set_ready accuser = let handle_raw_stdout accuser line = if line =~ rex "^Waiting for protocol .+ to start...$" then set_ready accuser -let create ~protocol ?name ?color ?event_pipe ?base_dir ?runner - ?preserved_levels node = +let create ~protocol ?(path = Uses.path (Protocol.accuser protocol)) ?name + ?color ?event_pipe ?base_dir ?runner ?preserved_levels node = let name = match name with None -> fresh_name () | Some name -> name in let base_dir = match base_dir with None -> Temp.dir name | Some dir -> dir in let accuser = create - ~path:(Uses.path (Protocol.accuser protocol)) + ~path ?name:(Some name) ?color ?event_pipe @@ -126,11 +126,12 @@ let wait_for_ready accuser = resolver :: accuser.persistent_state.pending_ready ; check_event accuser "Accuser started." promise -let init ~protocol ?name ?color ?event_pipe ?event_level ?base_dir ?runner +let init ~protocol ?path ?name ?color ?event_pipe ?event_level ?base_dir ?runner ?preserved_levels node = let* () = Node.wait_for_ready node in let accuser = create + ?path ~protocol ?name ?color diff --git a/tezt/lib_tezos/accuser.mli b/tezt/lib_tezos/accuser.mli index 5e8caa304f4dfa446889f9a3f607c837ea2f1b1f..46a0d4b2ba5b87ce0cd089c496c8c8c51fc7eddb 100644 --- a/tezt/lib_tezos/accuser.mli +++ b/tezt/lib_tezos/accuser.mli @@ -35,7 +35,8 @@ type event = {name : string; value : JSON.t; timestamp : float} This function just creates the [t] value, it does not call [run]. - The path to accuser binary is chosen from the [protocol]. + [path] provides the path to the accuser binary, the default being the one + derived from the [protocol]. The standard output and standard error output of the accuser will be logged with prefix [name] and color [color]. @@ -58,6 +59,7 @@ type event = {name : string; value : JSON.t; timestamp : float} memory*) val create : protocol:Protocol.t -> + ?path:string -> ?name:string -> ?color:Log.Color.t -> ?event_pipe:string -> @@ -132,7 +134,8 @@ val log_events : ?max_length:int -> t -> unit does not want to wait for the node to be ready, it is necessary to use [create] and then [run]. - The path to accuser binary is chosen from the [protocol]. + [path] is the path to accuser binary. By default, it is chosen + from the [protocol] and is assumed to be at the root. The standard output and standard error output of the accuser will be logged with prefix [name] and color [color]. @@ -158,6 +161,7 @@ val log_events : ?max_length:int -> t -> unit memory *) val init : protocol:Protocol.t -> + ?path:string -> ?name:string -> ?color:Log.Color.t -> ?event_pipe:string -> diff --git a/tezt/tests/cloud/tezos.ml b/tezt/tests/cloud/tezos.ml index bb1a705c7744b8dafd48facfc5dd015cb84c3792..fda5bf90c29dab12dd4bf78ae591878177258e4b 100644 --- a/tezt/tests/cloud/tezos.ml +++ b/tezt/tests/cloud/tezos.ml @@ -285,6 +285,18 @@ module Baker = struct end end +module Accuser = struct + include Accuser + + module Agent = struct + let init ?name ~protocol ?(path = Uses.path (Protocol.accuser protocol)) + node agent = + let* path = Agent.copy agent ~source:path in + let runner = Agent.runner agent in + init ?name ~event_level:`Notice ?runner ~path ~protocol node + end +end + module Teztale = struct include Teztale