1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:24:41 -07:00

debug/pe: modified windows test to look for a symbol

Requested by Alex Brainman to look for a common symbol
in atmfd.dll to verify that ImportedSymbols actually
works. EngMulDiv was chosen. This adds a loop to the
test that searches for that particular symbol.

src/debug/pe/file_test.go: updated test
This commit is contained in:
Ali Rizvi-Santiago 2018-05-15 13:02:13 -05:00
parent fd671ddd99
commit 83d8179235

View File

@ -538,11 +538,14 @@ func TestImportTableInUnknownSection(t *testing.T) {
t.Skip("skipping windows only test")
}
// driver and symbol to look for
const Filename = "atmfd.dll"
const Symbol = "EngMulDiv"
// first we need to find this font driver
const filename = "atmfd.dll"
path, err := exec.LookPath(filename)
path, err := exec.LookPath(Filename)
if err != nil {
t.Fatalf("unable to locate required file (%s) in search path: %s", filename, err)
t.Fatalf("unable to locate required file (%s) in search path: %s", Filename, err)
}
f, err := Open(path)
@ -557,6 +560,17 @@ func TestImportTableInUnknownSection(t *testing.T) {
}
if len(symbols) == 0 {
t.Fatalf("unable to locate any imported symbols within file %s", filename)
t.Fatalf("unable to locate any imported symbols within file %s", Filename)
}
found := false
for _, s := range symbols {
if s == "EngMulDiv" {
found = true
}
}
if !found {
t.Fatalf("unable to locate expected symbol (%s) within file %s", Symbol, Filename)
}
}