Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_scripts: fix CI on go1.19/linux/386 #3100

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions _scripts/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,17 @@ func testCmdIntl(testSet, testRegex, testBackend, testBuildMode string) {
buildModeFlag = "-test-buildmode=" + testBuildMode
}

env := []string{}
if os.Getenv("CI") != "" {
env = os.Environ()
}

if len(testPackages) > 3 {
env := []string{}
executeq(env, "go", "test", testFlags(), buildFlags(), testPackages, backendFlag, buildModeFlag)
} else if testRegex != "" {
execute("go", "test", testFlags(), buildFlags(), testPackages, "-run="+testRegex, backendFlag, buildModeFlag)
executeq(env, "go", "test", testFlags(), buildFlags(), testPackages, "-run="+testRegex, backendFlag, buildModeFlag)
} else {
execute("go", "test", testFlags(), buildFlags(), testPackages, backendFlag, buildModeFlag)
executeq(env, "go", "test", testFlags(), buildFlags(), testPackages, backendFlag, buildModeFlag)
}
}

Expand Down
7 changes: 7 additions & 0 deletions _scripts/test_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ elif [ ${version:4:2} -gt 17 ]; then
export GOFLAGS=-buildvcs=false
fi

if [ "$arch" = "386" ]; then
ver=$(go version)
if [ "$ver" = "go version go1.19 linux/386" ]; then
export CGO_CFLAGS='-g -O0 -fno-stack-protector'
fi
fi

set +e
make test
x=$?
Expand Down
9 changes: 7 additions & 2 deletions cmd/dlv/dlv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ func TestBuild(t *testing.T) {

scan := bufio.NewScanner(stderr)
// wait for the debugger to start
scan.Scan()
t.Log(scan.Text())
for scan.Scan() {
text := scan.Text()
t.Log(text)
if strings.Contains(text, "API server pid = ") {
break
}
}
go func() {
for scan.Scan() {
t.Log(scan.Text())
Expand Down
7 changes: 6 additions & 1 deletion pkg/proc/test/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ func BuildFixture(name string, flags BuildFlags) Fixture {
}

if flags&EnableCGOOptimization == 0 {
os.Setenv("CGO_CFLAGS", "-O0 -g")
if os.Getenv("CI") == "" || os.Getenv("CGO_CFLAGS") == "" {
os.Setenv("CGO_CFLAGS", "-O0 -g")
}
}

fixturesDir := FindFixturesDir()
Expand Down Expand Up @@ -163,6 +165,9 @@ func BuildFixture(name string, flags BuildFlags) Fixture {

cmd := exec.Command("go", buildFlags...)
cmd.Dir = dir
if os.Getenv("CI") != "" {
cmd.Env = os.Environ()
}

// Build the test binary
if out, err := cmd.CombinedOutput(); err != nil {
Expand Down