QEMU/KVM virtual machine management via QMP
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): remove redundant function prefixes (E331)

Strip get_/make_/find_/create_ from 138 function definitions and all
call sites across ocaml-pds, ocaml-pid1, ocaml-precommit,
ocaml-publicsuffix, ocaml-qemu, ocaml-requests, ocaml-retry, and
ocaml-rpmsg. Use Module.v for constructors per the E331 convention.

+163 -98
+65
lib/qmp_protocol.mli
··· 11 11 type t = { qemu : qemu; package : string } 12 12 13 13 val make : int -> int -> int -> string -> t 14 + (** [make major minor micro package] creates a version. *) 15 + 14 16 val jsont : t Jsont.t 17 + (** JSON codec. *) 18 + 15 19 val pp : Format.formatter -> t -> unit 20 + (** Pretty printer. *) 16 21 end 17 22 18 23 module Greeting : sig 19 24 type t 20 25 21 26 val jsont : t Jsont.t 27 + (** JSON codec. *) 28 + 22 29 val version : t -> Version.t 30 + (** QEMU version from greeting. *) 31 + 23 32 val capabilities : t -> string list 33 + (** Supported QMP capabilities. *) 24 34 end 25 35 26 36 module Timestamp : sig 27 37 type t = { seconds : int; microseconds : int } 28 38 29 39 val jsont : t Jsont.t 40 + (** JSON codec. *) 41 + 30 42 val to_float : t -> float 43 + (** Convert to seconds as a float. *) 31 44 end 32 45 33 46 module Error : sig 34 47 type t = { class_ : string; desc : string } 35 48 36 49 val jsont : t Jsont.t 50 + (** JSON codec. *) 51 + 37 52 val pp : Format.formatter -> t -> unit 53 + (** Pretty printer. *) 38 54 end 39 55 40 56 module Event : sig 41 57 type t 42 58 43 59 val jsont : t Jsont.t 60 + (** JSON codec. *) 61 + 44 62 val name : t -> string 63 + (** Event name. *) 64 + 45 65 val data : t -> Jsont.json option 66 + (** Event payload, if any. *) 67 + 46 68 val timestamp : t -> float 69 + (** Event timestamp in seconds. *) 47 70 end 48 71 49 72 (** {1 Commands} *) ··· 52 75 type t 53 76 54 77 val make : ?arguments:Jsont.json -> ?id:string -> string -> t 78 + (** [make ?arguments ?id name] creates a QMP command. *) 79 + 55 80 val jsont : t Jsont.t 81 + (** JSON codec. *) 82 + 56 83 val to_json : t -> Jsont.json 84 + (** Encode command as JSON. *) 57 85 58 86 (** {2 Common Commands} *) 59 87 60 88 val qmp_capabilities : t 89 + 61 90 val quit : t 91 + (** Quit QEMU. *) 92 + 62 93 val stop : t 94 + (** Pause execution. *) 95 + 63 96 val cont : t 97 + (** Resume execution. *) 98 + 64 99 val system_powerdown : t 100 + (** Send ACPI power button event. *) 101 + 65 102 val system_reset : t 103 + (** Reset the VM. *) 104 + 66 105 val query_status : t 106 + (** Query run state. *) 107 + 67 108 val query_version : t 109 + (** Query QEMU version. *) 110 + 68 111 val query_kvm : t 112 + (** Query KVM support. *) 113 + 69 114 val query_cpus : t 115 + (** Query CPU information. *) 116 + 70 117 val query_block : t 118 + (** Query block devices. *) 119 + 71 120 val query_blockstats : t 121 + (** Query block device statistics. *) 72 122 end 73 123 74 124 module Response : sig ··· 77 127 type t = Success of success | Error of error_response 78 128 79 129 val success_jsont : success Jsont.t 130 + (** JSON codec for success responses. *) 131 + 80 132 val error_jsont : error_response Jsont.t 133 + (** JSON codec for error responses. *) 81 134 end 82 135 83 136 (** {1 Message parsing} *) ··· 90 143 | Error of Response.error_response 91 144 92 145 val of_json : Jsont.json -> (t, string) result 146 + (** Parse a QMP message from JSON. *) 147 + 93 148 val of_string : string -> (t, string) result 149 + (** Parse a QMP message from a JSON string. *) 94 150 end 95 151 96 152 (** {1 Status types} *) ··· 117 173 type t = { running : bool; singlestep : bool; status : run_state } 118 174 119 175 val run_state_of_string : string -> run_state option 176 + (** Parse a run state from its string representation. *) 177 + 120 178 val string_of_run_state : run_state -> string 179 + (** Convert a run state to its string representation. *) 180 + 121 181 val jsont : t Jsont.t 182 + (** JSON codec. *) 183 + 122 184 val of_json : Jsont.json -> (t, string) result 185 + (** Parse status from JSON. *) 186 + 123 187 val pp : Format.formatter -> t -> unit 188 + (** Pretty printer. *) 124 189 end
+6 -7
lib/vm.ml
··· 361 361 Ok () 362 362 | Error e -> Error e) 363 363 364 - let get_conn t = 365 - match t.conn with Some c -> Ok c | None -> Error "Not connected" 364 + let conn t = match t.conn with Some c -> Ok c | None -> Error "Not connected" 366 365 367 366 let query_status t = 368 - match get_conn t with 367 + match conn t with 369 368 | Error e -> Error e 370 369 | Ok conn -> ( 371 370 match Connection.execute conn Qmp_protocol.Command.query_status with ··· 377 376 | Error e -> Error (Fmt.str "Failed to parse status: %s" e))) 378 377 379 378 let stop t = 380 - match get_conn t with 379 + match conn t with 381 380 | Error e -> Error e 382 381 | Ok conn -> ( 383 382 match Connection.execute conn Qmp_protocol.Command.stop with ··· 386 385 | Ok (Ok _) -> Ok ()) 387 386 388 387 let cont t = 389 - match get_conn t with 388 + match conn t with 390 389 | Error e -> Error e 391 390 | Ok conn -> ( 392 391 match Connection.execute conn Qmp_protocol.Command.cont with ··· 395 394 | Ok (Ok _) -> Ok ()) 396 395 397 396 let shutdown t = 398 - match get_conn t with 397 + match conn t with 399 398 | Error e -> Error e 400 399 | Ok conn -> ( 401 400 match Connection.execute conn Qmp_protocol.Command.system_powerdown with ··· 404 403 | Ok (Ok _) -> Ok ()) 405 404 406 405 let quit t = 407 - match get_conn t with 406 + match conn t with 408 407 | Error e -> Error e 409 408 | Ok conn -> ( 410 409 match Connection.execute conn Qmp_protocol.Command.quit with
+30
lib/vm.mli
··· 48 48 arm64, KVM on Linux x86_64). *) 49 49 50 50 val with_arch : arch -> t -> t 51 + (** Set CPU architecture. *) 52 + 51 53 val with_accel : accel -> t -> t 54 + (** Set hardware acceleration. *) 55 + 52 56 val with_machine : string -> t -> t 57 + (** Set machine type (e.g. ["virt"]). *) 58 + 53 59 val with_cpu : string -> t -> t 60 + (** Set CPU model (e.g. ["host"]). *) 61 + 54 62 val with_cpus : int -> t -> t 63 + (** Set number of virtual CPUs. *) 64 + 55 65 val with_memory_mb : int -> t -> t 66 + (** Set RAM size in megabytes. *) 67 + 56 68 val with_kernel : string -> t -> t 69 + (** Set kernel image path for direct boot. *) 70 + 57 71 val with_initrd : string -> t -> t 72 + (** Set initrd image path. *) 73 + 58 74 val with_cmdline : string -> t -> t 75 + (** Set kernel command line. *) 59 76 60 77 val with_disk : 61 78 ?format:[ `Raw | `Qcow2 | `Auto ] -> ?readonly:bool -> string -> t -> t 79 + (** Add a disk image. *) 62 80 63 81 val with_network : network -> t -> t 82 + (** Set network configuration. *) 83 + 64 84 val with_display : display -> t -> t 85 + (** Set display output. *) 65 86 66 87 val with_kvm : bool -> t -> t 67 88 (** @deprecated ··· 69 90 sets TCG. *) 70 91 71 92 val with_serial : [ `Stdio | `Pty | `None | `Socket of string ] -> t -> t 93 + (** Set serial port configuration. *) 94 + 72 95 val with_chardev : chardev -> t -> t 96 + (** Add a character device. *) 97 + 73 98 val with_channel : chardev_id:string -> name:string -> t -> t 99 + (** Add a virtio-serial channel. *) 100 + 74 101 val with_extra_args : string list -> t -> t 102 + (** Append extra QEMU command-line arguments. *) 103 + 75 104 val with_qmp_socket : string -> t -> t 105 + (** Set QMP Unix socket path. *) 76 106 77 107 val to_args : t -> string list 78 108 (** Convert configuration to QEMU command-line arguments *)
+8 -18
test/test_qemu.ml
··· 437 437 438 438 (* {1 VM Config tests} *) 439 439 440 - let find_arg_value key args = 440 + let arg_value key args = 441 441 let rec loop = function 442 442 | [] -> None 443 443 | k :: v :: _ when k = key -> Some v ··· 448 448 let test_config_default () = 449 449 let config = Qemu.Vm.Config.default ~name:"test" in 450 450 let args = Qemu.Vm.Config.to_args config in 451 - Alcotest.(check (option string)) 452 - "name" (Some "test") 453 - (find_arg_value "-name" args); 454 - Alcotest.(check (option string)) 455 - "cpus" (Some "1") 456 - (find_arg_value "-smp" args); 457 - Alcotest.(check (option string)) 458 - "memory" (Some "512") (find_arg_value "-m" args); 451 + Alcotest.(check (option string)) "name" (Some "test") (arg_value "-name" args); 452 + Alcotest.(check (option string)) "cpus" (Some "1") (arg_value "-smp" args); 453 + Alcotest.(check (option string)) "memory" (Some "512") (arg_value "-m" args); 459 454 Alcotest.(check bool) "has -accel" true (List.mem "-accel" args); 460 455 Alcotest.(check bool) "has -machine" true (List.mem "-machine" args); 461 456 Alcotest.(check bool) "has -cpu" true (List.mem "-cpu" args) ··· 469 464 |> Qemu.Vm.Config.with_serial `Pty 470 465 in 471 466 let args = Qemu.Vm.Config.to_args config in 472 - Alcotest.(check (option string)) 473 - "cpus" (Some "4") 474 - (find_arg_value "-smp" args); 475 - Alcotest.(check (option string)) 476 - "memory" (Some "2048") (find_arg_value "-m" args); 467 + Alcotest.(check (option string)) "cpus" (Some "4") (arg_value "-smp" args); 468 + Alcotest.(check (option string)) "memory" (Some "2048") (arg_value "-m" args); 477 469 Alcotest.(check (option string)) 478 - "accel tcg" (Some "tcg") 479 - (find_arg_value "-accel" args) 470 + "accel tcg" (Some "tcg") (arg_value "-accel" args) 480 471 481 472 let test_config_disk () = 482 473 let config = ··· 501 492 Alcotest.(check bool) "has -m" true (List.mem "-m" args); 502 493 Alcotest.(check bool) "has -smp" true (List.mem "-smp" args); 503 494 Alcotest.(check (option string)) 504 - "accel tcg" (Some "tcg") 505 - (find_arg_value "-accel" args) 495 + "accel tcg" (Some "tcg") (arg_value "-accel" args) 506 496 507 497 let test_config_kernel_boot () = 508 498 let config =
+3
test/test_qemu.mli
··· 1 + (** QEMU tests. *) 2 + 1 3 val suite : string * unit Alcotest.test_case list 4 + (** Alcotest suite. *)
+3
test/test_qmp_protocol.mli
··· 1 + (** QMP protocol tests. *) 2 + 1 3 val suite : string * unit Alcotest.test_case list 4 + (** Alcotest suite. *)
+45 -73
test/test_vm.ml
··· 13 13 14 14 module Config = Qemu.Vm.Config 15 15 16 - let find_arg_value key args = 16 + let arg_value key args = 17 17 let rec loop = function 18 18 | [] -> None 19 19 | k :: v :: _ when k = key -> Some v ··· 24 24 let has_arg key args = List.mem key args 25 25 26 26 let has_arg_value key value args = 27 - match find_arg_value key args with Some v -> v = value | None -> false 27 + match arg_value key args with Some v -> v = value | None -> false 28 28 29 29 let count_arg key args = List.length (List.filter (fun s -> s = key) args) 30 30 ··· 61 61 let test_default_name () = 62 62 let config = Config.default ~name:"myvm" in 63 63 let args = Config.to_args config in 64 - Alcotest.(check (option string)) 65 - "name" (Some "myvm") 66 - (find_arg_value "-name" args) 64 + Alcotest.(check (option string)) "name" (Some "myvm") (arg_value "-name" args) 67 65 68 66 let test_default_cpus () = 69 67 let config = Config.default ~name:"test" in 70 68 let args = Config.to_args config in 71 - Alcotest.(check (option string)) 72 - "cpus" (Some "1") 73 - (find_arg_value "-smp" args) 69 + Alcotest.(check (option string)) "cpus" (Some "1") (arg_value "-smp" args) 74 70 75 71 let test_default_memory () = 76 72 let config = Config.default ~name:"test" in 77 73 let args = Config.to_args config in 78 - Alcotest.(check (option string)) 79 - "memory" (Some "512") (find_arg_value "-m" args) 74 + Alcotest.(check (option string)) "memory" (Some "512") (arg_value "-m" args) 80 75 81 76 let test_default_has_qmp () = 82 77 let config = Config.default ~name:"test" in 83 78 let args = Config.to_args config in 84 79 Alcotest.(check bool) "has -qmp" true (has_arg "-qmp" args); 85 - match find_arg_value "-qmp" args with 80 + match arg_value "-qmp" args with 86 81 | Some v -> 87 82 Alcotest.(check bool) "qmp contains path" true (String.length v > 0) 88 83 | None -> Alcotest.fail "missing -qmp" ··· 105 100 let test_with_cpus () = 106 101 let config = Config.default ~name:"test" |> Config.with_cpus 8 in 107 102 let args = Config.to_args config in 108 - Alcotest.(check (option string)) 109 - "cpus" (Some "8") 110 - (find_arg_value "-smp" args) 103 + Alcotest.(check (option string)) "cpus" (Some "8") (arg_value "-smp" args) 111 104 112 105 let test_with_memory_mb () = 113 106 let config = Config.default ~name:"test" |> Config.with_memory_mb 4096 in 114 107 let args = Config.to_args config in 115 - Alcotest.(check (option string)) 116 - "memory" (Some "4096") (find_arg_value "-m" args) 108 + Alcotest.(check (option string)) "memory" (Some "4096") (arg_value "-m" args) 117 109 118 110 let test_with_machine () = 119 111 let config = Config.default ~name:"test" |> Config.with_machine "microvm" in 120 112 let args = Config.to_args config in 121 113 Alcotest.(check (option string)) 122 114 "machine" (Some "microvm") 123 - (find_arg_value "-machine" args) 115 + (arg_value "-machine" args) 124 116 125 117 let test_with_cpu () = 126 118 let config = Config.default ~name:"test" |> Config.with_cpu "max" in 127 119 let args = Config.to_args config in 128 - Alcotest.(check (option string)) 129 - "cpu" (Some "max") 130 - (find_arg_value "-cpu" args) 120 + Alcotest.(check (option string)) "cpu" (Some "max") (arg_value "-cpu" args) 131 121 132 122 let test_with_arch_x86_64 () = 133 123 let config = Config.default ~name:"test" |> Config.with_arch Config.X86_64 in ··· 135 125 (* x86_64 defaults to q35 machine and host cpu *) 136 126 Alcotest.(check (option string)) 137 127 "machine" (Some "q35") 138 - (find_arg_value "-machine" args); 139 - Alcotest.(check (option string)) 140 - "cpu" (Some "host") 141 - (find_arg_value "-cpu" args) 128 + (arg_value "-machine" args); 129 + Alcotest.(check (option string)) "cpu" (Some "host") (arg_value "-cpu" args) 142 130 143 131 let test_with_arch_aarch64 () = 144 132 let config = Config.default ~name:"test" |> Config.with_arch Config.Aarch64 in ··· 146 134 (* aarch64 defaults to virt machine and host cpu *) 147 135 Alcotest.(check (option string)) 148 136 "machine" (Some "virt") 149 - (find_arg_value "-machine" args); 150 - Alcotest.(check (option string)) 151 - "cpu" (Some "host") 152 - (find_arg_value "-cpu" args) 137 + (arg_value "-machine" args); 138 + Alcotest.(check (option string)) "cpu" (Some "host") (arg_value "-cpu" args) 153 139 154 140 let test_with_accel_kvm () = 155 141 let config = Config.default ~name:"test" |> Config.with_accel Config.KVM in 156 142 let args = Config.to_args config in 157 143 Alcotest.(check (option string)) 158 - "accel" (Some "kvm") 159 - (find_arg_value "-accel" args) 144 + "accel" (Some "kvm") (arg_value "-accel" args) 160 145 161 146 let test_with_accel_hvf () = 162 147 let config = Config.default ~name:"test" |> Config.with_accel Config.HVF in 163 148 let args = Config.to_args config in 164 149 Alcotest.(check (option string)) 165 - "accel" (Some "hvf") 166 - (find_arg_value "-accel" args) 150 + "accel" (Some "hvf") (arg_value "-accel" args) 167 151 168 152 let test_with_accel_tcg () = 169 153 let config = Config.default ~name:"test" |> Config.with_accel Config.TCG in 170 154 let args = Config.to_args config in 171 155 Alcotest.(check (option string)) 172 - "accel" (Some "tcg") 173 - (find_arg_value "-accel" args) 156 + "accel" (Some "tcg") (arg_value "-accel" args) 174 157 175 158 let test_with_kvm_deprecated () = 176 159 (* with_kvm true sets KVM, false sets TCG *) ··· 180 163 let tcg_args = Config.to_args tcg in 181 164 Alcotest.(check (option string)) 182 165 "kvm" (Some "kvm") 183 - (find_arg_value "-accel" kvm_args); 166 + (arg_value "-accel" kvm_args); 184 167 Alcotest.(check (option string)) 185 168 "tcg" (Some "tcg") 186 - (find_arg_value "-accel" tcg_args) 169 + (arg_value "-accel" tcg_args) 187 170 188 171 (* {1 to_args: network tests} *) 189 172 ··· 191 174 let config = Config.default ~name:"test" |> Config.with_network Config.User in 192 175 let args = Config.to_args config in 193 176 Alcotest.(check bool) "has -netdev" true (has_arg "-netdev" args); 194 - match find_arg_value "-netdev" args with 177 + match arg_value "-netdev" args with 195 178 | Some v -> 196 179 Alcotest.(check bool) 197 180 "user netdev" true ··· 204 187 |> Config.with_network (Config.Tap { name = "tap0"; script = None }) 205 188 in 206 189 let args = Config.to_args config in 207 - match find_arg_value "-netdev" args with 190 + match arg_value "-netdev" args with 208 191 | Some v -> 209 192 Alcotest.(check bool) 210 193 "tap netdev" true ··· 226 209 (Config.Tap { name = "tap1"; script = Some "/etc/qemu-ifup" }) 227 210 in 228 211 let args = Config.to_args config in 229 - match find_arg_value "-netdev" args with 212 + match arg_value "-netdev" args with 230 213 | Some v -> 231 214 Alcotest.(check bool) 232 215 "has script path" true ··· 239 222 |> Config.with_network (Config.Bridge { name = "br0" }) 240 223 in 241 224 let args = Config.to_args config in 242 - match find_arg_value "-netdev" args with 225 + match arg_value "-netdev" args with 243 226 | Some v -> 244 227 Alcotest.(check bool) 245 228 "bridge netdev" true ··· 271 254 Config.default ~name:"test" |> Config.with_display (Config.Vnc { port = 5 }) 272 255 in 273 256 let args = Config.to_args config in 274 - Alcotest.(check (option string)) 275 - "vnc" (Some ":5") 276 - (find_arg_value "-vnc" args) 257 + Alcotest.(check (option string)) "vnc" (Some ":5") (arg_value "-vnc" args) 277 258 278 259 let test_display_spice () = 279 260 let config = ··· 281 262 |> Config.with_display (Config.Spice { port = 5900 }) 282 263 in 283 264 let args = Config.to_args config in 284 - match find_arg_value "-spice" args with 265 + match arg_value "-spice" args with 285 266 | Some v -> 286 267 Alcotest.(check bool) "has port" true (string_contains ~sub:"port=5900" v) 287 268 | None -> Alcotest.fail "missing -spice" ··· 321 302 let test_qmp_socket_default () = 322 303 let config = Config.default ~name:"myvm" in 323 304 let args = Config.to_args config in 324 - match find_arg_value "-qmp" args with 305 + match arg_value "-qmp" args with 325 306 | Some v -> 326 307 Alcotest.(check bool) 327 308 "unix prefix" true ··· 337 318 |> Config.with_qmp_socket "/var/run/qemu/test.sock" 338 319 in 339 320 let args = Config.to_args config in 340 - match find_arg_value "-qmp" args with 321 + match arg_value "-qmp" args with 341 322 | Some v -> 342 323 Alcotest.(check bool) 343 324 "has custom path" true ··· 352 333 |> Config.with_disk ~format:`Qcow2 "/tmp/disk.qcow2" 353 334 in 354 335 let args = Config.to_args config in 355 - match find_arg_value "-drive" args with 336 + match arg_value "-drive" args with 356 337 | Some v -> 357 338 Alcotest.(check bool) 358 339 "has format=qcow2" true ··· 364 345 Config.default ~name:"test" |> Config.with_disk ~format:`Raw "/tmp/disk.img" 365 346 in 366 347 let args = Config.to_args config in 367 - match find_arg_value "-drive" args with 348 + match arg_value "-drive" args with 368 349 | Some v -> 369 350 Alcotest.(check bool) 370 351 "has format=raw" true ··· 377 358 |> Config.with_disk ~format:`Auto "/tmp/disk.img" 378 359 in 379 360 let args = Config.to_args config in 380 - match find_arg_value "-drive" args with 361 + match arg_value "-drive" args with 381 362 | Some v -> 382 363 Alcotest.(check bool) 383 364 "has format=auto" true ··· 390 371 |> Config.with_disk ~readonly:true "/tmp/cdrom.iso" 391 372 in 392 373 let args = Config.to_args config in 393 - match find_arg_value "-drive" args with 374 + match arg_value "-drive" args with 394 375 | Some v -> 395 376 Alcotest.(check bool) 396 377 "has readonly=on" true ··· 403 384 |> Config.with_disk ~readonly:false "/tmp/disk.qcow2" 404 385 in 405 386 let args = Config.to_args config in 406 - match find_arg_value "-drive" args with 387 + match arg_value "-drive" args with 407 388 | Some v -> 408 389 (* readonly=on should NOT be present *) 409 390 Alcotest.(check bool) ··· 454 435 in 455 436 let config = Config.default ~name:"test" |> Config.with_chardev chardev in 456 437 let args = Config.to_args config in 457 - match find_arg_value "-chardev" args with 438 + match arg_value "-chardev" args with 458 439 | Some v -> 459 440 Alcotest.(check bool) 460 441 "socket type" true ··· 471 452 in 472 453 let config = Config.default ~name:"test" |> Config.with_chardev chardev in 473 454 let args = Config.to_args config in 474 - match find_arg_value "-chardev" args with 455 + match arg_value "-chardev" args with 475 456 | Some v -> 476 457 (* server=on should NOT be present for client *) 477 458 Alcotest.(check bool) ··· 524 505 let args = Config.to_args config in 525 506 Alcotest.(check (option string)) 526 507 "machine" (Some "virt") 527 - (find_arg_value "-machine" args); 508 + (arg_value "-machine" args); 528 509 Alcotest.(check (option string)) 529 - "accel" (Some "hvf") 530 - (find_arg_value "-accel" args); 510 + "accel" (Some "hvf") (arg_value "-accel" args); 511 + Alcotest.(check (option string)) "cpus" (Some "2") (arg_value "-smp" args); 512 + Alcotest.(check (option string)) "memory" (Some "1024") (arg_value "-m" args); 531 513 Alcotest.(check (option string)) 532 - "cpus" (Some "2") 533 - (find_arg_value "-smp" args); 514 + "kernel" (Some "/boot/Image") (arg_value "-kernel" args); 534 515 Alcotest.(check (option string)) 535 - "memory" (Some "1024") (find_arg_value "-m" args); 536 - Alcotest.(check (option string)) 537 - "kernel" (Some "/boot/Image") 538 - (find_arg_value "-kernel" args); 539 - Alcotest.(check (option string)) 540 - "initrd" (Some "/boot/initrd.cpio.gz") 541 - (find_arg_value "-initrd" args); 516 + "initrd" (Some "/boot/initrd.cpio.gz") (arg_value "-initrd" args); 542 517 Alcotest.(check (option string)) 543 518 "cmdline" (Some "console=ttyAMA0 root=/dev/vda rw") 544 - (find_arg_value "-append" args); 519 + (arg_value "-append" args); 545 520 Alcotest.(check bool) "nographic" true (has_arg "-nographic" args) 546 521 547 522 let test_x86_64_kvm_disk () = ··· 558 533 let args = Config.to_args config in 559 534 Alcotest.(check (option string)) 560 535 "machine" (Some "q35") 561 - (find_arg_value "-machine" args); 536 + (arg_value "-machine" args); 562 537 Alcotest.(check (option string)) 563 - "accel" (Some "kvm") 564 - (find_arg_value "-accel" args); 565 - Alcotest.(check (option string)) 566 - "vnc" (Some ":0") 567 - (find_arg_value "-vnc" args); 538 + "accel" (Some "kvm") (arg_value "-accel" args); 539 + Alcotest.(check (option string)) "vnc" (Some ":0") (arg_value "-vnc" args); 568 540 Alcotest.(check bool) "has -drive" true (has_arg "-drive" args); 569 541 (* Verify QMP socket path *) 570 - match find_arg_value "-qmp" args with 542 + match arg_value "-qmp" args with 571 543 | Some v -> 572 544 Alcotest.(check bool) 573 545 "custom qmp socket" true
+3
test/test_vm.mli
··· 1 + (** VM tests. *) 2 + 1 3 val suite : string * unit Alcotest.test_case list 4 + (** Alcotest suite. *)