9
9
import logger
10
10
import resultsdiffer
11
11
12
+ # In the future this might depend on the language (e.g. for pyhon, use 15s)
13
+ PROBLEM_LTE_S = 3
14
+
12
15
def sort_key (file ):
13
16
# Extract the number from the filename
14
17
match = re .search (r'\d+' , file )
@@ -60,13 +63,20 @@ def runTest(exec_filename, testcase_filename, output_filename):
60
63
return 1 , f"The file { testcase_filename } does not exist."
61
64
62
65
try :
63
- result = subprocess .run ([os .path .basename (exec_filename ),
64
- os .path .abspath (testcase_filename ),
65
- os .path .abspath (output_filename )],
66
- shell = True ,
66
+ command = (
67
+ f"{ os .path .abspath (exec_filename )} "
68
+ f"{ os .path .abspath (testcase_filename )} "
69
+ f"{ os .path .abspath (output_filename )} "
70
+ )
71
+ logger .log (f"Running command: { command } " )
72
+ result = subprocess .run (command ,
73
+ shell = False ,
67
74
cwd = os .path .dirname (exec_filename ),
75
+ timeout = PROBLEM_LTE_S ,
68
76
stderr = subprocess .PIPE )
77
+ except subprocess .TimeoutExpired :
78
+ return 1 , f"Time Limit Exceeded"
69
79
except Exception as e :
70
- return 1 , f"Error running the test{ e } "
80
+ return 1 , f"Error running the test, command= { command } , error= { e } "
71
81
72
82
return result .returncode , result .stderr .decode ()
0 commit comments