@@ -44,6 +44,16 @@ There is 3 QAT acceleration device(s) in the system:
4444 qat_dev0 - type: c6xx, inst_id: 0, node_id: 0, bsf: 3b:00.0, #accel: 5 #engines: 10 state: up
4545 qat_dev1 - type: c6xx, inst_id: 1, node_id: 0, bsf: 3d:00.0, #accel: 5 #engines: 10 state: down
4646 qat_dev2 - type: c6xx, inst_id: 2, node_id: 3, bsf: d8:00.0, #accel: 5 #engines: 10 state: up
47+ `
48+ adfCtlOutputVf = `Checking status of all devices.
49+ There is 7 QAT acceleration device(s) in the system:
50+ qat_dev0 - type: c6xx, inst_id: 0, node_id: 0, bsf: 0000:3b:00.0, #accel: 5 #engines: 10 state: up
51+ qat_dev1 - type: c6xx, inst_id: 1, node_id: 0, bsf: 0000:3b:00.0, #accel: 5 #engines: 10 state: up
52+ qat_dev2 - type: c6xx, inst_id: 2, node_id: 3, bsf: 0000:3b:00.0, #accel: 5 #engines: 10 state: up
53+ qat_dev3 - type: c6xxvf, inst_id: 0, node_id: 0, bsf: 0000:3b:01.0, #accel: 1 #engines: 1 state: up
54+ qat_dev4 - type: c6xxvf, inst_id: 1, node_id: 0, bsf: 0000:3b:01.1, #accel: 1 #engines: 1 state: up
55+ qat_dev5 - type: c6xxvf, inst_id: 2, node_id: 0, bsf: 0000:3b:01.2, #accel: 1 #engines: 1 state: up
56+ qat_dev6 - type: c6xxvf, inst_id: 3, node_id: 0, bsf: 0000:3b:01.3, #accel: 1 #engines: 1 state: up
4757`
4858)
4959
@@ -58,16 +68,25 @@ func TestGetOnlineDevices(t *testing.T) {
5868 adfCtlError error
5969 expectedDevNum int
6070 expectedErr bool
71+ iommuOn bool
6172 }{
6273 {
6374 name : "all is good" ,
6475 adfCtlOutput : adfCtlOutput ,
6576 expectedDevNum : 3 ,
77+ iommuOn : false ,
6678 },
6779 {
6880 name : "one device is down" ,
6981 adfCtlOutput : adfCtlOutputOneDown ,
7082 expectedDevNum : 2 ,
83+ iommuOn : false ,
84+ },
85+ {
86+ name : "virtual functions enabled" ,
87+ adfCtlOutput : adfCtlOutputVf ,
88+ expectedDevNum : 4 ,
89+ iommuOn : true ,
7190 },
7291 {
7392 name : "adf_ctl fails to run" ,
@@ -94,7 +113,7 @@ func TestGetOnlineDevices(t *testing.T) {
94113 dp := & DevicePlugin {
95114 execer : & execer ,
96115 }
97- devices , err := dp .getOnlineDevices ()
116+ devices , err := dp .getOnlineDevices (tt . iommuOn )
98117 if tt .expectedErr && err == nil {
99118 t .Error ("Expected error hasn't been triggered" )
100119 }
0 commit comments