Sha256: f3095a2c496a513350cf6cc57c95c2ba157d08523ee37bc13be6b32e1c6a133b

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

module DeepTest
  module Test
    class WorkUnit
      def initialize(test_case)
        @test_case = test_case
      end

      def run
        result = run_without_deadlock_protection 
        result = run_without_deadlock_protection if result.failed_due_to_deadlock?
        if result.failed_due_to_deadlock?
          result = WorkResult.new(@test_case.name)
          result.add_run
          result.output = "-deadlock-"
        end
        result
      end

      def ==(other)
        return false unless other.class == self.class
        @test_case == other.instance_variable_get(:@test_case)
      end

      def to_s
        @test_case.to_s
      end

      protected

      def run_without_deadlock_protection
        result = WorkResult.new(@test_case.name)
        
        result.host = Socket.gethostname
        start_time = Time.now
        
        output = capture_stdout do
          @test_case.run(result) {|channel,event|}
        end
        
        result.time = Time.now - start_time
        
        result.output = output
        result
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jason-o-matic-deep_test-1.2.2.10 lib/deep_test/test/work_unit.rb
jason-o-matic-deep_test-1.2.2.11 lib/deep_test/test/work_unit.rb
jason-o-matic-deep_test-1.2.2.12 lib/deep_test/test/work_unit.rb
jason-o-matic-deep_test-1.2.2.13 lib/deep_test/test/work_unit.rb
jason-o-matic-deep_test-1.2.2.14 lib/deep_test/test/work_unit.rb
jason-o-matic-deep_test-1.2.2.15 lib/deep_test/test/work_unit.rb