|
25 | 25 | TURN_IN_PROMPT = 'Do you want to turn in assignment now?' |
26 | 26 |
|
27 | 27 | TURN_IN_COMMAND = 'cse11turnin {}' |
| 28 | +VERIFY_COMMAND = 'cse11verify {}' |
28 | 29 |
|
29 | 30 | EXIT_SUCCESS = 0 |
30 | 31 | EXIT_FAILURE = 1 |
@@ -142,6 +143,12 @@ def process_project(): |
142 | 143 | print('\n') |
143 | 144 | print('Start turning in assignment...') |
144 | 145 | turnin() |
| 146 | + |
| 147 | + print('\n') |
| 148 | + print('Start verifying assignment...') |
| 149 | + verify() |
| 150 | + |
| 151 | + print('\n') |
145 | 152 | print('Completed!') |
146 | 153 |
|
147 | 154 |
|
@@ -178,13 +185,16 @@ def test_compile(files, optionals, libraries): |
178 | 185 | class_path = ''.join(libs) + '.' |
179 | 186 | cmd = 'javac -cp {} {}' |
180 | 187 |
|
181 | | - result = subprocess.check_output(cmd.format(class_path, ' '.join(files)), shell=True) |
| 188 | + java_list = filter(lambda x: str(x).endswith('.java'), files) |
| 189 | + optional_list = filter(lambda x: str(x).endswith('.java'), optionals) |
| 190 | + |
| 191 | + result = subprocess.check_output(cmd.format(class_path, ' '.join(java_list)), shell=True) |
182 | 192 | if len(result) != 0: |
183 | 193 | error('Your source codes cannot be compiled; see {} for details.'.format(COMPILE_ERROR_FILE_NAME)) |
184 | 194 | has_error = True |
185 | 195 |
|
186 | 196 | if len(optionals) != 0: |
187 | | - result = subprocess.check_output(cmd.format(class_path, ' '.join(optionals)), shell=True) |
| 197 | + result = subprocess.check_output(cmd.format(class_path, ' '.join(optional_list)), shell=True) |
188 | 198 | if len(result) != 0: |
189 | 199 | error('Your optional files cannot be compiled; see {} for details.'.format(COMPILE_ERROR_FILE_NAME)) |
190 | 200 | has_error = True |
@@ -276,6 +286,11 @@ def turnin(): |
276 | 286 | p.wait() |
277 | 287 |
|
278 | 288 |
|
| 289 | +def verify(): |
| 290 | + """ Verify assignment. """ |
| 291 | + os.system(VERIFY_COMMAND.format(project)) |
| 292 | + |
| 293 | + |
279 | 294 | def error(msg): |
280 | 295 | """ Show error message to user. """ |
281 | 296 | sys.stderr.write('> \033[93m{} \033[0m\n'.format(msg)) |
|
0 commit comments