Skip to content

Commit 589eda9

Browse files
committed
error handling for timeout and remove traceReader file space clearing
1 parent c3737e1 commit 589eda9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

automation/automate.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import shutil
44
import subprocess
55
import collections
6+
import multiprocessing
67

78
project_id = sys.argv[1]
89
defect_id = sys.argv[2]
@@ -125,6 +126,7 @@
125126

126127

127128
grep_tests_list=[]
129+
kill_count=0
128130

129131
gzoltars_dir=os.path.join(root_directory,"gzoltars",project_id,defect_id)
130132

@@ -154,7 +156,17 @@
154156
os.path.join(traces_dir,"trace."+testclass+"#"+testname) + " > " \
155157
+ os.path.join(traces_dir,"trace."+testclass+"#"+testname+".output")
156158
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()
158170

159171
grep_relevant_command="grep -rl "+relevant_class+" "+os.path.join(traces_dir,"trace."+testclass+"#"+testname+".output")
160172
print("Running "+grep_relevant_command)
@@ -163,6 +175,7 @@
163175
if not grep_result is '':
164176
grep_tests_list += grep_result.splitlines()
165177
print("Count of grep result: "+str(len(grep_tests_list)))
178+
print("Count killed test: "+str(kill_count))
166179

167180
print("Removing traceReader output file: "+os.path.join(traces_dir,"trace."+testclass+"#"+testname+".output"))
168181
os.remove(os.path.join(traces_dir,"trace."+testclass+"#"+testname+".output"))

0 commit comments

Comments
 (0)