From 86d3a534ce5bf5e1986110f3b66a74cd3ada8cd1 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 22 Apr 2016 00:12:57 -0500 Subject: [PATCH] Safer runtime error handling. --- lib/kgrader/runtime.rb | 7 ++++++- spec/cs241h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/kgrader/runtime.rb b/lib/kgrader/runtime.rb index fe0e9eb..4141b92 100644 --- a/lib/kgrader/runtime.rb +++ b/lib/kgrader/runtime.rb @@ -7,17 +7,22 @@ module KGrader def testcase(options) puts " running test: #{File.basename $0} ".center MAX_COLS, '=' + begin Timeout::timeout options[:alarm] { yield } rescue Timeout::Error comment "timeout" grade 0 end - puts " done ".center MAX_COLS, '-' + + puts "no grade received?" + comment "autograde error (no grade reported); please contact staff" + grade 0 end def grade(score) IO.new(3).write score + puts " done ".center MAX_COLS, '-' exit end diff --git a/spec/cs241h b/spec/cs241h index 514bd96..22fd6cb 160000 --- a/spec/cs241h +++ b/spec/cs241h @@ -1 +1 @@ -Subproject commit 514bd96d25d797ceb17f166f508e3195afb795f1 +Subproject commit 22fd6cb688fcce712b4b68235533b59753aeaed7