buildlogparser 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -0
- data/lib/buildlogparser.rb +22 -0
- data/lib/buildlogparser/parser.rb +20 -0
- data/lib/buildlogparser/parsers/cmake.rb +21 -1
- data/lib/buildlogparser/parsers/coremark.rb +75 -0
- data/lib/buildlogparser/parsers/ctest.rb +23 -1
- data/lib/buildlogparser/parsers/dhrystone.rb +82 -0
- data/lib/buildlogparser/parsers/size.rb +21 -1
- data/lib/buildlogparser/version.rb +21 -1
- metadata +5 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 59cd5db3c32fbaa1661e52339556610ed8d2421b
         | 
| 4 | 
            +
              data.tar.gz: 50684c3e7a2fa6581485d61a132b4a5f762a2efa
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ebd7d3882c3f94abc29485ede40d3a3f9c9c3d606c029f77b1dc0f51c08c0ac9d78a8196ed8e8284529767df4b6f538b5acd976972ed85053fc8883065985e9f
         | 
| 7 | 
            +
              data.tar.gz: 5a820e1a61ee9d92148288e05aee4ac6c7971dc1d53e73c32f3a1318d445d7dc0a3b0d2c2b8ebb844d6764d9bc9f24621fd26ea4c2c5e2aaae49ff757c34da92
         | 
    
        data/CHANGELOG.md
    ADDED
    
    | @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            # Changelog
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            ## v0.2.0 (28.10.2017)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Added support for parsing *coremark* command line output
         | 
| 6 | 
            +
            * Added support for parsing *dhrystone* command line output
         | 
| 7 | 
            +
            * [ctest] Fixed parsing of regex errors in the command line output
         | 
| 8 | 
            +
            * [cmake] Fixed parsing of non empty text which does not match
         | 
| 9 | 
            +
            * [size] Fixed parsing of non empty text which does not match
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## v0.1.0 (Unreleased)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            * Added support for parsing *cmake* generated makefile command line output
         | 
| 14 | 
            +
            * Added support for parsing *ctest* command line output
         | 
| 15 | 
            +
            * Added support for parsing *ctest* generated `LastTest.log` files
         | 
