Warnings parser - writing a new error parser

64 views
Skip to first unread message

Ken O

unread,
May 14, 2013, 10:40:48 AM5/14/13
to jenkin...@googlegroups.com
I'm making my first foray into Jenkins development by adding another parser for the warnings plugin.  I've found the compiler warnings emitted from my version of the IAR compiler (EWARM v6.3) are not parsed properly by the existing IAR warnings plugin.

I've created another version of the IAR plugin by copying the existing one and modifying the regex.  Is that the correct approach?  I considered the possibility of modifying the existing parser to handle multiple regex patterns but that was a little above my present level.  I've been an embedded developer for a long time.  Java dev and github is fairly new to me.

I have the parser working - except for implementing a test case for the new parser.

Any guidance would be helpful.

Thanks to Ulli for maintaining an excellent plugin!

-Ken

Slide

unread,
May 14, 2013, 11:18:04 AM5/14/13
to Jenkins Dev
The warnings plugin provides the ability to create new parsers via script in the global config. This is how I've always added parsers. For internal build tools it's nice because I don't have to maintain my own plugin for the parsing, I can just tweak a script.

slide



-Ken

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Website: http://earl-of-code.com

Baptiste Mathus

unread,
May 14, 2013, 11:40:31 AM5/14/13
to jenkin...@googlegroups.com

Hi,
You're on the right track :).

Here's the typical way/steps to proceed:
* find or create the corresponding issue in JIRA for reference
* "fork" the plugin in your github account (if not already done)
* clone it locally (if not done)
* create a dedicated branch
* Create a commit in that branch containing your fix
* push that branch on your github fork
* create a "pull request" for that branch
* reference that PR in the JIRA issue

Hth,might seem complex but many steps are actually quite simple.

Cheers

--

Ulli Hafner

unread,
May 14, 2013, 3:58:59 PM5/14/13
to jenkin...@googlegroups.com
How large are the differences between the two warning formats? If they are small I would prefer having just a single parser. This make things easer for the user, because there is just one selection possible for IAR. Maybe we can combine the 2 expressions into one that matches both.

Otherwise we can add your new parser (with a new name) to the warnings plug-in using the steps described by Baptiste.

In both cases it would be good to have a small unit test that verifies that the parsers works: you can have a look at the existing ones, shouldn't be hard to write a new one. Let me know if you need more details or help for the implementation...

Ulli

Ken Overly

unread,
May 15, 2013, 9:53:59 AM5/15/13
to jenkin...@googlegroups.com
Ulli,
I agree it would be best if they could be merged into the same parser.  I'm just not that good with regex to figure how to merge the two.  The differences are the 1) the use of quotes around the filename, 2) comma between filename and line number, and 3) colon between linenumber and warning level.

Here are the regex strings for the original IarParser and the new one that I wrote.

IarParser:
    private static final String IAR_WARNING_PATTERN =
        "^\"(.*?)\",(\\d+)\\s+(" + ERROR + OR + REMARK + OR + WARNING + OR + FATAL_ERROR + ")\\[(\\w+)\\]: (.*)$";


Mine:
    private static final String IAR_WARNING_PATTERN =
        "^(.*?)\\((\\d+)\\)\\s+: (" + ERROR + OR + REMARK + OR + WARNING + OR + FATAL_ERROR + ")\\[(\\w+)\\]: (.*)$";


Here are the format of the compiler warnings for each:

IarParser:  (deduced from a comment in a previous version of the parser)
"filename",linenumber level[tag]: message 

Mine:
filename(linenumber) : level[tag]: message 

Lastly, here is a sample of the compiler output:
C:\dev\bsc\daqtask.c(43) : Warning[Pe177]: variable "pgMsgEnv" was declared but never referenced

Thanks for your help!

-Ken



--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/RWCbH1DEe34/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

Ken Overly

unread,
May 15, 2013, 9:56:21 AM5/15/13
to jenkin...@googlegroups.com
Thanks for the info Baptiste.  It will come in handy when I get to the point when I need to commit my work.  I still have some design issues to sort out first.


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/RWCbH1DEe34/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

Ken Overly

unread,
May 15, 2013, 9:59:41 AM5/15/13
to jenkin...@googlegroups.com
Slide,
Thanks for the tip.  I started out creating a parser this way, but I didn't like the way the warnings were reported back to the build (graphs, etc).  It was likely because I didn't have the groovy script passing all the info that was needed.

I like the idea of incorporating the change into the IarParser class, that way others can benefit from it in the future.


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/RWCbH1DEe34/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

Ulli Hafner

unread,
May 15, 2013, 12:28:44 PM5/15/13
to jenkin...@googlegroups.com
Hi Ken,


Now the parser handles both formats. Will be part of the next warnings release… 

Thanks, Ulli

Ken Overly

unread,
May 15, 2013, 1:58:16 PM5/15/13
to jenkin...@googlegroups.com
Hi Ulli,

Wow!  Thanks for doing that.  I anticipated doing it myself and forcing me to learn something in the process.

Thanks again.

-Ken
Reply all
Reply to author
Forward
0 new messages