pkg/build: add a test for build failure root causing

Such error popped up during bisection on older kernels.
It's already detected properly, yet build failed with just "make failed"...
Unclear why that happened, but the test won't harm.

Update #501
This commit is contained in:
Dmitry Vyukov 2019-03-21 14:25:08 +01:00
parent a9007a8ccb
commit 7c9c9fd24f

View File

@ -37,6 +37,7 @@ func TestCompilerIdentity(t *testing.T) {
}
func TestExtractRootCause(t *testing.T) {
// nolint: lll
for _, s := range []struct{ e, expect string }{
{`
cc -g -Werror db_break.c
@ -51,6 +52,20 @@ int kcov_cold = 1;
`,
"sys/dev/kcov.c:93:6: error: use of undeclared identifier 'kcov_cold123'; did you mean 'kcov_cold'?",
},
{`
CC /tools/objtool/parse-options.o
In file included from ./scripts/gcc-plugins/gcc-common.h:119:0,
from <stdin>:1:
/gcc-5.5.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/include/builtins.h:23:17: fatal error: mpc.h: No such file or directory
compilation terminated.
Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?
scripts/Makefile.gcc-plugins:51: recipe for target 'gcc-plugins-check' failed
make: *** [gcc-plugins-check] Error 1
make: *** Waiting for unfinished jobs....
UPD include/config/kernel.release
`,
"/gcc-5.5.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/include/builtins.h:23:17: fatal error: mpc.h: No such file or directory",
},
} {
got := extractCauseInner([]byte(s.e))
if !bytes.Equal([]byte(s.expect), got) {