| 16 | 
            +
            * Added support for parsing *size* command line output in Berkeley format
         | 
    
        data/LICENSE.txt
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            [](https://rubygems.org/gems/buildlogparser)
         | 
| 1 2 | 
             
            [](https://travis-ci.org/niosHD/buildlogparser)
         | 
| 2 3 | 
             
            [](https://codecov.io/gh/niosHD/buildlogparser)
         | 
| 3 4 |  | 
| @@ -8,4 +9,6 @@ Collection of various parsers for the extraction of information from build and e | |
| 8 9 | 
             
            ## Tested Program Versions 
         | 
| 9 10 |  | 
| 10 11 | 
             
            * cmake/ctest 3.5.1
         | 
| 12 | 
            +
            * coremark 1.0
         | 
| 13 | 
            +
            * dhrystone (C Version) 2.1 and 2.2
         | 
| 11 14 | 
             
            * size (GNU Binutils 2.26.1)
         | 
    
        data/lib/buildlogparser.rb
    CHANGED
    
    | @@ -1,6 +1,28 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 1 21 | 
             
            require "buildlogparser/parser"
         | 
| 2 22 | 
             
            require "buildlogparser/parsers/cmake"
         | 
| 23 | 
            +
            require "buildlogparser/parsers/coremark"
         | 
| 3 24 | 
             
            require "buildlogparser/parsers/ctest"
         | 
| 25 | 
            +
            require "buildlogparser/parsers/dhrystone"
         | 
| 4 26 | 
             
            require "buildlogparser/parsers/size"
         | 
| 5 27 |  | 
| 6 28 | 
             
            require "buildlogparser/version"
         | 
| @@ -1,3 +1,23 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 1 21 | 
             
            module BuildLogParser
         | 
| 2 22 | 
             
              class Parser
         | 
| 3 23 | 
             
                attr_reader :logtext
         | 
| @@ -1,3 +1,23 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 1 21 | 
             
            require 'parslet'
         | 
| 2 22 |  | 
| 3 23 | 
             
            module BuildLogParser
         | 
| @@ -41,7 +61,7 @@ module BuildLogParser | |
| 41 61 | 
             
                    targetendline.as(:targetend)
         | 
| 42 62 | 
             
                  end
         | 
| 43 63 |  | 
| 44 | 
            -
                  rule(:start) { (target | (restofline >> newline).as(:drop)).repeat.as(:array) }
         | 
| 64 | 
            +
                  rule(:start) { (target | (restofline >> newline | any).as(:drop)).repeat.as(:array) }
         | 
| 45 65 | 
             
                  root(:start)
         | 
| 46 66 | 
             
                end # class Parser
         | 
| 47 67 |  | 
| @@ -0,0 +1,75 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 21 | 
            +
            require 'parslet'
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            module BuildLogParser
         | 
| 24 | 
            +
              module Coremark
         | 
| 25 | 
            +
                class Parser < Parslet::Parser
         | 
| 26 | 
            +
                  rule(:space)     { match['\s'] }
         | 
| 27 | 
            +
                  rule(:space?)    { space.repeat }
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  rule(:newline)   { str("\r").maybe >> str("\n") }
         | 
| 30 | 
            +
                  rule(:restofline){ ( newline.absent? >> any ).repeat }
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  rule(:integer)   { match['0-9'].repeat(1) }
         | 
| 33 | 
            +
                  rule(:float)     { integer >> (match['\.,'] >> integer).maybe }
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  rule(:event) do
         | 
| 36 | 
            +
                    str('CoreMark Size') >> space? >> str(':') >> space? >> integer.as(:coremark_size) >> newline >>
         | 
| 37 | 
            +
                    str('Total ticks') >> space? >> str(':') >> space? >> integer.as(:total_ticks) >> newline >>
         | 
| 38 | 
            +
                    str('Total time (secs)') >> space? >> str(':') >> space? >> float.as(:time_sec) >> newline >>
         | 
| 39 | 
            +
                    str('Iterations/Sec') >> space? >> str(':') >> space? >> float.as(:iterations_per_sec) >> newline >>
         | 
| 40 | 
            +
                    str('Iterations') >> space? >> str(':') >> space? >> integer.as(:iterations) >> newline >>
         | 
| 41 | 
            +
                    str('Compiler version') >> space? >> str(':') >> space? >> restofline.as(:compiler_version) >> newline >>
         | 
| 42 | 
            +
                    str('Compiler flags') >> space? >> str(':') >> space? >> restofline.as(:compiler_flags) >> newline >>
         | 
| 43 | 
            +
                    str('Memory location') >> space? >> str(':') >> space? >> restofline.as(:memory_location)
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  rule(:start) { (event | (restofline >> newline | any).as(:drop)).repeat.as(:array) }
         | 
| 47 | 
            +
                  root(:start)
         | 
| 48 | 
            +
                end # class Parser
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                class Transform < Parslet::Transform
         | 
| 51 | 
            +
                  rule(:drop => subtree(:tree)) { }
         | 
| 52 | 
            +
                  rule(:coremark_size => simple(:coremark_size), :total_ticks => simple(:total_ticks), :time_sec => simple(:time_sec), :iterations_per_sec => simple(:iterations_per_sec), :iterations => simple(:iterations), :compiler_version => simple(:compiler_version), :compiler_flags => simple(:compiler_flags), :memory_location => simple(:memory_location)) do
         | 
| 53 | 
            +
                    { :coremark_size => Integer(coremark_size), :total_ticks => Integer(total_ticks), :time_sec => Float(time_sec), :iterations_per_sec => Float(iterations_per_sec), :iterations => Integer(iterations), :compiler_version => String(compiler_version), :compiler_flags => String(compiler_flags), :memory_location => String(memory_location) }
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
                  rule(:array => subtree(:tree)) { tree.compact.flatten }
         | 
| 56 | 
            +
                end # class Transform
         | 
| 57 | 
            +
              end # module Coremark
         | 
| 58 | 
            +
             | 
| 59 | 
            +
              class CoremarkParser < BuildLogParser::Parser
         | 
| 60 | 
            +
                attr_reader :data
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                def reset()
         | 
| 63 | 
            +
                  super()
         | 
| 64 | 
            +
                   @data = []
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                def parse(logtext)
         | 
| 68 | 
            +
                  reset()
         | 
| 69 | 
            +
                  @logtext = logtext
         | 
| 70 | 
            +
                  parser = Coremark::Parser.new
         | 
| 71 | 
            +
                  tree = parser.parse(logtext)
         | 
| 72 | 
            +
                  @data = Coremark::Transform.new.apply(tree)
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
              end # class CMakeParser
         | 
| 75 | 
            +
            end # module BuildLogParser
         | 
| @@ -1,3 +1,23 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 1 21 | 
             
            require 'parslet'
         | 
| 2 22 |  | 
| 3 23 | 
             
            module BuildLogParser
         | 
| @@ -16,9 +36,11 @@ module BuildLogParser | |
| 16 36 | 
             
                  rule(:integer)   { match['0-9'].repeat(1) }
         | 
| 17 37 | 
             
                  rule(:float)     { integer >> (match['\.,'] >> integer).maybe }
         | 
| 18 38 |  | 
| 39 | 
            +
                  rule(:regexError) { str('Required regular expression not found.Regex=[') >> match['^\]'].repeat(1) >> str(']') >> space? }
         | 
| 40 | 
            +
             | 
| 19 41 | 
             
                  rule(:event) do
         | 
| 20 42 | 
             
                    space? >> integer.as(:nr) >> str('/') >> integer.as(:total_nr) >> space? >> str('Test') >> space? >> str('#') >>
         | 
| 21 | 
            -
                    integer >> str(': ') >> letters.as(:name) >> match['\.*\s'].repeat(1) >> letters.as(:result) >> space? >>
         | 
| 43 | 
            +
                    integer >> str(': ') >> letters.as(:name) >> match['\.*\s'].repeat(1) >> letters.as(:result) >> space? >> regexError.maybe >>
         | 
| 22 44 | 
             
                    float.as(:time_sec) >> anyline
         | 
| 23 45 | 
             
                  end
         | 
| 24 46 |  | 
| @@ -0,0 +1,82 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 21 | 
            +
            require 'parslet'
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            module BuildLogParser
         | 
| 24 | 
            +
              module Dhrystone
         | 
| 25 | 
            +
                class Parser < Parslet::Parser
         | 
| 26 | 
            +
                  rule(:space)     { match['\s'] }
         | 
| 27 | 
            +
                  rule(:space?)    { space.repeat }
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  rule(:newline)   { str("\r").maybe >> str("\n") }
         | 
| 30 | 
            +
                  rule(:restofline){ ( newline.absent? >> any ).repeat }
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  rule(:path)      { match['[:alnum:]0-9=\+\.\-_/'].repeat(1) }
         | 
| 33 | 
            +
                  rule(:integer)   { match['0-9'].repeat(1) }
         | 
| 34 | 
            +
                  rule(:float)     { integer >> (match['\.,'] >> integer).maybe }
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  rule(:version) { str('Version') >> space? >> float.as(:version) }
         | 
| 37 | 
            +
                  rule(:run)     { integer.as(:run) >> space? >> str('runs through Dhrystone') }
         | 
| 38 | 
            +
                  rule(:usec_per_run)       { str('Microseconds for one run through Dhrystone:') >> space? >> float.as(:usec_per_run) }
         | 
| 39 | 
            +
                  rule(:dhrystones_per_sec) { str('Dhrystones per Second:')  >> space? >> float.as(:dhrystones_per_sec) }
         | 
| 40 | 
            +
                  rule(:total_ticks)        { str('Total ticks:') >> space? >> integer.as(:total_ticks) }
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  rule(:target) do
         | 
| 43 | 
            +
                    str('Dhrystone Benchmark,') >>
         | 
| 44 | 
            +
                    ( version.absent? >> any ).repeat >> version >>
         | 
| 45 | 
            +
                    (( run.absent? >> any ).repeat >> run).repeat(1).as(:runs) >>
         | 
| 46 | 
            +
                      (( usec_per_run.absent? >> any ).repeat >> usec_per_run >> ( dhrystones_per_sec.absent? >> any ).repeat >> dhrystones_per_sec |
         | 
| 47 | 
            +
                       ( total_ticks.absent? >> any ).repeat >> total_ticks)
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  rule(:start) { (target | (restofline >> newline | any).as(:drop)).repeat.as(:array) }
         | 
| 51 | 
            +
                  root(:start)
         | 
| 52 | 
            +
                end # class Parser
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                class Transform < Parslet::Transform
         | 
| 55 | 
            +
                  rule(:drop => subtree(:tree)) { }
         | 
| 56 | 
            +
                  rule(:version => simple(:version), :runs => subtree(:runs), :usec_per_run => simple(:usec_per_run), :dhrystones_per_sec => simple(:dhrystones_per_sec)) do
         | 
| 57 | 
            +
                    { :version => String(version), :runs => Integer(runs[-1][:run]), :usec_per_run => Float(usec_per_run), :dhrystones_per_sec => Float(dhrystones_per_sec) }
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
                  rule(:version => simple(:version), :runs => subtree(:runs), :total_ticks => simple(:total_ticks)) do
         | 
| 60 | 
            +
                    { :version => String(version), :runs => Integer(runs[-1][:run]), :total_ticks => Integer(total_ticks) }
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
                  rule(:array => subtree(:tree)) { tree.compact.flatten }
         | 
| 63 | 
            +
                end # class Transform
         | 
| 64 | 
            +
              end # module Dhrystone
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              class DhrystoneParser < BuildLogParser::Parser
         | 
| 67 | 
            +
                attr_reader :data
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                def reset()
         | 
| 70 | 
            +
                  super()
         | 
| 71 | 
            +
                   @data = []
         | 
| 72 | 
            +
                end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                def parse(logtext)
         | 
| 75 | 
            +
                  reset()
         | 
| 76 | 
            +
                  @logtext = logtext
         | 
| 77 | 
            +
                  parser = Dhrystone::Parser.new
         | 
| 78 | 
            +
                  tree = parser.parse(logtext)
         | 
| 79 | 
            +
                  @data = Dhrystone::Transform.new.apply(tree)
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
              end # class CMakeParser
         | 
| 82 | 
            +
            end # module BuildLogParser
         | 
| @@ -1,3 +1,23 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 1 21 | 
             
            require 'parslet'
         | 
| 2 22 |  | 
| 3 23 | 
             
            module BuildLogParser
         | 
| @@ -25,7 +45,7 @@ module BuildLogParser | |
| 25 45 | 
             
                    hexnumber.as(:hex) >> space? >> path.as(:filename) >> newline
         | 
| 26 46 | 
             
                  end
         | 
| 27 47 |  | 
| 28 | 
            -
                  rule(:start) { ((header >> event.repeat(1)).as(:array) | (restofline >> newline).as(:drop)).repeat.as(:array) }
         | 
| 48 | 
            +
                  rule(:start) { ((header >> event.repeat(1)).as(:array) | (restofline >> newline | any).as(:drop)).repeat.as(:array) }
         | 
| 29 49 | 
             
                  root(:start)
         | 
| 30 50 | 
             
                end # class Parser
         | 
| 31 51 |  | 
| @@ -1,7 +1,27 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # Copyright (C) 2017 Mario Werner <nioshd@gmail.com>
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 | 
            +
            # this software and associated documentation files (the "Software"), to deal in
         | 
| 6 | 
            +
            # the Software without restriction, including without limitation the rights to
         | 
| 7 | 
            +
            # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         | 
| 8 | 
            +
            # the Software, and to permit persons to whom the Software is furnished to do so,
         | 
| 9 | 
            +
            # subject to the following conditions:
         | 
| 10 | 
            +
            #
         | 
| 11 | 
            +
            # The above copyright notice and this permission notice shall be included in all
         | 
| 12 | 
            +
            # copies or substantial portions of the Software.
         | 
| 13 | 
            +
            #
         | 
| 14 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 15 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         | 
| 16 | 
            +
            # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         | 
| 17 | 
            +
            # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         | 
| 18 | 
            +
            # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         | 
| 19 | 
            +
            # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 20 | 
            +
            #
         | 
| 1 21 | 
             
            module BuildLogParser
         | 
| 2 22 | 
             
              module VERSION #:nodoc:
         | 
| 3 23 | 
             
                MAJOR = 0
         | 
| 4 | 
            -
                MINOR =  | 
| 24 | 
            +
                MINOR = 2
         | 
| 5 25 | 
             
                PATCH = 0
         | 
| 6 26 |  | 
| 7 27 | 
             
                STRING = [MAJOR, MINOR, PATCH].join('.')
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: buildlogparser
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mario Werner
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-09-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -103,6 +103,7 @@ extra_rdoc_files: [] | |
| 103 103 | 
             
            files:
         | 
| 104 104 | 
             
            - ".gitignore"
         | 
| 105 105 | 
             
            - ".travis.yml"
         | 
| 106 | 
            +
            - CHANGELOG.md
         | 
| 106 107 | 
             
            - Gemfile
         | 
| 107 108 | 
             
            - LICENSE.txt
         | 
| 108 109 | 
             
            - README.md
         | 
| @@ -111,7 +112,9 @@ files: | |
| 111 112 | 
             
            - lib/buildlogparser.rb
         | 
| 112 113 | 
             
            - lib/buildlogparser/parser.rb
         | 
| 113 114 | 
             
            - lib/buildlogparser/parsers/cmake.rb
         | 
| 115 | 
            +
            - lib/buildlogparser/parsers/coremark.rb
         | 
| 114 116 | 
             
            - lib/buildlogparser/parsers/ctest.rb
         | 
| 117 | 
            +
            - lib/buildlogparser/parsers/dhrystone.rb
         | 
| 115 118 | 
             
            - lib/buildlogparser/parsers/size.rb
         | 
| 116 119 | 
             
            - lib/buildlogparser/version.rb
         | 
| 117 120 | 
             
            homepage: https://github.com/niosHD/buildlogparser
         |