summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-02-19 11:27:33 +0000
committerSteve Kemp <steve@steve.org.uk>2013-02-19 11:27:33 +0000
commit8d97779be86177f3e15ba8edf43fb6831c843528 (patch)
treefce12371002017f5aa08f801c5c4e5b4cbc02e63 /lib
parent86075d93e40765e2abd18ed049d4f15516798db8 (diff)
Period definitions for tests.release-0.9-6
For example: example.vm must run ping between 09-17 otherwise 'daytime ping failed'.
Diffstat (limited to 'lib')
-rw-r--r--lib/custodian/parser.rb26
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]+)\.?/ )