Skip to content

Commit

Permalink
pkg/uefi/meregion: add simple test to parse a valid FPT
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Maslowski <[email protected]>
  • Loading branch information
orangecms committed Sep 29, 2024
1 parent a6e8a30 commit 0eafcf3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/uefi/meregion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package uefi

import (
"os"
"reflect"
"testing"
)
Expand Down Expand Up @@ -91,3 +92,25 @@ func TestFindFPTSignature(t *testing.T) {
})
}
}

func TestParseFPT(t *testing.T) {
t.Run("parse ME FPT", func(t *testing.T) {
meRegion, err := os.ReadFile("../../data/PurleySiliconBinPkg/MeFirmware/IgnitionFirmware/MeRegion.bin")
if err != nil {
t.Errorf("%q", err)
}
expectedEntries := 10

fpt, err := NewMEFPT(meRegion)
if err != nil {
t.Errorf("expected no error reading a valid ME FPT")
}
entries := len(fpt.Entries)
if entries != expectedEntries {
t.Errorf("expected %d entries, got %d", expectedEntries, entries)
}
if entries != int(fpt.PartitionCount) {
t.Errorf("expected PartitionCount (%d) to match number of entries, got %d", fpt.PartitionCount, entries)
}
})
}

0 comments on commit 0eafcf3

Please sign in to comment.