summaryrefslogtreecommitdiff
path: root/tasks/test.rake
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-03-06 23:59:50 -0700
committerDan Allen <dan.j.allen@gmail.com>2019-03-07 00:46:56 -0700
commite53b7536d7df8d3cefcf14b0d6dd774d1315e42c (patch)
treefd8c2212d23ef15e9b015eea51593edf77152936 /tasks/test.rake
parent49e1c7f4aa589c726d9aa69d3cd1813ee96eed7b (diff)
organize rake build by moving tasks into task files
Diffstat (limited to 'tasks/test.rake')
-rw-r--r--tasks/test.rake30
1 files changed, 30 insertions, 0 deletions
diff --git a/tasks/test.rake b/tasks/test.rake
new file mode 100644
index 00000000..3a3615b8
--- /dev/null
+++ b/tasks/test.rake
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+def prepare_test_env
+ # rather than hardcoding gc settings in test task,
+ # could use https://gist.github.com/benders/788695
+ ENV['RUBY_GC_MALLOC_LIMIT'] = 128_000_000.to_s
+ ENV['RUBY_GC_OLDMALLOC_LIMIT'] = 128_000_000.to_s
+ ENV['RUBY_GC_HEAP_INIT_SLOTS'] = 750_000.to_s
+ ENV['RUBY_GC_HEAP_FREE_SLOTS'] = 750_000.to_s
+ ENV['RUBY_GC_HEAP_GROWTH_MAX_SLOTS'] = 50_000.to_s
+ ENV['RUBY_GC_HEAP_GROWTH_FACTOR'] = 2.to_s
+end
+
+begin
+ require 'rake/testtask'
+ Rake::TestTask.new :test do |t|
+ prepare_test_env
+ puts %(LANG: #{ENV['LANG']}) if ENV.key? 'TRAVIS_BUILD_ID'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+ t.warning = true
+ end
+rescue LoadError => e
+ warn e.message
+end
+
+namespace :test do
+ desc 'Run unit and feature tests'
+ task :all => [:test, :features]
+end