@@ -229,10 +229,50 @@ module VideoRam = Generic.Make(Generic.EncapsulateState(struct
229229 ]
230230end ))
231231
232+ module VgpuExtraArgs = Generic. Make (Generic. EncapsulateState (struct
233+ open Test_vgpu_common
234+
235+ module Io = struct
236+ type input_t = vm_config
237+ type output_t = string
238+
239+ let string_of_input_t = string_of_vm_config
240+ let string_of_output_t = Test_printers. string
241+ end
242+
243+ module State = XapiDb
244+
245+ let load_input __context conf =
246+ let pgpu_ref = make_pgpu ~__context ~address: " 0000:07:00.0" default_k1 in
247+ let vm_ref = load_vm_config __context conf in
248+ let (_ : API.ref_VGPU ) =
249+ make_vgpu ~__context ~vm_ref ~scheduled_to_be_resident_on: pgpu_ref k100 in
250+ ()
251+
252+ let extract_output __context _ =
253+ let metadata = run_create_metadata ~__context in
254+ match metadata.Metadata. vgpus with
255+ | [{Vgpu. implementation = Vgpu. Nvidia nvidia_vgpu}] ->
256+ nvidia_vgpu.Vgpu. config_file
257+ | _ -> assert_failure " Incorrect vGPU configuration found"
258+
259+ let tests = [
260+ (* No vgpu_extra_args. *)
261+ {oc = [] ; platform = [] }, " /usr/share/nvidia/vgx/grid_k100.conf" ;
262+ (* One key-value pair in vgpu_extra_args. *)
263+ {oc = [] ; platform = [" vgpu_extra_args" , " foo=bar" ]},
264+ " /usr/share/nvidia/vgx/grid_k100.conf,foo=bar" ;
265+ (* Two key-value pairs in vgpu_extra_args. *)
266+ {oc = [] ; platform = [" vgpu_extra_args" , " foo=bar,baz=123" ]},
267+ " /usr/share/nvidia/vgx/grid_k100.conf,foo=bar,baz=123" ;
268+ ]
269+ end ))
270+
232271let test =
233272 " test_xenopsd_metadata" > :::
234273 [
235274 " test_hvm_serial" > ::: HVMSerial. tests;
236275 " test_videomode" > ::: VideoMode. tests;
237276 " test_videoram" > ::: VideoRam. tests;
277+ " test_vgpu_extra_args" > ::: VgpuExtraArgs. tests;
238278 ]
0 commit comments