-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathRakefile
47 lines (41 loc) · 1.06 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'bundler/setup'
require 'minitest/test_task'
desc "Run all benchmarks"
task :bench do
Rake::Task["bench:speed"].invoke
Rake::Task["bench:memory"].invoke
end
namespace :bench do
desc "Run performance benchmarks"
task :speed => :environment do
puts "OccamsRecord Speed Test\n\n"
Benchmarks.each do |benchmark|
puts benchmark.speed
end
end
desc "Run memory benchmarks"
task :memory => :environment do
puts "OccamsRecord Memory Test\n\n"
Benchmarks.each do |benchmark|
puts benchmark.memory
end
end
task :environment do
$:.unshift File.join(File.dirname(__FILE__), "lib")
require 'occams-record'
require_relative './bench/seeds'
require_relative './bench/marks'
end
end
# Accepts files, dirs, N=test_name_or/pattern/, X=test_name_or/pattern/
Minitest::TestTask.create(:test) do |t|
globs = ARGV[1..].map { |a|
if Dir.exist? a
"#{a}/**/*_test.rb"
elsif File.exist? a
a
end
}.compact
t.libs << "test" << "lib"
t.test_globs = globs.any? ? globs : ["test/**/*_test.rb"]
end