1 #!/usr/bin/env ruby
 2 
 3 PROBLEM_LIST = ["run_composite.sh", "run_merge_if_else_paranoid.sh", "run_wrong_bci_after_motion.sh"]
 4 
 5 if $0 == __FILE__
 6   puts  "using #{%x|which java|}"
 7   java_version = `java --version`
 8 
 9   jvm_options ="-Xlog:gc -XX:+DoPartialEscapeAnalysis"
10   if java_version =~ /\(.*debug build/
11     jvm_options << " -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations -XX:+PrintOptoStatistics"
12   end
13   puts jvm_options
14 
15   failed = []
16   Dir.glob("run*.sh").each do |t|
17     print "[#{t}]"
18 
19     ret = system("sh ./#{t} #{jvm_options} > #{t}.log")
20     if ret == nil then
21       puts "\t fail to execute."
22     else
23       # exitcode == 3 is out of memory. acceptable.
24       if ret or $?.exitstatus == 3 then
25         puts "\tpassed."
26       elsif  PROBLEM_LIST.include? t then
27         puts "\tis a known issue."
28       else
29         puts "\tfailed!"
30         failed.push("[#{t}]")
31       end
32     end
33   end
34 
35   if failed.length() > 0
36     puts "failed #{failed.length} tests:"
37     failed.each { |test| puts "\t#{test}" }
38     exit(1)
39   end
40   puts "passed all tests!"
41 end