Skip to content

testing: call (*M).after on signal or internal-generated panic #19394

@codesenberg

Description

@codesenberg

What version of Go are you using (go version)?

go version go1.8 windows/amd64

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\frei\Documents\Go\Workspaces\Default
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\frei\AppData\Local\Temp\go-build564910375=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

Ran go test -cpuprofile cpu.pprof -memprofile mem.pprof -timeout 10s in a folder with the following test file:

package main

import (
	"flag"
	"runtime"
	"testing"
	"time"
)

var (
	testDuration = flag.Duration(
		"duration", 30*time.Second, "how long to run tests",
	)
	workers = flag.Uint("workers", 10, "number of workers")
)

func TestDummy(t *testing.T) {
	for i := uint(0); i < *workers; i++ {
		go func() {
			counter := 0
			for {
				counter++
				runtime.Gosched()
			}
		}()
	}
	time.Sleep(*testDuration)
}

What did you expect to see?

Tests to end with a panic and non-empty profiles in cpu.pprof and mem.pprof.

What did you see instead?

Tests ended with a panic, but cpu.pprof was empty and mem.pprof wasn't created at all.

Previous discussion on #golang-nuts: link.

/cc @ianlancetaylor

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions