Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (48 sloc) 1.439 kb
cbace54 @Watson1978 imported the Ruby 1.9.2's tests.
Watson1978 authored
1 GET_LOG_SEGFAULT = true
2 DIR_RESULT = "result"
3
6e2946b @ferrous26 Improve user friendliness of running the MRI tests
ferrous26 authored
4 task :default => :test
5
6
7 desc 'Run the entire suite of unit tests for MRI against MacRuby'
8 task :test do
cbace54 @Watson1978 imported the Ruby 1.9.2's tests.
Watson1978 authored
9 date = Time.now.strftime('%Y-%m-%d-%H%M%S')
10 output = "log_#{date}.txt"
11 error = "crash_#{date}.txt"
12 opts = ENV['opts'] || ""
13 macruby = ENV['ruby'] || "/usr/local/bin/macruby"
14
15 unless(File.directory?(DIR_RESULT))
16 Dir.mkdir(DIR_RESULT)
17 end
18
19 test_files = Dir.glob(File.join('test', '**/test_*'))
20 test_files.each do |file|
21 # run test
22 if(GET_LOG_SEGFAULT)
23 puts file
f542f7f @Watson1978 in Unit Test, fix the order of practice of the test.
Watson1978 authored
24 system "sh -c './bin/timeout -t 180 #{macruby} -r require_relative.rb #{file} --seed 0 #{opts} >> #{DIR_RESULT}/#{output} 2>&1' >> #{DIR_RESULT}/#{error} 2>&1"
cbace54 @Watson1978 imported the Ruby 1.9.2's tests.
Watson1978 authored
25 else
f542f7f @Watson1978 in Unit Test, fix the order of practice of the test.
Watson1978 authored
26 system "./bin/timeout -t 180 #{macruby} -r require_relative.rb #{file} --seed 0 #{opts} 2>&1 | tee -a -i #{DIR_RESULT}/#{output}"
cbace54 @Watson1978 imported the Ruby 1.9.2's tests.
Watson1978 authored
27 end
28
29 # kill watchdog
30 ps = `ps | grep sleep`
31 ps.each_line do |line|
32 info = line.split(/\s+/)
33 pid = info[0]
34 pname = info[3]
35
36 if(pname == "sleep")
37 system "kill -KILL #{pid}"
38 end
39 end
40 end
41
42 end
43
6e2946b @ferrous26 Improve user friendliness of running the MRI tests
ferrous26 authored
44
45 desc 'Kill any running MacRuby processes'
cbace54 @Watson1978 imported the Ruby 1.9.2's tests.
Watson1978 authored
46 task :kill do
47 require 'pp'
48
49 COMMAND = "ps aux | grep macruby"
50 result = `#{COMMAND}`
51
52 prc = result.split("\n")
53 pp prc
54 prc.each do |line|
55 unless(line =~ /#{COMMAND}/)
56 process = line.split(/\s+/)[1]
57 sh "kill -KILL #{process}"
58 end
59 end
60
61 end
Something went wrong with that request. Please try again.