I thought that hitting CTRL+C(i.e. sending SIGINT) is a relatively common way to abort tests that run for too long.
суббота, 4 марта 2017 г., 10:32:47 UTC+5 пользователь Ian Lance Taylor написал: > > On Fri, Mar 3, 2017 at 9:18 PM, <max.face...@gmail.com <javascript:>> > wrote: > >> I would not expect to get a CPU profile if you hit ^C. > > > > Just curious as of why? I mean we could use signal.Notify for that, no? > > We could, but why should we? We can't reasonably handle every > possible way that the program could crash early. If it's important > for a particular program to record a CPU profile even if the user hits > ^C, then I think the user should arrange for that to work. We > shouldn't build it into the test harness. > > Ian > > > > пятница, 3 марта 2017 г., 23:04:30 UTC+5 пользователь Ian Lance Taylor > > написал: > >> > >> On Fri, Mar 3, 2017 at 9:41 AM, <max.face...@gmail.com> wrote: > >> > Say you have a package with a test suite that completes in 30 seconds > on > >> > average. You run: > >> > > >> >> go test -cpuprofile cpu.pprof -timeout 10s > >> > > >> > > >> > Then whether you abort tests by hitting CTRL+C or they end with a > panic > >> > due > >> > to > >> > a low timeout value, in both cases, cpu.pprof will be empty. > >> > Is this intended behaviour or a bug? > >> > >> I would not expect to get a CPU profile if you hit ^C. > >> > >> If the test times out, I would expect to get a CPU profile. If we > >> don't get one, I think that is a bug. > >> > >> Ian > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to golang-nuts...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.