File: rspec.rake

package info (click to toggle)
jruby 9.4.8.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 89,244 kB
  • sloc: ruby: 548,574; java: 276,189; yacc: 25,873; ansic: 6,178; xml: 6,111; sh: 1,855; sed: 94; makefile: 78; jsp: 48; tcl: 40; exp: 12
file content (75 lines) | stat: -rw-r--r-- 2,250 bytes parent folder | download | duplicates (3)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Definitions:
#  MSPEC_FILE:
#    tagged       - runs specs which a MSPEC_FILE
#    all          - runs specs without specifying an MSPEC_FILE
#    !all,!tagged - runs specs with an MSPEC_FILE
#  RUNTIME:
#    interpreted  - -X-C (or OFF)
#    compiled     - JIT w/ threshold 0
#    precompiled  - AOT (or FORCE)
#  RUBYSPEC:
#    latest       - grab head of rubyspecs
#    stable       - get saved blessed version (see RUBYSPECS_VERSION)

# FIXME: Make Rubyspecs FAILED message appear?

namespace :spec do
  begin
    gem 'rspec'
    require 'rspec/core/rake_task'
  rescue LoadError => e
    warn "rspec tasks won't work, `bin/jruby -S bundle install` first: #{e.inspect}"
  end

  # Put Rake on the load path for JI specs without requiring rubygems
  rake_location = File.join(Gem.loaded_specs['rake'].full_gem_path, "lib")

  compile_flags = {
    :default => :int,
    :int => ["-X-C"],
    :jit => ["-Xjit.threshold=0"],
    :aot => ["-X+C"],
    :all => [:int, :jit, :aot]
  }

  permute_specs "ji", compile_flags, "test:compile" do |t|
    t.ruby_opts = ["-I#{rake_location}"]
    t.rspec_opts ||= []
    t.rspec_opts << "--options spec/java_integration/spec.quiet.opts"
    t.pattern = 'spec/java_integration/**/*_spec.rb'
    classpath = %w[test/target/annotation-api.jar].join(File::PATH_SEPARATOR)
    t.ruby_opts << "-J-cp #{classpath}"
  end

  permute_specs "compiler", compile_flags do |t|
    t.pattern = 'spec/compiler/**/*_spec.rb'
  end

  permute_specs "profiler", compile_flags do |t|
    t.ruby_opts = ['-I.', "--profile"]
    t.pattern = 'spec/profiler/**/*_spec.rb'
  end

  permute_specs "ffi", compile_flags do |t|
    t.pattern = 'spec/ffi/**/*_spec.rb'
  end

  permute_specs "java_signature_parser", compile_flags do |t|
    t.rspec_opts = "--options spec/java_integration/spec.quiet.opts"
    t.pattern = 'spec/grammar/**/*_spec.rb'
  end

  permute_specs "regression", compile_flags do |t|
    t.rspec_opts ||= []
    t.rspec_opts << '--color --format documentation '
    t.pattern = 'spec/regression/**/*_spec.rb'
  end

  permute_specs "jruby", compile_flags do |t|
    t.pattern = 'spec/jruby/**/*_spec.rb'
  end

  permute_specs "jrubyc", compile_flags do |t|
    t.pattern = 'spec/jrubyc/**/*_spec.rb'
  end
end