@@ -11,7 +11,7 @@ import (
11
11
)
12
12
13
13
func TestIntelRdtSetL3CacheSchema (t * testing.T ) {
14
- helper := NewIntelRdtTestUtil (t )
14
+ helper := NewIntelRdtTestUtil (t , "clos-1" )
15
15
16
16
const (
17
17
l3CacheSchemaBefore = "L3:0=f;1=f0"
@@ -41,7 +41,7 @@ func TestIntelRdtSetL3CacheSchema(t *testing.T) {
41
41
}
42
42
43
43
func TestIntelRdtSetMemBwSchema (t * testing.T ) {
44
- helper := NewIntelRdtTestUtil (t )
44
+ helper := NewIntelRdtTestUtil (t , "clos-1" )
45
45
46
46
const (
47
47
memBwSchemaBefore = "MB:0=20;1=70"
@@ -71,7 +71,7 @@ func TestIntelRdtSetMemBwSchema(t *testing.T) {
71
71
}
72
72
73
73
func TestIntelRdtSetMemBwScSchema (t * testing.T ) {
74
- helper := NewIntelRdtTestUtil (t )
74
+ helper := NewIntelRdtTestUtil (t , "clos-1" )
75
75
76
76
const (
77
77
memBwScSchemaBefore = "MB:0=5000;1=7000"
@@ -157,19 +157,19 @@ func TestApply(t *testing.T) {
157
157
158
158
for _ , tt := range tests {
159
159
t .Run (tt .name , func (t * testing.T ) {
160
- NewIntelRdtTestUtil (t )
161
160
id := "abcd-1234"
162
- closPath := filepath . Join ( intelRdtRoot , id )
161
+ closName := id
163
162
if tt .config .ClosID != "" {
164
- closPath = filepath . Join ( intelRdtRoot , tt .config .ClosID )
163
+ closName = tt .config .ClosID
165
164
}
166
165
166
+ preConfiguredClos := ""
167
167
if tt .precreateClos {
168
- if err := os .MkdirAll (filepath .Join (closPath , "mon_groups" ), 0o755 ); err != nil {
169
- t .Fatal (err )
170
- }
168
+ preConfiguredClos = closName
171
169
}
172
- m := newManager (& configs.Config {IntelRdt : & tt .config }, id , closPath )
170
+ NewIntelRdtTestUtil (t , preConfiguredClos )
171
+
172
+ m := newManager (& configs.Config {IntelRdt : & tt .config }, id , filepath .Join (intelRdtRoot , closName ))
173
173
err := m .Apply (pid )
174
174
if tt .isError && err == nil {
175
175
t .Fatal ("expected error, got nil" )
@@ -255,18 +255,16 @@ func TestDestroy(t *testing.T) {
255
255
256
256
for _ , tt := range tests {
257
257
t .Run (tt .name , func (t * testing.T ) {
258
- NewIntelRdtTestUtil (t )
259
-
260
258
id := "abcd-1234"
261
- closPath := filepath .Join (intelRdtRoot , id )
259
+ closName := id
260
+ preConfiguredClos := ""
262
261
if tt .config .ClosID != "" {
263
- closPath = filepath .Join (intelRdtRoot , tt .config .ClosID )
264
- // Pre-create the CLOS directory
265
- if err := os .MkdirAll (filepath .Join (closPath , "mon_groups" ), 0o755 ); err != nil {
266
- t .Fatal (err )
267
- }
262
+ closName = tt .config .ClosID
263
+ preConfiguredClos = closName
268
264
}
269
- m := newManager (& configs.Config {IntelRdt : & tt .config }, id , closPath )
265
+ NewIntelRdtTestUtil (t , preConfiguredClos )
266
+
267
+ m := newManager (& configs.Config {IntelRdt : & tt .config }, id , filepath .Join (intelRdtRoot , closName ))
270
268
if err := m .Apply (1234 ); err != nil {
271
269
t .Fatalf ("Apply() failed: %v" , err )
272
270
}
0 commit comments