TeamCity: speed up ppc64le CI (#3622)

The builder is currently spending 15 to 20 minutes installing gcc and
upgrading packages every time we run the tests.
Because of this the build fails sometimes by running out of time.
This change reduces that to 5 minutes by:

* switching from curl to wget (which seems to have fewer dependencies)
* not installing gcc on ppc64le
* skipping tests that depend on gcc or other binutils
This commit is contained in:
Alessandro Arzilli
2024-01-09 23:13:00 +01:00
committed by GitHub
parent ae715a2b2d
commit 1a1e215fac
5 changed files with 26 additions and 7 deletions

View File

@ -2,12 +2,16 @@
set -e set -e
set -x set -x
apt-get -qq update
apt-get install -y gcc curl jq lsof
version=$1 version=$1
arch=$2 arch=$2
apt-get -qq update
if [ "$arch" = "ppc64le" ]; then
apt-get install --no-upgrade -y wget jq
else
apt-get install --no-upgrade -y gcc wget jq lsof
fi
if [ "$arch" != "ppc64le" ]; then if [ "$arch" != "ppc64le" ]; then
apt-get install -y dwz apt-get install -y dwz
@ -17,7 +21,7 @@ fi
function getgo { function getgo {
export GOROOT=/usr/local/go/$1 export GOROOT=/usr/local/go/$1
if [ ! -d "$GOROOT" ]; then if [ ! -d "$GOROOT" ]; then
curl -sO https://dl.google.com/go/"$1".linux-"${arch}".tar.gz wget -q https://dl.google.com/go/"$1".linux-"${arch}".tar.gz
mkdir -p /usr/local/go mkdir -p /usr/local/go
tar -C /usr/local/go -xzf "$1".linux-"${arch}".tar.gz tar -C /usr/local/go -xzf "$1".linux-"${arch}".tar.gz
mv -f /usr/local/go/go "$GOROOT" mv -f /usr/local/go/go "$GOROOT"
@ -26,7 +30,7 @@ function getgo {
if [ "$version" = "gotip" ]; then if [ "$version" = "gotip" ]; then
echo Building Go from tip echo Building Go from tip
getgo $(curl https://go.dev/VERSION?m=text | head -1) getgo $(wget -q -O - https://go.dev/VERSION?m=text | head -1)
export GOROOT_BOOTSTRAP=$GOROOT export GOROOT_BOOTSTRAP=$GOROOT
export GOROOT=/usr/local/go/go-tip export GOROOT=/usr/local/go/go-tip
apt-get install -y git apt-get install -y git
@ -37,9 +41,9 @@ if [ "$version" = "gotip" ]; then
else else
echo Finding latest patch version for $version echo Finding latest patch version for $version
echo "Go $version on $arch" echo "Go $version on $arch"
version=$(curl 'https://go.dev/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.|beta|rc)' | sort -rV | head -1) version=$(wget -q -O - 'https://go.dev/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.|beta|rc)' | sort -rV | head -1)
if [ "x$version" = "x" ]; then if [ "x$version" = "x" ]; then
version=$(curl 'https://go.dev/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.)' | sort -rV | head -1) version=$(wget -q -O - 'https://go.dev/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.)' | sort -rV | head -1)
fi fi
getgo $version getgo $version
fi fi

View File

@ -14,7 +14,15 @@ import (
protest "github.com/go-delve/delve/pkg/proc/test" protest "github.com/go-delve/delve/pkg/proc/test"
) )
func mustHaveObjcopy(t *testing.T) {
t.Helper()
if objcopyPath, _ := exec.LookPath("objcopy"); objcopyPath == "" {
t.Skip("no objcopy in path")
}
}
func TestLoadingExternalDebugInfo(t *testing.T) { func TestLoadingExternalDebugInfo(t *testing.T) {
mustHaveObjcopy(t)
fixture := protest.BuildFixture("locationsprog", 0) fixture := protest.BuildFixture("locationsprog", 0)
defer os.Remove(fixture.Path) defer os.Remove(fixture.Path)
stripAndCopyDebugInfo(fixture, t) stripAndCopyDebugInfo(fixture, t)
@ -26,6 +34,7 @@ func TestLoadingExternalDebugInfo(t *testing.T) {
} }
func TestGnuDebuglink(t *testing.T) { func TestGnuDebuglink(t *testing.T) {
mustHaveObjcopy(t)
// build math.go and make a copy of the executable // build math.go and make a copy of the executable
fixture := protest.BuildFixture("math", 0) fixture := protest.BuildFixture("math", 0)
buf, err := os.ReadFile(fixture.Path) buf, err := os.ReadFile(fixture.Path)

View File

@ -4449,6 +4449,7 @@ func findSource(source string, sources []string) bool {
} }
func TestListImages(t *testing.T) { func TestListImages(t *testing.T) {
protest.MustHaveCgo(t)
pluginFixtures := protest.WithPlugins(t, protest.AllNonOptimized, "plugin1/", "plugin2/") pluginFixtures := protest.WithPlugins(t, protest.AllNonOptimized, "plugin1/", "plugin2/")
withTestProcessArgs("plugintest", t, ".", []string{pluginFixtures[0].Path, pluginFixtures[1].Path}, protest.AllNonOptimized, func(p *proc.Target, grp *proc.TargetGroup, fixture protest.Fixture) { withTestProcessArgs("plugintest", t, ".", []string{pluginFixtures[0].Path, pluginFixtures[1].Path}, protest.AllNonOptimized, func(p *proc.Target, grp *proc.TargetGroup, fixture protest.Fixture) {
@ -4596,6 +4597,7 @@ func TestCallConcurrent(t *testing.T) {
} }
func TestPluginStepping(t *testing.T) { func TestPluginStepping(t *testing.T) {
protest.MustHaveCgo(t)
pluginFixtures := protest.WithPlugins(t, protest.AllNonOptimized, "plugin1/", "plugin2/") pluginFixtures := protest.WithPlugins(t, protest.AllNonOptimized, "plugin1/", "plugin2/")
testseq2Args(".", []string{pluginFixtures[0].Path, pluginFixtures[1].Path}, protest.AllNonOptimized, t, "plugintest2", "", []seqTest{ testseq2Args(".", []string{pluginFixtures[0].Path, pluginFixtures[1].Path}, protest.AllNonOptimized, t, "plugintest2", "", []seqTest{

View File

@ -7489,6 +7489,7 @@ func TestFindInstructions(t *testing.T) {
func TestDisassembleCgo(t *testing.T) { func TestDisassembleCgo(t *testing.T) {
// Test that disassembling a program containing cgo code does not create problems. // Test that disassembling a program containing cgo code does not create problems.
// See issue #3040 // See issue #3040
protest.MustHaveCgo(t)
runTestBuildFlags(t, "cgodisass", func(client *daptest.Client, fixture protest.Fixture) { runTestBuildFlags(t, "cgodisass", func(client *daptest.Client, fixture protest.Fixture) {
runDebugSessionWithBPs(t, client, "launch", runDebugSessionWithBPs(t, client, "launch",
// Launch // Launch

View File

@ -2789,6 +2789,9 @@ func TestNonGoDebug(t *testing.T) {
if runtime.GOOS != "linux" { if runtime.GOOS != "linux" {
t.Skip() t.Skip()
} }
if objcopyPath, _ := exec.LookPath("cc"); objcopyPath == "" {
t.Skip("no C compiler in path")
}
dir := protest.FindFixturesDir() dir := protest.FindFixturesDir()
path := protest.TempFile("testc") path := protest.TempFile("testc")
cmd := exec.Command("cc", "-g", "-o", path, filepath.Join(dir, "test.c")) cmd := exec.Command("cc", "-g", "-o", path, filepath.Join(dir, "test.c"))