Skip to content

Commit b48ca7f

Browse files
committed
qat: update dpdkdrv unit tests
After a closer review, it was noticed that some of the QAT dpdkdrv unit tests need updating: - "Broken igb_uio DPDKdriver..." is actually testing unknown device ID and we already have tests for it -> drop. - "igb_uio DPDKdriver with one kernel bound device (not QAT device)" is testing something impossible: an unknown VF devID is originated from a QAT PF -> drop. - creating files for unbind/new_id etc. is unnecessary because os.WriteFile() creates them during the tests -> drop these lines to simplify unit tests maintenance. Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
1 parent 21072b8 commit b48ca7f

File tree

1 file changed

+9
-68
lines changed

1 file changed

+9
-68
lines changed

cmd/qat_plugin/dpdkdrv/dpdkdrv_test.go

Lines changed: 9 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -155,27 +155,6 @@ func TestScanPrivate(t *testing.T) {
155155
maxDevNum: 1,
156156
expectedErr: true,
157157
},
158-
{
159-
name: "Broken igb_uio DPDKdriver with one kernel bound device",
160-
dpdkDriver: "igb_uio",
161-
kernelVfDrivers: []string{"c6xxvf"},
162-
dirs: []string{
163-
"sys/bus/pci/drivers/c6xx",
164-
"sys/bus/pci/devices/0000:02:01.0/uio/sometestfile",
165-
"sys/bus/pci/devices/0000:02:01.0/driver",
166-
"sys/bus/pci/devices/0000:02:00.0",
167-
},
168-
files: map[string][]byte{
169-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
170-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("some junk"),
171-
},
172-
symlinks: map[string]string{
173-
"sys/bus/pci/drivers/c6xx/0000:02:00.0": "sys/bus/pci/devices/0000:02:00.0",
174-
"sys/bus/pci/devices/0000:02:00.0/virtfn0": "sys/bus/pci/devices/0000:02:01.0",
175-
},
176-
maxDevNum: 1,
177-
expectedDevNum: 0,
178-
},
179158
{
180159
name: "igb_uio DPDKdriver with one kernel bound device (QAT device) where vfdevID is equal to qatDevId (37c9) where reading uioDirPath for obtaining device file fails ",
181160
dpdkDriver: "igb_uio",
@@ -189,7 +168,6 @@ func TestScanPrivate(t *testing.T) {
189168
files: map[string][]byte{
190169
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
191170
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
192-
"sys/bus/pci/drivers/igb_uio/new_id": []byte("some junk"),
193171
},
194172
symlinks: map[string]string{
195173
"sys/bus/pci/drivers/c6xx/0000:02:00.0": "sys/bus/pci/devices/0000:02:00.0",
@@ -210,9 +188,7 @@ func TestScanPrivate(t *testing.T) {
210188
"sys/bus/pci/devices/0000:02:00.0",
211189
},
212190
files: map[string][]byte{
213-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
214-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
215-
"sys/bus/pci/drivers/igb_uio/new_id": []byte("some junk"),
191+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
216192
},
217193
symlinks: map[string]string{
218194
"sys/bus/pci/drivers/c6xx/0000:02:00.0": "sys/bus/pci/devices/0000:02:00.0",
@@ -235,11 +211,8 @@ func TestScanPrivate(t *testing.T) {
235211
"sys/bus/pci/devices/0000:02:00.0",
236212
},
237213
files: map[string][]byte{
238-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
239-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
240-
"sys/bus/pci/drivers/igb_uio/new_id": []byte("some junk"),
241-
"sys/bus/pci/devices/0000:02:01.1/driver/unbind": []byte("some junk"),
242-
"sys/bus/pci/devices/0000:02:01.1/device": []byte("0x37c9"),
214+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
215+
"sys/bus/pci/devices/0000:02:01.1/device": []byte("0x37c9"),
243216
},
244217
symlinks: map[string]string{
245218
"sys/bus/pci/drivers/c6xx/0000:02:00.0": "sys/bus/pci/devices/0000:02:00.0",
@@ -249,29 +222,6 @@ func TestScanPrivate(t *testing.T) {
249222
maxDevNum: 1,
250223
expectedDevNum: 1,
251224
},
252-
{
253-
name: "igb_uio DPDKdriver with one kernel bound device (not QAT device) where vfdevID is not equal to qatDevId (37c9)",
254-
dpdkDriver: "igb_uio",
255-
kernelVfDrivers: []string{"c6xxvf"},
256-
dirs: []string{
257-
"sys/bus/pci/drivers/c6xx",
258-
"sys/bus/pci/drivers/igb_uio",
259-
"sys/bus/pci/devices/0000:02:01.0/uio/sometestfile",
260-
"sys/bus/pci/devices/0000:02:01.0/driver",
261-
"sys/bus/pci/devices/0000:02:00.0",
262-
},
263-
files: map[string][]byte{
264-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
265-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("some junk"),
266-
"sys/bus/pci/drivers/igb_uio/new_id": []byte("some junk"),
267-
},
268-
symlinks: map[string]string{
269-
"sys/bus/pci/drivers/c6xx/0000:02:00.0": "sys/bus/pci/devices/0000:02:00.0",
270-
"sys/bus/pci/devices/0000:02:00.0/virtfn0": "sys/bus/pci/devices/0000:02:01.0",
271-
},
272-
maxDevNum: 1,
273-
expectedDevNum: 0,
274-
},
275225
{
276226
name: "vfio-pci DPDKdriver with one kernel bound device (QAT device) where vfdevID is equal to qatDevId (37c9)",
277227
dpdkDriver: "vfio-pci",
@@ -283,9 +233,7 @@ func TestScanPrivate(t *testing.T) {
283233
"sys/bus/pci/devices/0000:02:00.0",
284234
},
285235
files: map[string][]byte{
286-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
287-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
288-
"sys/bus/pci/drivers/vfio-pci/new_id": []byte("some junk"),
236+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
289237
},
290238
symlinks: map[string]string{
291239
"sys/bus/pci/devices/0000:02:01.0/iommu_group": "sys/kernel/iommu_groups/vfiotestfile",
@@ -307,7 +255,6 @@ func TestScanPrivate(t *testing.T) {
307255
},
308256
files: map[string][]byte{
309257
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
310-
"sys/bus/pci/drivers/vfio-pci/new_id": []byte("some junk"),
311258
},
312259
symlinks: map[string]string{
313260
"sys/bus/pci/devices/0000:02:01.0/iommu_group": "sys/kernel/iommu_groups/vfiotestfile",
@@ -318,7 +265,7 @@ func TestScanPrivate(t *testing.T) {
318265
expectedDevNum: 1,
319266
},
320267
{
321-
name: "vfio-pci DPDKdriver with one kernel bound device (QAT device) where vfdevID is equal to qatDevId not enabbled in kernelVfDrivers",
268+
name: "vfio-pci DPDKdriver with one kernel bound device (QAT device) where vfdevID is equal to qatDevId not enabled in kernelVfDrivers",
322269
dpdkDriver: "vfio-pci",
323270
kernelVfDrivers: []string{"c6xxvf"},
324271
dirs: []string{
@@ -328,9 +275,7 @@ func TestScanPrivate(t *testing.T) {
328275
"sys/bus/pci/devices/0000:02:00.0",
329276
},
330277
files: map[string][]byte{
331-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
332-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x6f55"),
333-
"sys/bus/pci/drivers/vfio-pci/new_id": []byte("some junk"),
278+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x6f55"),
334279
},
335280
symlinks: map[string]string{
336281
"sys/bus/pci/devices/0000:02:01.0/iommu_group": "sys/kernel/iommu_groups/vfiotestfile",
@@ -341,7 +286,7 @@ func TestScanPrivate(t *testing.T) {
341286
expectedDevNum: 0,
342287
},
343288
{
344-
name: "vfio-pci DPDKdriver with one kernel bound device (QAT device) where vfdevID is equal to qatDevId (37c9) but symlink is broken",
289+
name: "vfio-pci DPDKdriver with one kernel bound device (QAT device) where vfdevID is equal to qatDevId (37c9) but symlink is broken",
345290
dpdkDriver: "vfio-pci",
346291
kernelVfDrivers: []string{"c6xxvf"},
347292
dirs: []string{
@@ -352,9 +297,7 @@ func TestScanPrivate(t *testing.T) {
352297
"sys/bus/pci/devices/0000:02:01.0/vfio-pci/vfiotestfile",
353298
},
354299
files: map[string][]byte{
355-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
356-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
357-
"sys/bus/pci/drivers/vfio-pci/new_id": []byte("some junk"),
300+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
358301
},
359302
symlinks: map[string]string{
360303
"sys/bus/pci/drivers/c6xx/0000:02:00.0": "sys/bus/pci/devices/0000:02:00.0",
@@ -373,9 +316,7 @@ func TestScanPrivate(t *testing.T) {
373316
"sys/bus/pci/devices/0000:02:01.0/driver",
374317
},
375318
files: map[string][]byte{
376-
"sys/bus/pci/devices/0000:02:01.0/driver/unbind": []byte("some junk"),
377-
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
378-
"sys/bus/pci/drivers/vfio-pci/new_id": []byte("some junk"),
319+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x37c9"),
379320
},
380321
symlinks: map[string]string{
381322
"sys/bus/pci/devices/0000:02:01.0/iommu_group": "sys/kernel/iommu_groups/vfiotestfile",

0 commit comments

Comments
 (0)