Class: GroongaQueryLog::Command::RunRegressionTest::Tester
- Inherits:
-
Object
- Object
- GroongaQueryLog::Command::RunRegressionTest::Tester
- Includes:
- Loggable
- Defined in:
- lib/groonga-query-log/command/run-regression-test.rb
Instance Attribute Summary collapse
-
#new ⇒ Object
readonly
Returns the value of attribute new.
-
#old ⇒ Object
readonly
Returns the value of attribute old.
Instance Method Summary collapse
-
#initialize(old, new, options) ⇒ Tester
constructor
A new instance of Tester.
- #n_executed_commands ⇒ Object
- #run ⇒ Object
Methods included from Loggable
Constructor Details
#initialize(old, new, options) ⇒ Tester
Returns a new instance of Tester.
795 796 797 798 799 800 801 802 803 804 805 806 |
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 795 def initialize(old, new, ) @old = old @new = new @input_directory = [:input_directory] || Pathname.new(".") @working_directory = [:working_directory] || Pathname.new(".") @results_directory = [:results_directory] || (@working_directory + "results") @n_clients = [:n_clients] || 1 @stop_on_failure = [:stop_on_failure] @options = @n_executed_commands = 0 end |
Instance Attribute Details
#new ⇒ Object (readonly)
Returns the value of attribute new.
794 795 796 |
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 794 def new @new end |
#old ⇒ Object (readonly)
Returns the value of attribute old.
793 794 795 |
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 793 def old @old end |
Instance Method Details
#n_executed_commands ⇒ Object
850 851 852 |
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 850 def n_executed_commands @n_executed_commands end |
#run ⇒ Object
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 |
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 808 def run @old.ensure_database @new.ensure_database ready_queue = Thread::Queue.new wait_queue = Thread::Queue.new old_thread = Thread.new do @old.run begin ready_queue.push(true) wait_queue.pop true ensure @old.shutdown end end new_thread = Thread.new do @new.run begin ready_queue.push(true) wait_queue.pop true ensure @new.shutdown end end test_thread = Thread.new do ready_queue.pop ready_queue.pop success = run_test wait_queue.push(true) wait_queue.push(true) success end old_thread_success = old_thread.value new_thread_success = new_thread.value test_thread_success = test_thread.value old_thread_success and new_thread_success and test_thread_success end |