@@ -651,7 +651,33 @@ func TestTakeByTopologyNUMAPacked(t *testing.T) {
651
651
"" ,
652
652
mustParseCPUSet (t , "0-29,40-69,30,31,70,71" ),
653
653
},
654
- // Test cases for PreferAlignByUncoreCache
654
+ }... )
655
+
656
+ for _ , tc := range testCases {
657
+ t .Run (tc .description , func (t * testing.T ) {
658
+ result , err := takeByTopologyNUMAPacked (tc .topo , tc .availableCPUs , tc .numCPUs , false )
659
+ if tc .expErr != "" && err != nil && err .Error () != tc .expErr {
660
+ t .Errorf ("expected error to be [%v] but it was [%v]" , tc .expErr , err )
661
+ }
662
+ if ! result .Equals (tc .expResult ) {
663
+ t .Errorf ("expected result [%s] to equal [%s]" , result , tc .expResult )
664
+ }
665
+ })
666
+ }
667
+ }
668
+
669
+ type takeByTopologyUncoreTestCase struct {
670
+ description string
671
+ topo * topology.CPUTopology
672
+ opts StaticPolicyOptions
673
+ availableCPUs cpuset.CPUSet
674
+ numCPUs int
675
+ expErr string
676
+ expResult cpuset.CPUSet
677
+ }
678
+
679
+ func TestTakeByTopologyUncore (t * testing.T ) {
680
+ testCases := []takeByTopologyUncoreTestCase {
655
681
{
656
682
"take cpus from two full UncoreCaches and partial from a single UncoreCache" ,
657
683
topoUncoreSingleSocketNoSMT ,
@@ -724,7 +750,7 @@ func TestTakeByTopologyNUMAPacked(t *testing.T) {
724
750
"" ,
725
751
mustParseCPUSet (t , "4-7,12-15,1,9" ),
726
752
},
727
- }... )
753
+ }
728
754
729
755
for _ , tc := range testCases {
730
756
t .Run (tc .description , func (t * testing.T ) {
0 commit comments