@@ -135,51 +135,51 @@ def _output_to_fraction(self, output_str):
135135 except TypeError :
136136 raise CheckerException (f'Invalid checker output "{ output_str } "' )
137137
138- def _parse_checker_output (self , output : List [str ]) -> Tuple [bool , Fraction , str ]:
138+ def _parse_checker_output (self , output : List [str ], stderr : str ) -> Tuple [bool , Fraction , str , str ]:
139139 while len (output ) < 3 :
140140 output .append ('' )
141141
142142 if output [0 ].strip () == "OK" :
143143 points = self ._output_to_fraction (output [2 ])
144- return True , points , output [1 ].strip ()
144+ return True , points , output [1 ].strip (), stderr
145145 else :
146- return False , Fraction (0 , 1 ), output [1 ].strip ()
146+ return False , Fraction (0 , 1 ), output [1 ].strip (), stderr
147147
148- def _run_checker (self , input_file_path , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str ]:
148+ def _run_checker (self , input_file_path , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str , str ]:
149149 proc = subprocess .Popen ([self .checker_path , input_file_path , output_file_path , answer_file_path ],
150150 stdout = subprocess .PIPE , stderr = subprocess .PIPE )
151151 proc .wait ()
152152 output , stderr = proc .communicate ()
153153 if proc .returncode > 2 :
154154 return False , Fraction (0 , 1 ), (f"Checker returned with code { proc .returncode } , "
155155 f"stderr: '{ stderr .decode ('utf-8' )} '" )
156- return self ._parse_checker_output (output .decode ('utf-8' ).split ('\n ' ))
156+ return self ._parse_checker_output (output .decode ('utf-8' ).split ('\n ' ), stderr . decode ( 'utf-8' ) )
157157
158- def _run_diff (self , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str ]:
158+ def _run_diff (self , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str , str ]:
159159 same = oicompare .compare (output_file_path , answer_file_path )
160160 if same :
161- return True , Fraction (100 , 1 ), ""
161+ return True , Fraction (100 , 1 ), "" , ""
162162 else :
163- return False , Fraction (0 , 1 ), ""
163+ return False , Fraction (0 , 1 ), "" , ""
164164
165- def _run_oicompare (self , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str ]:
165+ def _run_oicompare (self , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str , str ]:
166166 path = oicompare .get_path ()
167167 proc = subprocess .Popen ([path , output_file_path , answer_file_path , 'english_abbreviated' ],
168168 stdout = subprocess .PIPE , stderr = subprocess .PIPE )
169169 proc .wait ()
170170 output , stderr = proc .communicate ()
171171 if proc .returncode == 0 :
172- return True , Fraction (100 , 1 ), ""
172+ return True , Fraction (100 , 1 ), "" , ""
173173 elif proc .returncode == 1 :
174- return False , Fraction (0 , 1 ), output .decode ('utf-8' ).strip ()
174+ return False , Fraction (0 , 1 ), output .decode ('utf-8' ).strip (), stderr . decode ( 'utf-8' )
175175 else :
176176 raise CheckerException (f"!!! oicompare failed with code { proc .returncode } . This is a huge bug, please report"
177177 f" it here https://github.com/sio2project/sinol-make/issues/new/choose and provide "
178178 f"these files: { output_file_path } , { answer_file_path } .\n "
179179 f"Output: { output .decode ('utf-8' ).strip ()} \n "
180180 f"Stderr: { stderr .decode ('utf-8' ).strip ()} " )
181181
182- def check_output (self , input_file_path , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str ]:
182+ def check_output (self , input_file_path , output_file_path , answer_file_path ) -> Tuple [bool , Fraction , str , str ]:
183183 """
184184 Runs the checker (or runs diff) and returns a tuple of three values:
185185 - bool: whether the solution is correct
0 commit comments