| 1 | package parser_test |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" |
| 7 | "review.coreboot.org/coreboot.git/util/intelp2m/parser" |
| 8 | "review.coreboot.org/coreboot.git/util/intelp2m/parser/test" |
| 9 | ) |
| 10 | |
| 11 | const TestLogFilePath = "./testlog/inteltool_test.log" |
| 12 | |
| 13 | func TestParser(t *testing.T) { |
| 14 | t.Run("PARSER/PARSE-INTELTOOL-FILE", func(t *testing.T) { |
| 15 | |
| 16 | p2m.Config.AutoCheck = false |
| 17 | p2m.Config.Field = p2m.NoFlds |
| 18 | p2m.Config.GenLevel = 1 |
| 19 | p2m.Config.InputPath = TestLogFilePath |
| 20 | |
| 21 | entries, err := parser.Run() |
| 22 | if err != nil { |
| 23 | t.Errorf("failed to run parser: %v", err) |
| 24 | } |
| 25 | |
| 26 | for i := range test.Suite { |
| 27 | if entries[i] != test.Suite[i] { |
| 28 | t.Errorf("\nExpects: '%v'\nActually: '%v'\n\n", test.Suite[i], entries[i]) |
| 29 | } |
| 30 | } |
| 31 | }) |
| 32 | } |