@@ -87,12 +87,12 @@ def execute_checker(with_stderr=False, stderr=None):
87
87
return renv ['stdout' ]
88
88
89
89
90
- def _run_compare (env ):
91
- e = SandboxExecutor ('exec -sandbox' )
90
+ def _run_compare (env , format ):
91
+ e = SandboxExecutor ('oicompare -sandbox-v1.0.2 ' )
92
92
renv = _run_in_executor (
93
- env , [os .path .join ('bin' , 'compare ' ), 'hint' , 'out' ], e , ignore_errors = True
93
+ env , [os .path .join ('bin' , 'oicompare ' ), 'hint' , 'out' , format ], e , ignore_errors = True
94
94
)
95
- return renv [ 'stdout' ]
95
+ return renv
96
96
97
97
98
98
def _limit_length (s ):
@@ -116,7 +116,21 @@ def run(environ, use_sandboxes=True):
116
116
117
117
output = _run_checker (environ , use_sandboxes )
118
118
elif use_sandboxes :
119
- output = _run_compare (environ )
119
+ renv = _run_compare (environ , environ .get ('checker_format' , 'english_abbreviated' ))
120
+ if renv ['return_code' ] == 0 :
121
+ environ ['result_code' ] = 'OK'
122
+ environ ['result_percentage' ] = (100 , 1 )
123
+ elif renv ['return_code' ] == 1 :
124
+ environ ['result_code' ] = 'WA'
125
+ environ ['result_percentage' ] = (0 , 1 )
126
+ # Should be redundant because we are using oicompare with abbreviated output,
127
+ # but just in case.
128
+ environ ['result_string' ] = _limit_length (renv ['stdout' ][0 ])
129
+ else :
130
+ raise CheckerError (
131
+ 'oicompare returned code(%d). Checker renv: %s' % (renv ['return_code' ], renv )
132
+ )
133
+ return environ
120
134
else :
121
135
output = _run_diff (environ )
122
136
except (CheckerError , ExecError ) as e :
@@ -155,4 +169,4 @@ def output_to_fraction(output_str):
155
169
except ZeroDivisionError :
156
170
raise CheckerError ('Zero division in checker output "%s"' % output_str )
157
171
except TypeError :
158
- raise CheckerError ('Invalid checker output "%s"' % output_str )
172
+ raise CheckerError ('Invalid checker output "%s"' % output_str )
0 commit comments