diff --git a/std-script/run b/std-script/run --- a/std-script/run +++ b/std-script/run @@ -15,8 +15,9 @@ end def extract_time(t) - # puts "TIME: #{t}" - if (result=/^(.*)r(.*)u(.*)s/.match(t)) + #puts "TIME: #{t}" + #if (result=/^(.*)real(.*)wall(.*)s/.match(t)) + if (result=/^OK \((.*) sec real\, (.*) sec wall,.*MB, (.*) syscalls/.match(t)) {:real => result[1], :user => result[2], :sys => result[3]} else #{:real => 0, :user => 0, :sys => 0} @@ -84,8 +85,23 @@ # Run the program. #run_command = "/usr/bin/time -f \"#{time_output_format}\" 2>run_result #{problem_home}/script/box_new -a 2 -f -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name}" +# -run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name} 2>run_result" + + + +case language + when "java" + # for java, we have to add additional systemcall and we don't check the mem limit (dunno how to fix...) + run_command = "#{problem_home}/script/box -T -t #{time_limit} -s getppid -s clone -s wait4 -p /usr/bin/ -p ./ -i #{input_file_name} -o output.txt #{program_name} 2>run_result" + when "ruby" + run_command = "#{problem_home}/script/box -T -t #{time_limit} -s getppid -s wait4 -s clone -s set_robust_list -s futex -s sigaltstack -p /dev/urandom -p ./ -p /home/dae/.rvm/rubies/ruby-1.9.2-p320/ -p #{problem_home}/ -i #{input_file_name} -o output.txt #{program_name} 2>run_result" + when "c++" + run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name} 2>run_result" + else + run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name} 2>run_result" +end + log "Running test #{test_num}..." log run_command @@ -137,7 +153,7 @@ report.call(run_result[0], 0, "No comment.\n") end -if running_time[:user].to_f + running_time[:sys].to_f > time_limit +if running_time[:user].to_f > time_limit log "Time limit exceeded." report.call("Time limit exceeded", 0, "No comment.\n") end