@@ -403,14 +403,14 @@ func TestScan(t *testing.T) {
403
403
t .Run (tc .name , func (t * testing.T ) {
404
404
root , err := os .MkdirTemp ("" , "test_new_device_plugin" )
405
405
if err != nil {
406
- t .Fatalf ("can 't create temporary directory: %+v" , err )
406
+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
407
407
}
408
408
// dirs/files need to be removed for the next test
409
409
defer os .RemoveAll (root )
410
410
411
411
sysfs , devfs , err := createTestFiles (root , tc )
412
412
if err != nil {
413
- t .Errorf ("unexpected error: %+v" , err )
413
+ t .Errorf ("Unexpected error: %+v" , err )
414
414
}
415
415
416
416
plugin := newDevicePlugin (sysfs , devfs , tc .options )
@@ -422,7 +422,7 @@ func TestScan(t *testing.T) {
422
422
err = plugin .Scan (notifier )
423
423
// Scans in GPU plugin never fail
424
424
if err != nil {
425
- t .Errorf ("unexpected error: %+v" , err )
425
+ t .Errorf ("Unexpected error: %+v" , err )
426
426
}
427
427
if tc .expectedI915Devs != notifier .i915Count {
428
428
t .Errorf ("Expected %d, discovered %d devices (i915)" ,
@@ -465,14 +465,14 @@ func TestScanFails(t *testing.T) {
465
465
t .Run (tc .name , func (t * testing.T ) {
466
466
root , err := os .MkdirTemp ("" , "test_new_device_plugin" )
467
467
if err != nil {
468
- t .Fatalf ("can 't create temporary directory: %+v" , err )
468
+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
469
469
}
470
470
// dirs/files need to be removed for the next test
471
471
defer os .RemoveAll (root )
472
472
473
473
sysfs , devfs , err := createTestFiles (root , tc )
474
474
if err != nil {
475
- t .Errorf ("unexpected error: %+v" , err )
475
+ t .Errorf ("Unexpected error: %+v" , err )
476
476
}
477
477
478
478
plugin := newDevicePlugin (sysfs , devfs , tc .options )
@@ -485,7 +485,7 @@ func TestScanFails(t *testing.T) {
485
485
486
486
err = plugin .Scan (notifier )
487
487
if err == nil {
488
- t .Error ("unexpected nil error" )
488
+ t .Error ("Unexpected nil error" )
489
489
}
490
490
})
491
491
}
@@ -545,14 +545,14 @@ func TestScanWithRmAndTiles(t *testing.T) {
545
545
t .Run (tc .name , func (t * testing.T ) {
546
546
root , err := os .MkdirTemp ("" , "test_new_device_plugin" )
547
547
if err != nil {
548
- t .Fatalf ("can 't create temporary directory: %+v" , err )
548
+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
549
549
}
550
550
// dirs/files need to be removed for the next test
551
551
defer os .RemoveAll (root )
552
552
553
553
sysfs , devfs , err := createTestFiles (root , tc )
554
554
if err != nil {
555
- t .Errorf ("unexpected error: %+v" , err )
555
+ t .Errorf ("Unexpected error: %+v" , err )
556
556
}
557
557
558
558
plugin := newDevicePlugin (sysfs , devfs , tc .options )
@@ -566,10 +566,10 @@ func TestScanWithRmAndTiles(t *testing.T) {
566
566
567
567
err = plugin .Scan (notifier )
568
568
if err != nil {
569
- t .Error ("unexpected error" )
569
+ t .Error ("Unexpected error" )
570
570
}
571
571
if rm .tileCount != expectedTileCounts [i ] {
572
- t .Error ("unexpected tilecount for RM" )
572
+ t .Error ("Unexpected tilecount for RM" )
573
573
}
574
574
})
575
575
}
@@ -673,7 +673,7 @@ func TestBypath(t *testing.T) {
673
673
for _ , td := range tds {
674
674
root , err := os .MkdirTemp ("" , "test_bypath_mounting" )
675
675
if err != nil {
676
- t .Fatalf ("can 't create temporary directory: %+v" , err )
676
+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
677
677
}
678
678
// dirs/files need to be removed for the next test
679
679
defer os .RemoveAll (root )
@@ -718,7 +718,7 @@ func TestBypath(t *testing.T) {
718
718
func TestPciDeviceForCard (t * testing.T ) {
719
719
root , err := os .MkdirTemp ("" , "test_pci_device_for_card" )
720
720
if err != nil {
721
- t .Fatalf ("can 't create temporary directory: %+v" , err )
721
+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
722
722
}
723
723
// dirs/files need to be removed for the next test
724
724
defer os .RemoveAll (root )
@@ -729,24 +729,24 @@ func TestPciDeviceForCard(t *testing.T) {
729
729
cardDevicePath := filepath .Join (cardPath , "device" )
730
730
731
731
if err := os .MkdirAll (cardDevicePath , 0750 ); err != nil {
732
- t .Fatalf ("couldn't create card's device path" )
732
+ t .Fatalf ("Card device path creation failed: %+v" , err )
733
733
}
734
734
735
735
data := "0x5959"
736
736
737
737
err = os .WriteFile (filepath .Join (cardDevicePath , "device" ), []byte (data ), 0o600 )
738
738
if err != nil {
739
- t .Fatalf ("device id write failed: %+v" , err )
739
+ t .Fatalf ("Device id write failed: %+v" , err )
740
740
}
741
741
742
742
id , err := pciDeviceIDForCard (cardPath )
743
743
744
744
if err != nil {
745
- t .Error ("failed to get device id for card" )
745
+ t .Error ("Failed to get device id for card: %+v" , err )
746
746
}
747
747
748
748
if id != data {
749
- t .Errorf ("wrong id received %s vs %s" , id , data )
749
+ t .Errorf ("Wrong id received %s vs %s" , id , data )
750
750
}
751
751
752
752
// Check bad device
@@ -755,18 +755,18 @@ func TestPciDeviceForCard(t *testing.T) {
755
755
cardDevicePath = filepath .Join (cardPath , "device" )
756
756
757
757
if err := os .MkdirAll (cardDevicePath , 0750 ); err != nil {
758
- t .Fatalf ("couldn't create card's device path" )
758
+ t .Fatalf ("Card device path creation failed: %+v" , err )
759
759
}
760
760
761
- err = os .WriteFile (filepath .Join (cardDevicePath , "devicee " ), []byte (data ), 0o600 )
761
+ err = os .WriteFile (filepath .Join (cardDevicePath , "devicebad " ), []byte (data ), 0o600 )
762
762
if err != nil {
763
- t .Fatalf ("device id write failed: %+v" , err )
763
+ t .Fatalf ("Device id write failed: %+v" , err )
764
764
}
765
765
766
766
id , err = pciDeviceIDForCard (cardPath )
767
767
768
768
if err == nil {
769
- t .Errorf ("id received when it shouldn't be possible: %s" , id )
769
+ t .Errorf ("ID received when it shouldn't be possible: %s" , id )
770
770
}
771
771
}
772
772
@@ -782,17 +782,17 @@ func createSymlinks(t *testing.T, base string, links []symlinkItem) {
782
782
783
783
if _ , err := os .Stat (linkOld ); err != nil {
784
784
if err := os .MkdirAll (linkOld , 0o750 ); err != nil && ! errors .Is (err , os .ErrExist ) {
785
- t .Fatalf ("failed to create symlink base dir: %+v" , err )
785
+ t .Fatalf ("Failed to create symlink base dir: %+v" , err )
786
786
}
787
787
}
788
788
789
789
d := filepath .Dir (linkNew )
790
790
if err := os .MkdirAll (d , 0o750 ); err != nil {
791
- t .Fatal ("failed to create symlink new dir" , err )
791
+ t .Fatal ("Failed to create symlink new dir" , err )
792
792
}
793
793
794
794
if err := os .Symlink (linkOld , linkNew ); err != nil {
795
- t .Fatal ("failed to create symlink from old to new" , err )
795
+ t .Fatal ("Failed to create symlink from old to new" , err )
796
796
}
797
797
}
798
798
}
@@ -823,7 +823,7 @@ func createDirs(t *testing.T, base string, dirs []string) {
823
823
func TestCDIDeviceInclusion (t * testing.T ) {
824
824
root , err := os .MkdirTemp ("" , "test_cdidevice" )
825
825
if err != nil {
826
- t .Fatalf ("can 't create temporary directory: %+v" , err )
826
+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
827
827
}
828
828
// dirs/files need to be removed for the next test
829
829
defer os .RemoveAll (root )
@@ -878,7 +878,7 @@ func TestCDIDeviceInclusion(t *testing.T) {
878
878
tree , err := plugin .scan ()
879
879
880
880
if err != nil {
881
- t .Error ("failed to get device id for card" )
881
+ t .Error ("Failed to get device id for card" )
882
882
}
883
883
884
884
refTree := dpapi .NewDeviceTree ()
@@ -954,13 +954,13 @@ func TestCDIDeviceInclusion(t *testing.T) {
954
954
}))
955
955
956
956
if ! reflect .DeepEqual (tree , refTree ) {
957
- t .Error ("received device tree isn't expected\n " , tree , "\n " , refTree )
957
+ t .Error ("Received device tree isn't expected\n " , tree , "\n " , refTree )
958
958
}
959
959
960
960
if tree .DeviceTypeCount ("i915" ) != 1 {
961
- t .Error ("invalid count for device (i915)" )
961
+ t .Error ("Invalid count for device (i915)" )
962
962
}
963
963
if tree .DeviceTypeCount ("xe" ) != 1 {
964
- t .Error ("invalid count for device (xe)" )
964
+ t .Error ("Invalid count for device (xe)" )
965
965
}
966
966
}
0 commit comments