Description:
[grader] engine_spec: fix reg-ex new line problem, change test case for 1.5 sec submission (as the machine is a little faster) git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@150 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r39:7a9b64601b9d - - 3 files changed: 3 inserted, 3 deleted

@@ -2,20 +2,20
2 #include <stdlib.h>
2 #include <stdlib.h>
3
3
4 int main()
4 int main()
5 {
5 {
6 int a,b;
6 int a,b;
7
7
8 int c=0;
8 int c=0;
9
9
10 scanf("%d %d",&a,&b);
10 scanf("%d %d",&a,&b);
11 printf("%d\n",a+b);
11 printf("%d\n",a+b);
12
12
13 for(a=0; a<2; a++) {
13 for(a=0; a<2; a++) {
14 - while(c<1150000000) {
14 + while(c<1550000000) {
15 c++;
15 c++;
16 b+=c;
16 b+=c;
17 }
17 }
18 }
18 }
19 exit(0);
19 exit(0);
20 }
20 }
21
21
@@ -223,25 +223,25
223 end
223 end
224
224
225 it "should report exit status" do
225 it "should report exit status" do
226 problem = stub(Problem,
226 problem = stub(Problem,
227 :id => 1, :name => 'test_normal')
227 :id => 1, :name => 'test_normal')
228 grader_should(:grade => 'add_nonzero_exit_status.c',
228 grader_should(:grade => 'add_nonzero_exit_status.c',
229 :on => problem,
229 :on => problem,
230 :with => 'in1.txt',
230 :with => 'in1.txt',
231 :and_report => {
231 :and_report => {
232 :graded_at= => nil,
232 :graded_at= => nil,
233 :compiler_message= => '',
233 :compiler_message= => '',
234 :grader_comment= => '',
234 :grader_comment= => '',
235 - :running_stat= => /[Ee]xit.*status.*10.*0.0 sec./,
235 + :running_stat= => /[Ee]xit.*status.*10.*0\.0 sec/m,
236 :output_file_name= => lambda { |fname|
236 :output_file_name= => lambda { |fname|
237 File.exists?(fname).should be_true
237 File.exists?(fname).should be_true
238 },
238 },
239 :save => nil})
239 :save => nil})
240 end
240 end
241
241
242 protected
242 protected
243 def grader_should(args)
243 def grader_should(args)
244 @user1 = stub(User,
244 @user1 = stub(User,
245 :id => 1, :login => 'user1')
245 :id => 1, :login => 'user1')
246
246
247 problem = args[:on]
247 problem = args[:on]
@@ -1,24 +1,24
1 module GraderEngineHelperMethods
1 module GraderEngineHelperMethods
2
2
3 def clear_sandbox
3 def clear_sandbox
4 config = Grader::Configuration.get_instance
4 config = Grader::Configuration.get_instance
5 clear_cmd = "rm -rf #{config.test_sandbox_dir}/*"
5 clear_cmd = "rm -rf #{config.test_sandbox_dir}/*"
6 system(clear_cmd)
6 system(clear_cmd)
7 end
7 end
8
8
9 def init_sandbox
9 def init_sandbox
10 config = Grader::Configuration.get_instance
10 config = Grader::Configuration.get_instance
11 clear_sandbox
11 clear_sandbox
12 - Dir.mkdir config.user_result_dir
12 + FileUtils.mkdir_p config.user_result_dir
13 cp_cmd = "cp -R #{config.test_data_dir}/ev #{config.test_sandbox_dir}"
13 cp_cmd = "cp -R #{config.test_data_dir}/ev #{config.test_sandbox_dir}"
14 system(cp_cmd)
14 system(cp_cmd)
15 end
15 end
16
16
17 def create_submission_from_file(id, user, problem,
17 def create_submission_from_file(id, user, problem,
18 source_fname, language=nil)
18 source_fname, language=nil)
19
19
20 language = stub(Language, :name => 'c', :ext => 'c') if language==nil
20 language = stub(Language, :name => 'c', :ext => 'c') if language==nil
21
21
22 config = Grader::Configuration.get_instance
22 config = Grader::Configuration.get_instance
23 source = File.open(config.test_data_dir + "/" + source_fname).read
23 source = File.open(config.test_data_dir + "/" + source_fname).read
24 stub(Submission,
24 stub(Submission,
You need to be logged in to leave comments. Login now