travis-ci: fix dwz test problems (#1648)

For some reason the version of dwz in Travis-CI now fails to run on Go
binaries. Ignore the particular error.
This commit is contained in:
Alessandro Arzilli 2019-07-31 22:09:00 +02:00 committed by Derek Parker
parent f4eaad69d9
commit 67b6d4b9c9
2 changed files with 9 additions and 5 deletions

@ -17,4 +17,5 @@ matrix:
before_install:
- export GOFLAGS=-mod=vendor
- if [ $TRAVIS_OS_NAME = "linux" ]; then sudo apt-get -qq update; sudo apt-get install -y dwz; fi
- if [ $TRAVIS_OS_NAME = "linux" ]; then sudo apt-get -qq update; sudo apt-get install -y dwz; echo "dwz version $(dwz --version)"; fi

@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
@ -138,7 +139,7 @@ func BuildFixture(name string, flags BuildFlags) Fixture {
if flags&BuildModePlugin != 0 {
buildFlags = append(buildFlags, "-buildmode=plugin")
}
if ver.AfterOrEqual(goversion.GoVersion{1, 11, -1, 0, 0, ""}) {
if ver.IsDevel() || ver.AfterOrEqual(goversion.GoVersion{1, 11, -1, 0, 0, ""}) {
if flags&EnableDWZCompression != 0 {
buildFlags = append(buildFlags, "-ldflags=-compressdwarf=false")
}
@ -160,9 +161,11 @@ func BuildFixture(name string, flags BuildFlags) Fixture {
if flags&EnableDWZCompression != 0 {
cmd := exec.Command("dwz", tmpfile)
if out, err := cmd.CombinedOutput(); err != nil {
fmt.Printf("Error running dwz on %s: %s\n", tmpfile, err)
fmt.Printf("%s\n", string(out))
os.Exit(1)
if regexp.MustCompile(`dwz: Section offsets in (.*?) not monotonically increasing`).FindString(string(out)) == "" {
fmt.Printf("Error running dwz on %s: %s\n", tmpfile, err)
fmt.Printf("%s\n", string(out))
os.Exit(1)
}
}
}