File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 3
3
import shutil
4
4
import subprocess
5
5
import collections
6
+ import multiprocessing
6
7
7
8
project_id = sys .argv [1 ]
8
9
defect_id = sys .argv [2 ]
125
126
126
127
127
128
grep_tests_list = []
129
+ kill_count = 0
128
130
129
131
gzoltars_dir = os .path .join (root_directory ,"gzoltars" ,project_id ,defect_id )
130
132
154
156
os .path .join (traces_dir ,"trace." + testclass + "#" + testname ) + " > " \
155
157
+ os .path .join (traces_dir ,"trace." + testclass + "#" + testname + ".output" )
156
158
print ("Running " + traceReader_command )
157
- os .system (traceReader_command )
159
+ p = multiprocessing .Process (target = os .system (traceReader_command ))
160
+ p .start ()
161
+
162
+ p .join (300 )
163
+
164
+ if p .is_alive ():
165
+ print ("ERROR: running for too long... let's kill command: " + traceReader_command )
166
+ kill_count += 1
167
+ # Terminate
168
+ p .terminate ()
169
+ p .join ()
158
170
159
171
grep_relevant_command = "grep -rl " + relevant_class + " " + os .path .join (traces_dir ,"trace." + testclass + "#" + testname + ".output" )
160
172
print ("Running " + grep_relevant_command )
163
175
if not grep_result is '' :
164
176
grep_tests_list += grep_result .splitlines ()
165
177
print ("Count of grep result: " + str (len (grep_tests_list )))
178
+ print ("Count killed test: " + str (kill_count ))
166
179
167
180
print ("Removing traceReader output file: " + os .path .join (traces_dir ,"trace." + testclass + "#" + testname + ".output" ))
168
181
os .remove (os .path .join (traces_dir ,"trace." + testclass + "#" + testname + ".output" ))
You can’t perform that action at this time.
0 commit comments