Praqma / memory-map-plugin

A repository for the memory-map-plugin
13 stars 16 forks source link

SECTIONS Regular expression for does not match trailing whitespaces (case 14948) #13

Open MadsNielsen opened 8 years ago

MadsNielsen commented 8 years ago

Suggestion for a solution: {{SECTIONS\s*?\r?\n?

{([\s\S]*)\n}

}}

if your Linker command file looks like this: {{SECTION {}} the regex will not match.

If it doesn't match, it fails with this stack trace (which is bad either): {{Memory Map Plugin version 2.1.2 (cfc34) ERROR: Build step failed with exception java.lang.NullPointerException at java.util.regex.Matcher.getTextLength(Unknown Source) at java.util.regex.Matcher.reset(Unknown Source) at java.util.regex.Matcher.(Unknown Source) at java.util.regex.Pattern.matcher(Unknown Source) at net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser.getSections(GccMemoryMapParser.java:102) at net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser.parseConfigFile(GccMemoryMapParser.java:180) at net.praqma.jenkins.memorymap.parser.MemoryMapConfigFileParserDelegate.invoke(MemoryMapConfigFileParserDelegate.java:58) at net.praqma.jenkins.memorymap.parser.MemoryMapConfigFileParserDelegate.invoke(MemoryMapConfigFileParserDelegate.java:40) at hudson.FilePath.act(FilePath.java:990) at hudson.FilePath.act(FilePath.java:968) at net.praqma.jenkins.memorymap.MemoryMapRecorder.perform(MemoryMapRecorder.java:160) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) at hudson.model.Run.execute(Run.java:1763) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Build step 'Memory Map Publisher' marked build as failure}}

buep commented 8 years ago

Reported originally in https://issues.jenkins-ci.org/browse/JENKINS-37061

AndersHoglund commented 8 years ago

If I have white space anywhere in the sections list, for example like this:

.isr_vector + .text+.ARM.extab + .ARM + .preinit_array + .init_array + .fini_array + .data

I get this (funny) message in the log:

Memory Map Plugin version 2.1.2 (cfc34)
The memory section named .isr_vector  not found in map file
Available sections are:
[.isr_vector, .text, .ARM.extab, .ARM, .preinit_array, .init_array, .fini_array, .data, .bss, ._user_heap_stack, .memory_b1_text, /DISCARD/, .ARM.attributes]
Build step 'Memory Map Publisher' marked build as failure
Finished: FAILURE

And the build fails. If I remove all white spaces it does not fail the build. Map file still not parsed correctly, but that is another issue. Not sure if this white space issue is the same as original posted issue, similar in any case.

Using Jenkins 2.7.1 on Ubuntu 16.04 with arm-gcc 5.4.1:

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
buep commented 8 years ago

@AndersHoglund - thanks, for reporting more information. We will look at the issue soon and fix it - currently awaiting estimation from and proposed fix from my colleague @MadsNielsen or @Ordojan on fixing this.

buep commented 7 years ago

I'm closing the Jenkins CI issue https://issues.jenkins-ci.org/browse/JENKINS-37061, as we only want to use GHI going forward.