/rakelib/spec.rake

http://github.com/MagLev/maglev · Unknown · 51 lines · 40 code · 11 blank · 0 comment · 0 complexity · 4bf13723cace7a88ff7c15ebe7f391bc MD5 · raw file

  1. # Rake tasks that run the specs.
  2. namespace :spec do
  3. # NOTE: "-t m" handled in $MAGLEV_HOME/default.mspec
  4. # Running all of the specs in one VM requires bigger tmp obj size
  5. PSPEC = %{MAGLEV_OPTS="--tocsz 1000000 $MAGLEV_OPTS" #{ENV['MAGLEV_HOME']}/spec/mspec/bin/mspec }
  6. desc "Run one rubyspec file: rake spec:run[spec/rubyspec/.../foo_spec.rb]"
  7. task :run, :spec do |t, args|
  8. check_spec_file(args.spec)
  9. sh "#{PSPEC} -V #{args.spec}"
  10. end
  11. desc "Run ci specs: there should be NO failures and NO errors."
  12. task :ci do
  13. rm_f "rubyspec_temp/*"
  14. sh "#{PSPEC} -V -G fails"
  15. end
  16. desc "Run ci specs, generating a rubyspec_report.xml with JUnit output."
  17. task :ci_report do
  18. rm_f "rubyspec_temp/*"
  19. sh "#{PSPEC} -f j -V -G fails 2>&1 | tee rubyspec_report.out"
  20. sh 'csplit rubyspec_report.out "%<?xml%" "/</testsuites/+1"'
  21. sh "mv xx00 rubyspec_report.xml"
  22. sh "rm xx01 rubyspec_report.out"
  23. end
  24. desc "Retag the ci files (works only with hacked mspec-tag.rb)"
  25. task :retag do
  26. sh "#{PSPEC} tag -G fails"
  27. end
  28. desc "Run failing specs and untag ones that now pass (works only with hacked mspec-tag.rb)"
  29. task :untag do
  30. sh "#{PSPEC} tag --del fails"
  31. end
  32. desc "Run the named specs and tag the failing ones"
  33. task :tag, :file do |t, args|
  34. sh "#{PSPEC} tag -G fails #{args.file}"
  35. end
  36. def check_spec_file(f)
  37. raise "No spec defined with: spec=..." unless f
  38. raise "Can't find file #{f}" unless File.exists? f
  39. end
  40. end