bigbench 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +29 -249
- data/bigbench.gemspec +1 -0
- data/bin/bigbench +1 -1
- data/dev/request_sequence.dot +235 -0
- data/dev/request_sequence.pdf +0 -0
- data/dev/sequence.rb +48 -0
- data/doc/Array.html +5 -5
- data/doc/BigBench.html +27 -60
- data/doc/BigBench/Benchmark.html +5 -5
- data/doc/BigBench/Benchmark/Benchmark.html +8 -8
- data/doc/BigBench/Benchmark/Looper.html +5 -5
- data/doc/BigBench/Bot.html +5 -5
- data/doc/BigBench/Configuration.html +29 -53
- data/doc/BigBench/Executor.html +14 -95
- data/doc/BigBench/Executor/Executable.html +551 -0
- data/doc/BigBench/Fragment.html +5 -5
- data/doc/BigBench/Fragment/Fragment.html +5 -5
- data/doc/BigBench/Output.html +7 -8
- data/doc/BigBench/PostProcessor.html +8 -8
- data/doc/BigBench/PostProcessor/Context.html +219 -0
- data/doc/BigBench/PostProcessor/Environment.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/Appearings.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/AttributeCluster.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/BenchmarkNotFound.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/Cluster.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/NormalDistribution.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/PolynomialRegression.html +5 -5
- data/doc/BigBench/PostProcessor/Environment/Statistics.html +5 -5
- data/doc/BigBench/PostProcessor/Graphs.html +5 -5
- data/doc/BigBench/PostProcessor/Graphs/LineGraph.html +5 -5
- data/doc/BigBench/PostProcessor/Graphs/PieGraph.html +5 -5
- data/doc/BigBench/PostProcessor/InvalidProcessor.html +6 -6
- data/doc/BigBench/PostProcessor/Processor.html +6 -6
- data/doc/BigBench/PostProcessor/Statistics.html +5 -5
- data/doc/BigBench/PostProcessor/Test.html +6 -6
- data/doc/BigBench/PostProcessor/TestPretty.html +249 -0
- data/doc/BigBench/Runner.html +5 -5
- data/doc/BigBench/Runner/NoBenchmarksDefined.html +5 -5
- data/doc/BigBench/Store.html +8 -8
- data/doc/BigBench/Tracker.html +5 -5
- data/doc/BigBench/Tracker/Tracker.html +5 -5
- data/doc/EventMachineLoop.html +5 -5
- data/doc/Float.html +5 -5
- data/doc/Gemfile.html +5 -5
- data/doc/Helpers.html +5 -5
- data/doc/Object.html +24 -5
- data/doc/README_rdoc.html +51 -281
- data/doc/Rakefile.html +5 -5
- data/doc/created.rid +46 -46
- data/doc/index.html +51 -281
- data/doc/js/search_index.js +1 -1
- data/doc/lib/bigbench/help/executor_txt.html +14 -29
- data/doc/table_of_contents.html +63 -68
- data/lib/bigbench.rb +2 -0
- data/lib/bigbench/benchmark.rb +3 -3
- data/lib/bigbench/configuration.rb +29 -68
- data/lib/bigbench/executor.rb +100 -130
- data/lib/bigbench/help/executor.txt +9 -22
- data/lib/bigbench/output.rb +2 -3
- data/lib/bigbench/post_processor.rb +16 -4
- data/lib/bigbench/runner.rb +0 -1
- data/lib/bigbench/store.rb +2 -2
- data/lib/bigbench/templates/test_plan.rb.erb +17 -0
- data/lib/bigbench/version.rb +1 -1
- data/spec/configure_spec.rb +7 -18
- data/spec/executor_spec.rb +25 -35
- data/spec/post_processor_spec.rb +31 -1
- data/spec/post_processors/environment_spec.rb +5 -3
- data/spec/post_processors/graphs_spec.rb +8 -3
- data/spec/post_processors/statistics_spec.rb +6 -1
- data/spec/runner_spec.rb +7 -6
- data/spec/store_spec.rb +4 -3
- data/spec/tests/local.rb +5 -5
- data/spec/tests/with_post_processor.rb +5 -5
- data/spec/tracker_spec.rb +12 -8
- metadata +48 -31
- data/dev/test.rb +0 -13
data/lib/bigbench/executor.rb
CHANGED
@@ -5,145 +5,115 @@ module BigBench
|
|
5
5
|
# :include: executor.txt
|
6
6
|
module Executor
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
"run local PATH_TO_TEST",
|
11
|
-
"run bots PATH_TO_TEST [REDIS_URL_WITH_PORT REDIS_PASSWORD]",
|
12
|
-
"start bot [REDIS_URL_WITH_PORT REDIS_PASSWORD]",
|
13
|
-
"reset all [REDIS_URL_WITH_PORT REDIS_PASSWORD]",
|
14
|
-
"run postprocessors PATH_TO_TEST",
|
15
|
-
"run postprocessor PATH_TO_TEST POSTPROCESSOR"
|
16
|
-
]
|
17
|
-
|
18
|
-
# Is thrown when the command is not known
|
19
|
-
class InvalidCommand < StandardError
|
20
|
-
def message
|
21
|
-
puts "\n\n"
|
22
|
-
puts "Sorry, could not compile your command. Please enter one of the following commands:\n\n"
|
23
|
-
COMMANDS.each{ |command| puts command }
|
24
|
-
puts " "
|
25
|
-
|
26
|
-
"Sorry, could not compile your command."
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Parses and runs the BigBench funtion that is supplied via the commandline's ARGV. It
|
31
|
-
# throws an <tt>InvalidCommand</tt> exception if the command is unknown.
|
32
|
-
def self.run!(argv)
|
33
|
-
BigBench::Output.start
|
8
|
+
class Executable < Thor
|
9
|
+
include Thor::Actions
|
34
10
|
|
35
|
-
|
36
|
-
|
11
|
+
# Templates are here
|
12
|
+
def self.source_root
|
13
|
+
File.join(File.dirname(__FILE__), "templates")
|
14
|
+
end
|
37
15
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
return "show_help" if argv.first == "--help"
|
46
|
-
"#{argv[0]}_#{argv[1]}".to_sym
|
47
|
-
end
|
48
|
-
|
49
|
-
# Checks if the supplied ARGV has a valid and useable form
|
50
|
-
def self.check_arguments!(argv)
|
51
|
-
raise InvalidCommand.new if argv.nil? or argv.empty?
|
52
|
-
raise InvalidCommand.new unless respond_to?(to_executor_method(argv))
|
53
|
-
true
|
54
|
-
end
|
55
|
-
|
56
|
-
# Runs a local test with the specified test.rb. For this mode no redis is needed.
|
57
|
-
def self.run_local(argv)
|
58
|
-
BigBench.load_test! File.open(argv[2], "rb"){ |file| file.read }
|
59
|
-
BigBench.run!
|
60
|
-
BigBench.write_local_trackings_to_file!
|
61
|
-
BigBench.run_post_processors!
|
62
|
-
end
|
63
|
-
|
64
|
-
# Runs a test on all available bots with the specified test.rb
|
65
|
-
#
|
66
|
-
# bigbench run bots test.rb http://localhost:6379 password
|
67
|
-
#
|
68
|
-
def self.run_bots(argv)
|
16
|
+
# Version and Help
|
17
|
+
desc "-v", "Show the version"
|
18
|
+
method_options %w( version -v ) => :boolean
|
19
|
+
def default
|
20
|
+
options.version? ? puts(BigBench::VERSION) : help
|
21
|
+
end
|
22
|
+
default_task :default
|
69
23
|
|
70
|
-
#
|
71
|
-
|
72
|
-
|
73
|
-
|
24
|
+
# Run Local
|
25
|
+
desc "local TEST_FILE", "Run the TEST_FILE on the local machine"
|
26
|
+
def local(file)
|
27
|
+
BigBench.load_test! File.open(file, "rb"){ |file| file.read }
|
28
|
+
BigBench.run!
|
29
|
+
BigBench.write_local_trackings_to_file!
|
30
|
+
BigBench.run_post_processors!
|
31
|
+
end
|
74
32
|
|
75
|
-
#
|
76
|
-
|
77
|
-
|
33
|
+
# Run Bots
|
34
|
+
desc "bots TEST_FILE [REDIS_URL_WITH_PORT] [REDIS_PASSWORD]", "Run the TEST_FILE on all bots"
|
35
|
+
def bots(file, redis_url = nil, redis_password = nil)
|
36
|
+
|
37
|
+
# Load and validate tests
|
38
|
+
test = File.open(file, "rb"){ |file| file.read }
|
39
|
+
BigBench.load_test!(test)
|
40
|
+
BigBench.config.mode = :bots
|
41
|
+
|
42
|
+
# Initialize redis
|
43
|
+
BigBench::Store.setup!(redis_url, redis_password)
|
44
|
+
|
45
|
+
# Load current test to redis & start bots
|
46
|
+
BigBench::Store.test = test
|
47
|
+
BigBench::Store.start
|
48
|
+
BigBench::Output.deployed_test
|
49
|
+
|
50
|
+
# Wait for bots to run the tests
|
51
|
+
@is_running = true
|
52
|
+
timer = Thread.new{
|
53
|
+
sleep(BigBench.duration.to_i)
|
54
|
+
BigBench::Store.stop
|
55
|
+
@is_running = false
|
56
|
+
}
|
57
|
+
|
58
|
+
BigBench::Output.starting_bots_loop
|
59
|
+
loop{
|
60
|
+
bots = BigBench::Store.bots
|
61
|
+
BigBench::Output.running_bots_loop(bots)
|
62
|
+
sleep(1)
|
63
|
+
break if !@is_running and bots.size == 0
|
64
|
+
}
|
65
|
+
|
66
|
+
# Gather trackings from redis and write them to the file
|
67
|
+
BigBench::Output.finished_bots_loop
|
68
|
+
BigBench.write_store_trackings_to_file!
|
69
|
+
BigBench.run_post_processors!
|
70
|
+
BigBench::Store.reset!
|
71
|
+
end
|
78
72
|
|
79
|
-
#
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
# Start Bot
|
74
|
+
desc "bot [REDIS_URL_WITH_PORT] [REDIS_PASSWORD]", "Start a bot on the current machine"
|
75
|
+
def bot(redis_url = nil, redis_password = nil)
|
76
|
+
BigBench::Store.setup!(redis_url, redis_password)
|
77
|
+
|
78
|
+
loop {
|
79
|
+
BigBench::Output.bot_is_checking
|
80
|
+
BigBench::Bot.check_test!
|
81
|
+
sleep(BigBench.config.bot_checks_every.to_i)
|
82
|
+
}
|
83
|
+
end
|
83
84
|
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
85
|
+
# Post Process
|
86
|
+
desc "process TEST_FILE [POST_PROCESSOR]", "Run all post processors of the testfile or the single POST_PROCESSOR"
|
87
|
+
def process(file, post_processor = nil)
|
88
|
+
BigBench.load_test! File.open(file, "rb"){ |file| file.read }
|
89
|
+
|
90
|
+
if post_processor
|
91
|
+
BigBench::PostProcessor.reset!
|
92
|
+
BigBench.post_process(post_processor)
|
93
|
+
BigBench.run_post_processors!
|
94
|
+
else
|
95
|
+
BigBench.run_post_processors!
|
96
|
+
end
|
97
|
+
end
|
91
98
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
BigBench::
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
+
# Reset
|
100
|
+
desc "reset [REDIS_URL_WITH_PORT] [REDIS_PASSWORD]", "Reset everything including the redis storage"
|
101
|
+
def reset(redis_url = nil, redis_password = nil)
|
102
|
+
BigBench::Store.setup!(redis_url, redis_password)
|
103
|
+
BigBench::Store.reset!
|
104
|
+
BigBench::Configuration.reset!
|
105
|
+
BigBench::Benchmark.reset!
|
106
|
+
BigBench::Output.reset
|
107
|
+
end
|
99
108
|
|
100
|
-
#
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
# Starts the bot that listens for tests on the redis
|
108
|
-
def self.start_bot(argv)
|
109
|
-
argv.shift(2)
|
110
|
-
BigBench::Store.setup!(*argv)
|
109
|
+
# Generator
|
110
|
+
desc "generate TEST_FILE", "Generates a simple test file to customize further"
|
111
|
+
def generate(name)
|
112
|
+
@name = name
|
113
|
+
template "test_plan.rb.erb", "#{name}.rb"
|
114
|
+
end
|
111
115
|
|
112
|
-
loop {
|
113
|
-
BigBench::Output.bot_is_checking
|
114
|
-
BigBench::Bot.check_test!
|
115
|
-
sleep(BigBench.config.bot_checks_every.to_i)
|
116
|
-
}
|
117
|
-
end
|
118
|
-
|
119
|
-
# Shows the command line help
|
120
|
-
def self.show_help(argv)
|
121
|
-
File.open("lib/bigbench/help/executor.txt", "rb"){ |file| file.read }
|
122
|
-
end
|
123
|
-
|
124
|
-
# Resets everything
|
125
|
-
def self.reset_all(argv)
|
126
|
-
argv.shift(2)
|
127
|
-
BigBench::Store.setup!(*argv)
|
128
|
-
BigBench::Store.reset!
|
129
|
-
BigBench::Configuration.reset!
|
130
|
-
BigBench::Benchmark.reset!
|
131
|
-
BigBench::Output.reset
|
132
|
-
end
|
133
|
-
|
134
|
-
# Re-runs all receipt defined post processors
|
135
|
-
def self.run_postprocessors(argv)
|
136
|
-
BigBench.load_test! File.open(argv[2], "rb"){ |file| file.read }
|
137
|
-
BigBench.run_post_processors!
|
138
116
|
end
|
139
|
-
|
140
|
-
# Runs a new postprocessor for receipt
|
141
|
-
def self.run_postprocessor(argv)
|
142
|
-
BigBench.load_test! File.open(argv[2], "rb"){ |file| file.read }
|
143
|
-
BigBench::PostProcessor.reset!
|
144
|
-
BigBench.post_process(argv[3])
|
145
|
-
BigBench.run_post_processors!
|
146
|
-
end
|
147
|
-
|
117
|
+
|
148
118
|
end
|
149
119
|
end
|
@@ -1,22 +1,9 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
bigbench
|
4
|
-
|
5
|
-
#
|
6
|
-
bigbench
|
7
|
-
bigbench
|
8
|
-
|
9
|
-
#
|
10
|
-
bigbench reset all # Resets everything
|
11
|
-
|
12
|
-
# Post Processors
|
13
|
-
bigbench run postprocessors PATH_TO_TEST # Runs all post processors of the test without running the test itself
|
14
|
-
bigbench run postprocessor PATH_TO_TEST POSTPROCESSOR # Runs the specified post processor on the output file
|
15
|
-
|
16
|
-
# Help
|
17
|
-
bigbench --help || show help # Displays this help
|
18
|
-
|
19
|
-
Options:
|
20
|
-
REDIS_URL_WITH_PORT # Defaults to http://localhost:6379
|
21
|
-
REDIS_PASSWORD # Defaults to no password
|
22
|
-
POSTPROCESSOR # A post processor module or its short name e.g. 'statistics'
|
1
|
+
Tasks:
|
2
|
+
bigbench -v # Show the version
|
3
|
+
bigbench bot [REDIS_URL_WITH_PORT] [REDIS_PASSWORD] # Start a bot on the current machine
|
4
|
+
bigbench bots TEST_FILE [REDIS_URL_WITH_PORT] [REDIS_PASSWORD] # Run the TEST_FILE on all bots
|
5
|
+
bigbench generate TEST_FILE # Generates a simple test file to customize further
|
6
|
+
bigbench help [TASK] # Describe available tasks or one specific task
|
7
|
+
bigbench local TEST_FILE # Run the TEST_FILE on the local machine
|
8
|
+
bigbench process TEST_FILE [POST_PROCESSOR] # Run all post processors of the testfile or the single POST_PROCESSOR
|
9
|
+
bigbench reset [REDIS_URL_WITH_PORT] [REDIS_PASSWORD] # Reset everything including the redis storage
|
data/lib/bigbench/output.rb
CHANGED
@@ -102,13 +102,12 @@ module BigBench
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def self.bot_is_checking
|
105
|
-
puts "Checking for new
|
105
|
+
puts "#{Time.now}: Checking for new test plan"
|
106
106
|
$stdout.flush
|
107
107
|
end
|
108
108
|
|
109
109
|
def self.bot_received_test_instructions
|
110
|
-
puts "
|
111
|
-
puts "Received test instructions\n"
|
110
|
+
puts "#{Time.now}: Received new test plan"
|
112
111
|
$stdout.flush
|
113
112
|
end
|
114
113
|
|
@@ -75,7 +75,7 @@ module BigBench
|
|
75
75
|
# Run the block of code or the run! method of the processor
|
76
76
|
def run!
|
77
77
|
@runs += 1
|
78
|
-
|
78
|
+
Context.module_exec(@options, &@proc)
|
79
79
|
end
|
80
80
|
|
81
81
|
private
|
@@ -94,9 +94,13 @@ module BigBench
|
|
94
94
|
|
95
95
|
def processor_to_module(processor)
|
96
96
|
return processor if processor.is_a? Module
|
97
|
-
|
98
|
-
|
99
|
-
|
97
|
+
|
98
|
+
module_name = "BigBench::PostProcessor::#{processor.to_s.camelize}"
|
99
|
+
module_constant = module_name.constantize
|
100
|
+
return module_constant if module_constant.is_a? Module
|
101
|
+
|
102
|
+
require module_name.underscore.sub('big_bench', 'bigbench')
|
103
|
+
module_constant
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
@@ -116,6 +120,14 @@ module BigBench
|
|
116
120
|
Environment.reset!
|
117
121
|
end
|
118
122
|
|
123
|
+
# The context in which post processor procs are evaluated
|
124
|
+
module Context
|
125
|
+
class << self
|
126
|
+
include Environment
|
127
|
+
include ActionView::Helpers
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
119
131
|
# Thrown if a processor wasn't initialized the right way
|
120
132
|
class InvalidProcessor < StandardError
|
121
133
|
def message
|
data/lib/bigbench/runner.rb
CHANGED
data/lib/bigbench/store.rb
CHANGED
@@ -13,8 +13,8 @@ module BigBench
|
|
13
13
|
|
14
14
|
# Setup the redis storage. Default values are <tt>localhost:6379</tt> and no password.
|
15
15
|
# This needs to be called for any bot test
|
16
|
-
def self.setup!(url =
|
17
|
-
uri = URI(url)
|
16
|
+
def self.setup!(url = nil, password = nil)
|
17
|
+
uri = URI(url || "localhost:6379")
|
18
18
|
@redis = ::Redis.new :host => uri.host, :port => uri.port, :password => password
|
19
19
|
true
|
20
20
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
BigBench.configure do |config|
|
2
|
+
config.duration = 2.minutes
|
3
|
+
config.output = "<%= @name %>.ljson"
|
4
|
+
config.users = 10
|
5
|
+
end
|
6
|
+
|
7
|
+
# benchmark "index page" => "http://localhost:3000" do
|
8
|
+
# get "/"
|
9
|
+
# get "/posts"
|
10
|
+
# post "/posts", :params => { :title => "A new Post", :body => "This is some fancy text" }
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# benchmark "managing posts" => "http://localhost:3000" do
|
14
|
+
# post "/posts", :params => { :title => "A new Post", :body => "This is some fancy text" }
|
15
|
+
# end
|
16
|
+
|
17
|
+
post_process :statistics
|
data/lib/bigbench/version.rb
CHANGED
data/spec/configure_spec.rb
CHANGED
@@ -4,11 +4,11 @@ describe BigBench::Configuration do
|
|
4
4
|
|
5
5
|
it "should store the config values" do
|
6
6
|
|
7
|
-
BigBench.configure
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
BigBench.configure do |config|
|
8
|
+
config.duration = 10.seconds
|
9
|
+
config.output = "test.ljson"
|
10
|
+
config.users = 20
|
11
|
+
end
|
12
12
|
|
13
13
|
BigBench.config.duration.should == 10.seconds
|
14
14
|
BigBench.config.output.should == "test.ljson"
|
@@ -21,19 +21,8 @@ describe BigBench::Configuration do
|
|
21
21
|
BigBench.config.duration.should == 5.seconds
|
22
22
|
end
|
23
23
|
|
24
|
-
it "should
|
25
|
-
BigBench.
|
26
|
-
|
27
|
-
BigBench.configure = {
|
28
|
-
:duration => 10.seconds,
|
29
|
-
:output => "test.ljson",
|
30
|
-
:users => 20
|
31
|
-
}
|
32
|
-
BigBench.config.should be_valid
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should allow to check the validity of the config" do
|
36
|
-
lambda {BigBench.check_config!}.should raise_error(BigBench::Configuration::InvalidOptions, "At least: #{BigBench::Configuration::Config::VALIDATE_OPTIONS.join(', ')} are required")
|
24
|
+
it "should raise an exception if no configure block is specified" do
|
25
|
+
lambda {BigBench.configure}.should raise_error
|
37
26
|
end
|
38
27
|
|
39
28
|
end
|
data/spec/executor_spec.rb
CHANGED
@@ -2,34 +2,14 @@ require_relative "./helpers"
|
|
2
2
|
|
3
3
|
describe BigBench::Executor do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
it "nil arguments" do
|
8
|
-
argv = nil
|
9
|
-
lambda{ BigBench::Executor.run!(argv) }.should raise_exception(BigBench::Executor::InvalidCommand)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "empty arguments" do
|
13
|
-
argv = []
|
14
|
-
lambda{ BigBench::Executor.run!(argv) }.should raise_exception(BigBench::Executor::InvalidCommand)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "weird arguments" do
|
18
|
-
argv = ["something"]
|
19
|
-
lambda{ BigBench::Executor.run!(argv) }.should raise_exception(BigBench::Executor::InvalidCommand)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "longer weird arguments" do
|
23
|
-
argv = ["something", "really", "strange"]
|
24
|
-
lambda{ BigBench::Executor.run!(argv) }.should raise_exception(BigBench::Executor::InvalidCommand)
|
25
|
-
end
|
26
|
-
|
5
|
+
before(:each) do
|
6
|
+
Dir.chdir File.dirname(__FILE__)
|
27
7
|
end
|
28
8
|
|
29
9
|
it "should run a local test with trackings" do
|
30
10
|
|
31
|
-
argv = ["
|
32
|
-
BigBench::Executor.
|
11
|
+
argv = ["local", "tests/local.rb"]
|
12
|
+
BigBench::Executor::Executable.start(argv)
|
33
13
|
|
34
14
|
BigBench.benchmarks.size.should == 2
|
35
15
|
BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 1 }
|
@@ -45,8 +25,8 @@ describe BigBench::Executor do
|
|
45
25
|
|
46
26
|
it "should run a bot test" do
|
47
27
|
|
48
|
-
argv = ["
|
49
|
-
BigBench::Executor.
|
28
|
+
argv = ["bots", "tests/local.rb"]
|
29
|
+
BigBench::Executor::Executable.start(argv)
|
50
30
|
|
51
31
|
BigBench.benchmarks.size.should == 2
|
52
32
|
BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
|
@@ -61,17 +41,17 @@ describe BigBench::Executor do
|
|
61
41
|
end
|
62
42
|
|
63
43
|
it "should show the help file" do
|
64
|
-
argv = ["
|
65
|
-
lambda{ BigBench::Executor.
|
66
|
-
File.exists?("lib/bigbench/help/executor.txt").should be_true
|
44
|
+
argv = ["help"]
|
45
|
+
lambda{ BigBench::Executor::Executable.start(argv) }.should_not raise_exception
|
46
|
+
File.exists?("../lib/bigbench/help/executor.txt").should be_true
|
67
47
|
end
|
68
48
|
|
69
49
|
it "should reset everything" do
|
70
50
|
BigBench::Store.setup!("http://localhost:6379").should be_true
|
71
51
|
BigBench::Store.test = "something"
|
72
52
|
|
73
|
-
argv = ["reset"
|
74
|
-
BigBench::Executor.
|
53
|
+
argv = ["reset"]
|
54
|
+
BigBench::Executor::Executable.start(argv)
|
75
55
|
|
76
56
|
BigBench.benchmarks.size.should == 0
|
77
57
|
BigBench::Store.test.should be_nil
|
@@ -79,8 +59,8 @@ describe BigBench::Executor do
|
|
79
59
|
|
80
60
|
it "should re-run the post processors from a receipt" do
|
81
61
|
|
82
|
-
argv = ["
|
83
|
-
BigBench::Executor.
|
62
|
+
argv = ["process", "tests/with_post_processor.rb"]
|
63
|
+
BigBench::Executor::Executable.start(argv)
|
84
64
|
|
85
65
|
BigBench.benchmarks.size.should == 1
|
86
66
|
BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
|
@@ -96,8 +76,8 @@ describe BigBench::Executor do
|
|
96
76
|
|
97
77
|
it "should run a single post processor for a single test" do
|
98
78
|
|
99
|
-
argv = ["
|
100
|
-
BigBench::Executor.
|
79
|
+
argv = ["process", "tests/with_post_processor.rb", "statistics"]
|
80
|
+
BigBench::Executor::Executable.start(argv)
|
101
81
|
|
102
82
|
BigBench.benchmarks.size.should == 1
|
103
83
|
BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
|
@@ -112,4 +92,14 @@ describe BigBench::Executor do
|
|
112
92
|
|
113
93
|
end
|
114
94
|
|
95
|
+
it "should generate a new testfile", :generate do
|
96
|
+
Dir.chdir "tmp"
|
97
|
+
|
98
|
+
File.exists?("new_test.rb").should be_false
|
99
|
+
argv = ["generate", "new_test"]
|
100
|
+
BigBench::Executor::Executable.start(argv)
|
101
|
+
File.exists?("new_test.rb").should be_true
|
102
|
+
FileUtils.rm "new_test.rb"
|
103
|
+
end
|
104
|
+
|
115
105
|
end
|