Class: FuzzBert::Executor
- Inherits:
-
Object
- Object
- FuzzBert::Executor
- Defined in:
- lib/fuzzbert/executor.rb
Defined Under Namespace
Classes: DataProducer
Constant Summary collapse
- DEFAULT_POOL_SIZE =
4
- DEFAULT_LIMIT =
-1
- DEFAULT_HANDLER =
FuzzBert::Handler::FileOutput
- DEFAULT_SLEEP_DELAY =
1
- DEFAULT_ARGS =
{ pool_size: DEFAULT_POOL_SIZE, limit: DEFAULT_LIMIT, handler: DEFAULT_HANDLER.new, sleep_delay: DEFAULT_SLEEP_DELAY }
Instance Attribute Summary collapse
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#pool_size ⇒ Object
readonly
Returns the value of attribute pool_size.
-
#sleep_delay ⇒ Object
readonly
Returns the value of attribute sleep_delay.
Instance Method Summary collapse
-
#initialize(suites, args = DEFAULT_ARGS) ⇒ Executor
constructor
A new instance of Executor.
- #run ⇒ Object
Constructor Details
#initialize(suites, args = DEFAULT_ARGS) ⇒ Executor
Returns a new instance of Executor.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fuzzbert/executor.rb', line 17 def initialize(suites, args = DEFAULT_ARGS) raise ArgumentError.new("No test cases were passed") unless suites args ||= DEFAULT_ARGS @pool_size = args[:pool_size] || DEFAULT_POOL_SIZE @limit = args[:limit] || DEFAULT_LIMIT @handler = args[:handler] || DEFAULT_HANDLER.new @sleep_delay = args[:sleep_delay] || DEFAULT_SLEEP_DELAY @data_cache = {} @n = 0 @exiting = false @producer = DataProducer.new(suites) end |
Instance Attribute Details
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
3 4 5 |
# File 'lib/fuzzbert/executor.rb', line 3 def handler @handler end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
3 4 5 |
# File 'lib/fuzzbert/executor.rb', line 3 def limit @limit end |
#pool_size ⇒ Object (readonly)
Returns the value of attribute pool_size.
3 4 5 |
# File 'lib/fuzzbert/executor.rb', line 3 def pool_size @pool_size end |
#sleep_delay ⇒ Object (readonly)
Returns the value of attribute sleep_delay.
3 4 5 |
# File 'lib/fuzzbert/executor.rb', line 3 def sleep_delay @sleep_delay end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/fuzzbert/executor.rb', line 31 def run trap_child_exit trap_interrupt @pool_size.times { run_instance(*@producer.next) } @running = true @limit == -1 ? sleep : conditional_sleep end |