package main
import (
- "bufio"
- "bytes"
"fmt"
"internal/testenv"
"io/ioutil"
}
func TestNonGoExecs(t *testing.T) {
+ t.Parallel()
testfiles := []string{
"debug/elf/testdata/gcc-386-freebsd-exec",
"debug/elf/testdata/gcc-amd64-linux-exec",
}
func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
+ t.Parallel()
tmpdir, err := ioutil.TempDir("", "TestGoExec")
if err != nil {
t.Fatal(err)
return false
}
- scanner := bufio.NewScanner(bytes.NewBuffer(out))
dups := make(map[string]bool)
- for scanner.Scan() {
- f := strings.Fields(scanner.Text())
+ for _, line := range strings.Split(string(out), "\n") {
+ f := strings.Fields(line)
if len(f) < 3 {
continue
}
delete(runtimeSyms, name)
}
}
- err = scanner.Err()
- if err != nil {
- t.Fatalf("error reading nm output: %v", err)
- }
if len(names) > 0 {
t.Errorf("executable is missing %v symbols", names)
}
}
func testGoLib(t *testing.T, iscgo bool) {
+ t.Parallel()
tmpdir, err := ioutil.TempDir("", "TestGoLib")
if err != nil {
t.Fatal(err)
syms = append(syms, symType{"T", "cgofunc", true, false})
}
}
- scanner := bufio.NewScanner(bytes.NewBuffer(out))
- for scanner.Scan() {
- f := strings.Fields(scanner.Text())
+
+ for _, line := range strings.Split(string(out), "\n") {
+ f := strings.Fields(line)
var typ, name string
var csym bool
if iscgo {
}
}
}
- err = scanner.Err()
- if err != nil {
- t.Fatalf("error reading nm output: %v", err)
- }
for _, sym := range syms {
if !sym.Found {
t.Errorf("cannot found symbol %s %s", sym.Type, sym.Name)