Skip to content

Commit 1d99c03

Browse files
ipuustinklauspost
authored andcommitted
Fix SGX tests. (#39)
There might be cases where an SGX-enabled device hasn't got SGX EPC subleafs. However, if there are such leaves, the total amount of memory must not be 0. Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
1 parent 0202b0b commit 1d99c03

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

cpuid_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,15 @@ func TestSGX(t *testing.T) {
283283
}
284284
t.Log("SGX Support:", got)
285285

286-
var total uint64 = 0
287286
if CPU.SGX.Available {
287+
var total uint64 = 0
288+
leaves := false
288289
for _, s := range CPU.SGX.EPCSections {
289290
t.Logf("SGX EPC section: base address 0x%x, size %v", s.BaseAddress, s.EPCSize)
290291
total += s.EPCSize
292+
leaves = true
291293
}
292-
if total == 0 {
294+
if leaves && total == 0 {
293295
t.Fatal("SGX enabled without any available EPC memory")
294296
}
295297
}

0 commit comments

Comments
 (0)