* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
@ 2017-06-30 6:40 Uros Bizjak
2017-07-13 19:56 ` Ian Lance Taylor
0 siblings, 1 reply; 10+ messages in thread
From: Uros Bizjak @ 2017-06-30 6:40 UTC (permalink / raw)
To: gcc-patches; +Cc: Ian Taylor, gofrontend-dev
Hello!
> This patch to the gotools Makefile adds tests to `make check`. We now
> test the runtime package using the newly built go tool, and test that
> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
> Committed to mainline.
There are several failures on non-split targets, e.g.:
FAIL: TestCgoHandlesWlORIGIN
go_test.go:267: running testgo [build origin]
go_test.go:286: standard error:
go_test.go:287: # origin
cc1: error: '-fsplit-stack' requires assembler support for CFI
directives
cc1: error: '-fsplit-stack' is not supported by this compiler
configuration
and:
FAIL: TestCgoCrashHandler
crash_test.go:70: building testprogcgo []: exit status 2
# _/home/uros/git/gcc/libgo/go/runtime/testdata/testprogcgo
cc1: error: '-fsplit-stack' requires assembler support for CFI
directives
cc1: error: '-fsplit-stack' is not supported by this compiler
configuration
As evident from TestBuildDryRunWithCgo dump, -fsplit-stack argument is
added unconditionally to the compile flags.
Uros.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-06-30 6:40 gotools patch committed: Test runtime, misc/cgo/{test,testcarchive} Uros Bizjak
@ 2017-07-13 19:56 ` Ian Lance Taylor
2017-07-14 18:41 ` Uros Bizjak
0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2017-07-13 19:56 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]
On Thu, Jun 29, 2017 at 11:40 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
>> This patch to the gotools Makefile adds tests to `make check`. We now
>> test the runtime package using the newly built go tool, and test that
>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>> Committed to mainline.
>
> There are several failures on non-split targets, e.g.:
>
> FAIL: TestCgoHandlesWlORIGIN
> go_test.go:267: running testgo [build origin]
> go_test.go:286: standard error:
> go_test.go:287: # origin
> cc1: error: '-fsplit-stack' requires assembler support for CFI
> directives
> cc1: error: '-fsplit-stack' is not supported by this compiler
> configuration
>
> and:
>
> FAIL: TestCgoCrashHandler
> crash_test.go:70: building testprogcgo []: exit status 2
> # _/home/uros/git/gcc/libgo/go/runtime/testdata/testprogcgo
> cc1: error: '-fsplit-stack' requires assembler support for CFI
> directives
> cc1: error: '-fsplit-stack' is not supported by this compiler
> configuration
>
> As evident from TestBuildDryRunWithCgo dump, -fsplit-stack argument is
> added unconditionally to the compile flags.
Would you mind checking whether this patch fixes the problem on your
system? Thanks.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 877 bytes --]
diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go
index 72265efa..9623b9c3 100644
--- a/libgo/go/cmd/go/build.go
+++ b/libgo/go/cmd/go/build.go
@@ -3092,8 +3092,7 @@ func (tools gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile stri
if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" {
defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`)
}
- switch goarch {
- case "386", "amd64":
+ if b.gccSupportsFlag("-fsplit-stack") {
defs = append(defs, "-fsplit-stack")
}
defs = tools.maybePIC(defs)
@@ -3428,8 +3427,7 @@ func (b *builder) cgo(a *action, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofil
}
if _, ok := buildToolchain.(gccgoToolchain); ok {
- switch goarch {
- case "386", "amd64":
+ if b.gccSupportsFlag("-fsplit-stack") {
cgoCFLAGS = append(cgoCFLAGS, "-fsplit-stack")
}
cgoflags = append(cgoflags, "-gccgo")
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-07-13 19:56 ` Ian Lance Taylor
@ 2017-07-14 18:41 ` Uros Bizjak
2017-07-14 22:21 ` Ian Lance Taylor
0 siblings, 1 reply; 10+ messages in thread
From: Uros Bizjak @ 2017-07-14 18:41 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, gofrontend-dev
On Thu, Jul 13, 2017 at 9:56 PM, Ian Lance Taylor <iant@golang.org> wrote:
> On Thu, Jun 29, 2017 at 11:40 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>
>>> This patch to the gotools Makefile adds tests to `make check`. We now
>>> test the runtime package using the newly built go tool, and test that
>>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
>>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>>> Committed to mainline.
>>
>> There are several failures on non-split targets, e.g.:
>>
>> FAIL: TestCgoHandlesWlORIGIN
>> go_test.go:267: running testgo [build origin]
>> go_test.go:286: standard error:
>> go_test.go:287: # origin
>> cc1: error: '-fsplit-stack' requires assembler support for CFI
>> directives
>> cc1: error: '-fsplit-stack' is not supported by this compiler
>> configuration
>>
>> and:
>>
>> FAIL: TestCgoCrashHandler
>> crash_test.go:70: building testprogcgo []: exit status 2
>> # _/home/uros/git/gcc/libgo/go/runtime/testdata/testprogcgo
>> cc1: error: '-fsplit-stack' requires assembler support for CFI
>> directives
>> cc1: error: '-fsplit-stack' is not supported by this compiler
>> configuration
>>
>> As evident from TestBuildDryRunWithCgo dump, -fsplit-stack argument is
>> added unconditionally to the compile flags.
>
> Would you mind checking whether this patch fixes the problem on your
> system? Thanks.
Yes, this patch correctly detects that the compiler doesn't support
-fsplit-stack.
Thanks,
Uros.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-07-14 18:41 ` Uros Bizjak
@ 2017-07-14 22:21 ` Ian Lance Taylor
0 siblings, 0 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2017-07-14 22:21 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, gofrontend-dev
On Fri, Jul 14, 2017 at 11:41 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Jul 13, 2017 at 9:56 PM, Ian Lance Taylor <iant@golang.org> wrote:
>> On Thu, Jun 29, 2017 at 11:40 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>
>>>> This patch to the gotools Makefile adds tests to `make check`. We now
>>>> test the runtime package using the newly built go tool, and test that
>>>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
>>>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>>>> Committed to mainline.
>>>
>>> There are several failures on non-split targets, e.g.:
>>>
>>> FAIL: TestCgoHandlesWlORIGIN
>>> go_test.go:267: running testgo [build origin]
>>> go_test.go:286: standard error:
>>> go_test.go:287: # origin
>>> cc1: error: '-fsplit-stack' requires assembler support for CFI
>>> directives
>>> cc1: error: '-fsplit-stack' is not supported by this compiler
>>> configuration
>>>
>>> and:
>>>
>>> FAIL: TestCgoCrashHandler
>>> crash_test.go:70: building testprogcgo []: exit status 2
>>> # _/home/uros/git/gcc/libgo/go/runtime/testdata/testprogcgo
>>> cc1: error: '-fsplit-stack' requires assembler support for CFI
>>> directives
>>> cc1: error: '-fsplit-stack' is not supported by this compiler
>>> configuration
>>>
>>> As evident from TestBuildDryRunWithCgo dump, -fsplit-stack argument is
>>> added unconditionally to the compile flags.
>>
>> Would you mind checking whether this patch fixes the problem on your
>> system? Thanks.
>
> Yes, this patch correctly detects that the compiler doesn't support
> -fsplit-stack.
Thanks for checking. I've committed the patch to mainline.
Ian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-07-26 20:27 ` Ian Lance Taylor
2017-08-04 10:54 ` Uros Bizjak
@ 2017-08-14 8:27 ` Uros Bizjak
1 sibling, 0 replies; 10+ messages in thread
From: Uros Bizjak @ 2017-08-14 8:27 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, gofrontend-dev
On Wed, Jul 26, 2017 at 10:26 PM, Ian Lance Taylor <iant@golang.org> wrote:
> On Sat, Jul 22, 2017 at 11:08 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> This patch to the gotools Makefile adds tests to `make check`. We now
>>> test the runtime package using the newly built go tool, and test that
>>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
>>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>>> Committed to mainline.
>>
>> There is now only one remaining gotools testsuite failure on alpha:
>>
>> FAIL: TestBreakpoint
>> crash_test.go:106: testprog Breakpoint exit status: exit status 2
>> crash_test.go:310: output:
>> SIGTRAP: trace trap
>> PC=2199039253124 m=0 sigcode=0
>>
>> goroutine 1 [running]:
>>
>> goroutine 3 [runnable]:
>> created by runtime.SetFinalizer
>>
>> /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/mfinal.go:355
>> +1280
>>
>>
>>
>> want output containing: runtime.Breakpoint
>>
>> I would like to debug this one failure only. Is there a way to run
>> only one gotools test? Can you perhaps give a hint where to look in
>> the source?
>
> The test is TestBreakpoint in libgo/go/runtime/crash_test.go. It is
> testing that if it runs a program that calls `runtime.Breakpoint`,
> then `runtime.Breakpoint` will appear in the stack trace that the
> program emits.
>
> It does this by building a test program. The easy way to do this
> yourself is to run `make install` in your GCC build directory, set
> LD_LIBRARY_PATH if needed to include the newly installed libgo.so, and
> then do
>
> cd SRCDIR/libgo/go/runtime/testdata/testprog
> go build # run the `go` program installed from gotools, building
> ./testprog; you can use `go build -o /tmp/x` if you like
> ./testprog Breakpoint
>
> On my x86_64 system that prints the appended, which includes the
> desired `runtime.Breakpoint` string. On your system it fails to print
> a stack trace, but I don't know why.
>
> Ian
>
>
>
> SIGILL: illegal instruction
> PC=140647499814795 m=0 sigcode=2
On a related note, the above is printed from:
go/runtime/signal_sighandler.go: print("PC=", hex(sigpc), "
m=", _g_.m.id, " sigcode=", c.sigcode(), "\n")
with the intention that PC is printed in the hex notation, but this is
not the case in the dumps.
I suspect hex(...) function is not working properly.
Uros.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-08-04 10:54 ` Uros Bizjak
@ 2017-08-04 13:46 ` Ian Lance Taylor
0 siblings, 0 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2017-08-04 13:46 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, gofrontend-dev
On Fri, Aug 4, 2017 at 3:54 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> The problem was following:
>
> runtime.Breakpoint comprises only call to __builtin_trap (), which in
> case of alpha maps to "call_pall 0x81". Since __builtin_trap () is a
> noreturn function, no other instructions are emitted after call_pal.
>
> However, when call_pal insn is executed, alpha updates program counter
> before the signal is raised. As call_pal was the last insn, updated PC
> points outside of the function boundaries, and backtrace (and gdb,
> FWIW) failed to found enclosing function.
>
> The solution is to emit nop after call_pal insn, so PC will always
> remain between function boundaries.
>
> Attached patch implements dumpregs function for alpha.
Thanks for analyzing the problem.
I committed the dump-registers patch to mainline.
Ian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-07-26 20:27 ` Ian Lance Taylor
@ 2017-08-04 10:54 ` Uros Bizjak
2017-08-04 13:46 ` Ian Lance Taylor
2017-08-14 8:27 ` Uros Bizjak
1 sibling, 1 reply; 10+ messages in thread
From: Uros Bizjak @ 2017-08-04 10:54 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 3733 bytes --]
On Wed, Jul 26, 2017 at 10:26 PM, Ian Lance Taylor <iant@golang.org> wrote:
> On Sat, Jul 22, 2017 at 11:08 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> This patch to the gotools Makefile adds tests to `make check`. We now
>>> test the runtime package using the newly built go tool, and test that
>>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
>>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>>> Committed to mainline.
>>
>> There is now only one remaining gotools testsuite failure on alpha:
>>
>> FAIL: TestBreakpoint
>> crash_test.go:106: testprog Breakpoint exit status: exit status 2
>> crash_test.go:310: output:
>> SIGTRAP: trace trap
>> PC=2199039253124 m=0 sigcode=0
>>
>> goroutine 1 [running]:
>>
>> goroutine 3 [runnable]:
>> created by runtime.SetFinalizer
>>
>> /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/mfinal.go:355
>> +1280
>>
>>
>>
>> want output containing: runtime.Breakpoint
>>
>> I would like to debug this one failure only. Is there a way to run
>> only one gotools test? Can you perhaps give a hint where to look in
>> the source?
>
> The test is TestBreakpoint in libgo/go/runtime/crash_test.go. It is
> testing that if it runs a program that calls `runtime.Breakpoint`,
> then `runtime.Breakpoint` will appear in the stack trace that the
> program emits.
>
> It does this by building a test program. The easy way to do this
> yourself is to run `make install` in your GCC build directory, set
> LD_LIBRARY_PATH if needed to include the newly installed libgo.so, and
> then do
>
> cd SRCDIR/libgo/go/runtime/testdata/testprog
> go build # run the `go` program installed from gotools, building
> ./testprog; you can use `go build -o /tmp/x` if you like
> ./testprog Breakpoint
>
> On my x86_64 system that prints the appended, which includes the
> desired `runtime.Breakpoint` string. On your system it fails to print
> a stack trace, but I don't know why.
The problem was following:
runtime.Breakpoint comprises only call to __builtin_trap (), which in
case of alpha maps to "call_pall 0x81". Since __builtin_trap () is a
noreturn function, no other instructions are emitted after call_pal.
However, when call_pal insn is executed, alpha updates program counter
before the signal is raised. As call_pal was the last insn, updated PC
points outside of the function boundaries, and backtrace (and gdb,
FWIW) failed to found enclosing function.
The solution is to emit nop after call_pal insn, so PC will always
remain between function boundaries.
Attached patch implements dumpregs function for alpha.
Bootstrapped and regression tested on alphaev68-linux-gnu, and also
checked that gdb and dumpregs produce the same register layout and
values.
Using both pathces, I get:
$ ./testprog Breakpoint
SIGTRAP: trace trap
PC=2199039251764 m=0 sigcode=0
goroutine 1 [running]:
runtime.Breakpoint
/space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/proc.go:2862
main.Breakpoint
/space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/testdata/testprog/deadlock.go:145
main.main
/space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/testdata/testprog/main.go:34
v0 0x20000f41530
t0 0x120023f30
t1 0x200000ca328
t2 0x20000038000
t3 0x200002e7766
t4 0x40
t5 0x4
t6 0x1f
t7 0x3f
s0 0x20001f49fb9
s1 0x10
s2 0xc420004960
s3 0x0
s4 0x200017da6a8
s5 0x0
fp 0x20001f49df0
a0 0x11fffd4f4
a1 0x12000dd6c
a2 0x11fffd4fe
a3 0x1
a4 0x17
a5 0x3
t8 0x2000002e030
t9 0x1
t10 0x0
t11 0x20001f49b20
ra 0x120006a3c
t12 0x20000f41530
at 0x6974f985
gp 0x2000003e030
sp 0x20001f49df0
pc 0x20000f41534
Uros.
[-- Attachment #2: g.diff.txt --]
[-- Type: text/plain, Size: 1890 bytes --]
Index: runtime/go-signal.c
===================================================================
--- runtime/go-signal.c (revision 250853)
+++ runtime/go-signal.c (working copy)
@@ -298,4 +298,45 @@ dumpregs(siginfo_t *info __attribute__((unused)),
}
#endif
#endif
+
+#ifdef __alpha__
+ #ifdef __linux__
+ {
+ mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
+
+ runtime_printf("v0 %X\n", m->sc_regs[0]);
+ runtime_printf("t0 %X\n", m->sc_regs[1]);
+ runtime_printf("t1 %X\n", m->sc_regs[2]);
+ runtime_printf("t2 %X\n", m->sc_regs[3]);
+ runtime_printf("t3 %X\n", m->sc_regs[4]);
+ runtime_printf("t4 %X\n", m->sc_regs[5]);
+ runtime_printf("t5 %X\n", m->sc_regs[6]);
+ runtime_printf("t6 %X\n", m->sc_regs[7]);
+ runtime_printf("t7 %X\n", m->sc_regs[8]);
+ runtime_printf("s0 %X\n", m->sc_regs[9]);
+ runtime_printf("s1 %X\n", m->sc_regs[10]);
+ runtime_printf("s2 %X\n", m->sc_regs[11]);
+ runtime_printf("s3 %X\n", m->sc_regs[12]);
+ runtime_printf("s4 %X\n", m->sc_regs[13]);
+ runtime_printf("s5 %X\n", m->sc_regs[14]);
+ runtime_printf("fp %X\n", m->sc_regs[15]);
+ runtime_printf("a0 %X\n", m->sc_regs[16]);
+ runtime_printf("a1 %X\n", m->sc_regs[17]);
+ runtime_printf("a2 %X\n", m->sc_regs[18]);
+ runtime_printf("a3 %X\n", m->sc_regs[19]);
+ runtime_printf("a4 %X\n", m->sc_regs[20]);
+ runtime_printf("a5 %X\n", m->sc_regs[21]);
+ runtime_printf("t8 %X\n", m->sc_regs[22]);
+ runtime_printf("t9 %X\n", m->sc_regs[23]);
+ runtime_printf("t10 %X\n", m->sc_regs[24]);
+ runtime_printf("t11 %X\n", m->sc_regs[25]);
+ runtime_printf("ra %X\n", m->sc_regs[26]);
+ runtime_printf("t12 %X\n", m->sc_regs[27]);
+ runtime_printf("at %X\n", m->sc_regs[28]);
+ runtime_printf("gp %X\n", m->sc_regs[29]);
+ runtime_printf("sp %X\n", m->sc_regs[30]);
+ runtime_printf("pc %X\n", m->sc_pc);
+ }
+ #endif
+#endif
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
2017-07-22 18:08 Uros Bizjak
@ 2017-07-26 20:27 ` Ian Lance Taylor
2017-08-04 10:54 ` Uros Bizjak
2017-08-14 8:27 ` Uros Bizjak
0 siblings, 2 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2017-07-26 20:27 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, gofrontend-dev
On Sat, Jul 22, 2017 at 11:08 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> This patch to the gotools Makefile adds tests to `make check`. We now
>> test the runtime package using the newly built go tool, and test that
>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>> Committed to mainline.
>
> There is now only one remaining gotools testsuite failure on alpha:
>
> FAIL: TestBreakpoint
> crash_test.go:106: testprog Breakpoint exit status: exit status 2
> crash_test.go:310: output:
> SIGTRAP: trace trap
> PC=2199039253124 m=0 sigcode=0
>
> goroutine 1 [running]:
>
> goroutine 3 [runnable]:
> created by runtime.SetFinalizer
>
> /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/mfinal.go:355
> +1280
>
>
>
> want output containing: runtime.Breakpoint
>
> I would like to debug this one failure only. Is there a way to run
> only one gotools test? Can you perhaps give a hint where to look in
> the source?
The test is TestBreakpoint in libgo/go/runtime/crash_test.go. It is
testing that if it runs a program that calls `runtime.Breakpoint`,
then `runtime.Breakpoint` will appear in the stack trace that the
program emits.
It does this by building a test program. The easy way to do this
yourself is to run `make install` in your GCC build directory, set
LD_LIBRARY_PATH if needed to include the newly installed libgo.so, and
then do
cd SRCDIR/libgo/go/runtime/testdata/testprog
go build # run the `go` program installed from gotools, building
./testprog; you can use `go build -o /tmp/x` if you like
./testprog Breakpoint
On my x86_64 system that prints the appended, which includes the
desired `runtime.Breakpoint` string. On your system it fails to print
a stack trace, but I don't know why.
Ian
SIGILL: illegal instruction
PC=140647499814795 m=0 sigcode=2
goroutine 1 [running]:
:0
runtime.Breakpoint
../../../gccgo3/libgo/go/runtime/proc.go:2812
main.Breakpoint
/home/iant/gofrontend3/libgo/go/runtime/testdata/testprog/deadlock.go:145
main.main
/home/iant/gofrontend3/libgo/go/runtime/testdata/testprog/main.go:34
:0
rax 0x40687c
rbx 0xc4200307e0
rcx 0x746e
rdx 0xc42003c388
rdi 0x7ffca81b3697
rsi 0x40d910
rbp 0x7feb0ac87eb0
rsp 0x7feb0ac87ea8
r8 0x17
r9 0x3
r10 0x7feb0ac87c70
r11 0x7feb0c43d780
r12 0xc42006e220
r13 0x40e6e0
r14 0x7feb0caf34c0
r15 0x0
rip 0x7feb0c43d78b
rflags 0x10202
cs 0x33
fs 0x0
gs 0x0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
@ 2017-07-22 18:08 Uros Bizjak
2017-07-26 20:27 ` Ian Lance Taylor
0 siblings, 1 reply; 10+ messages in thread
From: Uros Bizjak @ 2017-07-22 18:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Ian Taylor, gofrontend-dev
> This patch to the gotools Makefile adds tests to `make check`. We now
> test the runtime package using the newly built go tool, and test that
> cgo works by running the misc/cgo/test and misc/cgo/testcarchive
> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
> Committed to mainline.
There is now only one remaining gotools testsuite failure on alpha:
FAIL: TestBreakpoint
crash_test.go:106: testprog Breakpoint exit status: exit status 2
crash_test.go:310: output:
SIGTRAP: trace trap
PC=2199039253124 m=0 sigcode=0
goroutine 1 [running]:
goroutine 3 [runnable]:
created by runtime.SetFinalizer
/space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/mfinal.go:355
+1280
want output containing: runtime.Breakpoint
I would like to debug this one failure only. Is there a way to run
only one gotools test? Can you perhaps give a hint where to look in
the source?
Uros.
^ permalink raw reply [flat|nested] 10+ messages in thread
* gotools patch committed: Test runtime, misc/cgo/{test,testcarchive}
@ 2017-06-29 16:01 Ian Lance Taylor
0 siblings, 0 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2017-06-29 16:01 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 856 bytes --]
This patch to the gotools Makefile adds tests to `make check`. We now
test the runtime package using the newly built go tool, and test that
cgo works by running the misc/cgo/test and misc/cgo/testcarchive
tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
Committed to mainline.
Ian
2017-06-29 Ian Lance Taylor <iant@golang.org>
* Makefile.am (MOSTLYCLEANFILES): Remove testing files and logs.
(mostlyclean-local): Remove check-runtime-dir, cgo-test-dir,
carchive-test-dir.
(ECHO_ENV): Define.
(check-go-tool): Depend on cgo. Write command to testlog.
(check-runtime): New target.
(check-cgo-test): New target.
(check-carchive-test): New target.
(check): Depend on check-runtime, check-cgo-test,
check-carchive-test. Add @ to prettify output.
(.PHONY): Add check-runtime, check-cgo-test, check-carchive-test.
* Makefile.in: Rebuild.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 8183 bytes --]
Index: Makefile.am
===================================================================
--- Makefile.am (revision 249758)
+++ Makefile.am (working copy)
@@ -44,6 +44,7 @@ GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_
libgosrcdir = $(srcdir)/../libgo/go
cmdsrcdir = $(libgosrcdir)/cmd
+libgomiscdir = $(srcdir)/../libgo/misc
go_cmd_go_files = \
$(cmdsrcdir)/go/alldocs.go \
@@ -106,7 +107,12 @@ s-zdefaultcc: Makefile
$(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
$(STAMP) $@
-MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
+MOSTLYCLEANFILES = \
+ zdefaultcc.go s-zdefaultcc \
+ check-gccgo gotools.head *-testlog gotools.sum gotools.log
+
+mostlyclean-local:
+ rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir
if NATIVE
@@ -156,6 +162,7 @@ check-gccgo: Makefile
chmod +x $@
# CHECK_ENV sets up the environment to run the newly built go tool.
+# If you change this, change ECHO_ENV, below.
CHECK_ENV = \
PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
export PATH; \
@@ -169,25 +176,81 @@ CHECK_ENV = \
LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
export LD_LIBRARY_PATH;
+# ECHO_ENV is a variant of CHECK_ENV to put into a testlog file.
+# It assumes that abs_libgodir is set.
+ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`
+
# check-go-tools runs `go test cmd/go` in our environment.
-check-go-tool: go$(EXEEXT) check-head check-gccgo
- rm -rf check-go-dir
+check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+ rm -rf check-go-dir cmd_go-testlog
$(MKDIR_P) check-go-dir/src/cmd/go
cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/
cp $(libgodir)/zstdpkglist.go check-go-dir/src/cmd/go/
cp zdefaultcc.go check-go-dir/src/cmd/go/
cp -r $(cmdsrcdir)/go/testdata check-go-dir/src/cmd/go/
+ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+ abs_checkdir=`cd check-go-dir && $(PWD_COMMAND)`; \
+ echo "cd check-go-dir/src/cmd/go && $(ECHO_ENV) GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short -test.v" > cmd_go-testlog
$(CHECK_ENV) \
GOPATH=`cd check-go-dir && $(PWD_COMMAND)`; \
export GOPATH; \
(cd check-go-dir/src/cmd/go && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) > cmd_go-testlog 2>&1 || true
grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+# check-runtime runs `go test runtime` in our environment.
+# The runtime package is also tested as part of libgo,
+# but the runtime tests use the go tool heavily, so testing
+# here too will catch more problems.
+check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+ rm -rf check-runtime-dir runtime-testlog
+ $(MKDIR_P) check-runtime-dir
+ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+ LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+ GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
+ GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
+ files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \
+ echo "$(ECHO_ENV) GC='$(abs_builddir)/check-gccgo -fgo-compiling-runtime' GOARCH=$${GOARCH} GOOS=$${GOOS} $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles='$${files}' -test.v" > runtime-testlog
+ $(CHECK_ENV) \
+ GC="$${GCCGO} -fgo-compiling-runtime"; \
+ export GC; \
+ GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
+ GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
+ files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \
+ $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" -test.v >> runtime-testlog 2>&1 || true
+ grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
+# check-cgo-test runs `go test misc/cgo/test` in our environment.
+check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+ rm -rf cgo-test-dir cgo-testlog
+ $(MKDIR_P) cgo-test-dir/misc/cgo
+ cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/
+ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+ echo "cd cgo-test-dir/misc/cgo/test && $(ECHO_ENV) GOTRACEBACK=2 $(abs_builddir)/go$(EXEEXT) test -test.short -test.v" > cgo-testlog
+ $(CHECK_ENV) \
+ GOTRACEBACK=2; \
+ export GOTRACEBACK; \
+ (cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) >> cgo-testlog 2>&1 || true
+ grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
+# check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go`
+# in our environment.
+check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+ rm -rf carchive-test-dir carchive-testlog
+ $(MKDIR_P) carchive-test-dir/misc/cgo
+ cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/
+ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+ echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.v carchive_test.go" > carchive-testlog
+ $(CHECK_ENV) \
+ LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+ export LIBRARY_PATH; \
+ (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.v carchive_test.go) >> carchive-testlog 2>&1 || true
+ grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
# The check targets runs the tests and assembles the output files.
-check: check-head check-go-tool
- mv gotools.head gotools.sum
- cp gotools.sum gotools.log
- for file in cmd_go-testlog; do \
+check: check-head check-go-tool check-runtime check-cgo-test check-carchive-test
+ @mv gotools.head gotools.sum
+ @cp gotools.sum gotools.log
+ @for file in cmd_go-testlog runtime-testlog cgo-testlog carchive-testlog; do \
testname=`echo $${file} | sed -e 's/-testlog//' -e 's|_|/|'`; \
echo "Running $${testname}" >> gotools.sum; \
echo "Running $${testname}" >> gotools.log; \
@@ -196,24 +259,24 @@ check: check-head check-go-tool
done
@echo >> gotools.sum
@echo " === gotools Summary ===" >> gotools.sum
- pass=`grep -c '^PASS' gotools.sum`; \
+ @pass=`grep -c '^PASS' gotools.sum`; \
if test "$${pass}" -ne "0"; then \
echo "# of expected passes $${pass}" >> gotools.sum; \
fi
- fail=`grep -c '^FAIL' gotools.sum`; \
+ @fail=`grep -c '^FAIL' gotools.sum`; \
if test "$${fail}" -ne "0"; then \
echo "# of unexpected failures $${fail}" >> gotools.sum; \
fi
- untested=`grep -c '^UNTESTED' gotools.sum`; \
+ @untested=`grep -c '^UNTESTED' gotools.sum`; \
if test "$${untested}" -ne "0"; then \
echo "# of untested testcases $${untested}" >> gotools.sum; \
fi
- echo `echo $(GOC_FOR_TARGET) | sed -e 's/ .*//'` `$(GOC_FOR_TARGET) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> gotools.sum
- echo >> gotools.log
- echo "runtest completed at `date`" >> gotools.log
- if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
+ @echo `echo $(GOC_FOR_TARGET) | sed -e 's/ .*//'` `$(GOC_FOR_TARGET) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> gotools.sum
+ @echo >> gotools.log
+ @echo "runtest completed at `date`" >> gotools.log
+ @if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
-.PHONY: check check-head check-go-tool
+.PHONY: check check-head check-go-tool check-runtime check-cgo-test check-carchive-test
else
@@ -224,6 +287,3 @@ else
# the go/build package. Figure this out later.
endif
-
-mostlyclean-local:
- rm -rf check-go-dir
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-08-14 7:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 6:40 gotools patch committed: Test runtime, misc/cgo/{test,testcarchive} Uros Bizjak
2017-07-13 19:56 ` Ian Lance Taylor
2017-07-14 18:41 ` Uros Bizjak
2017-07-14 22:21 ` Ian Lance Taylor
-- strict thread matches above, loose matches on Subject: below --
2017-07-22 18:08 Uros Bizjak
2017-07-26 20:27 ` Ian Lance Taylor
2017-08-04 10:54 ` Uros Bizjak
2017-08-04 13:46 ` Ian Lance Taylor
2017-08-14 8:27 ` Uros Bizjak
2017-06-29 16:01 Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).