diff options
| author | Steve Kemp <steve@steve.org.uk> | 2013-02-19 11:27:33 +0000 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2013-02-19 11:27:33 +0000 | 
| commit | 9e80a84fa9c1f88bec08930075d56215c49465e8 (patch) | |
| tree | 647195aab791e8cee0f33110634b80b94c4b47ab /lib | |
| parent | a524a972f47d932e9625eb716c1c61d8f4f283ad (diff) | |
  Period definitions for tests.
  For example:
  example.vm must run ping between 09-17 otherwise 'daytime ping failed'.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/custodian/parser.rb | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index 7ed0725..764a03b 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -254,6 +254,32 @@ module Custodian        return nil if ( ( line.nil? ) || ( line =~ /^#/ ) || ( line.length < 1 ) )        # +      # Look for a time period. +      # +      if ( line =~ /between\s+([0-9]+)-([0-9]+)/i ) +        p_start = $1.dup.to_i +        p_end   = $2.dup.to_i + +        # +        #  Get the current hour. +        # +        hour = Time.now.hour + +        # +        #  Should we exclude the test? +        # +        if ( line =~ /except\s+between/i ) +          if ( hour > p_start && hour < p_end ) +            return nil +          end +        else +          if ( hour < p_start || hour > p_end ) +            return nil +          end +        end +      end + +      #        #  Look for macro definitions, inline        #        if ( line =~ /^([0-9A-Z]_+)\s+are\s+fetched\s+from\s+([^\s]+)\.?/ ) | 
