\n" \
190 | "
" \
191 | "This is a bug page that runs the regdroid tool" \
192 | "
\n" \
193 | "
All the bug connections are listed below\n" \
194 | "
\n" \
195 | "
\n" \
196 | "-----------------------------------------------------------------------------------" \
197 | "
\n" \
198 | "
" \
199 | "X-Picture:Y means image index(Y) in the test trace(X) of a policy" \
200 | "
\n" \
201 | "
" \
202 | "You can click on it to jump to another detaied page" \
203 | "
\n" \
204 | "
\n"
205 | insert_lines = insert_lines + tip
206 | bug_index = 1
207 | for strategy in strategy_list:
208 | insert_lines = insert_lines + '
'
209 | directory_num_list = []
210 | bug_event_num_list = []
211 | bug_file_name = output_path + "/strategy_" + strategy + "/error_realtime.txt"
212 | lines = open(bug_file_name, 'r', encoding="UTF-8").readlines()
213 | step = 2
214 | lines__ = [lines[i:i + step] for i in range(0, len(lines), step)]
215 | temp = 0
216 | for line in lines__:
217 | find_str1 = "run_count"
218 | find_str2 = "End"
219 | if len(line) > 1:
220 | if line[0].find(find_str1) > -1:
221 | directory_num_list.append(
222 | line[0][line[0].find(find_str1) + 11:])
223 | elif line[1].find(find_str1) > -1:
224 | directory_num_list.append(
225 | line[1][line[1].find(find_str1) + 11:])
226 | elif line[0].find(find_str2) > -1:
227 | bug_event_num_list.append(temp)
228 | elif line[1].find(find_str2) > -1:
229 | bug_event_num_list.append(
230 | line[0][0:line[0].find("::")])
231 | temp = line[1][0:4]
232 | else:
233 | if line[0].find(find_str1) > -1:
234 | directory_num_list.append(
235 | line[0][line[0].find(find_str1) + 11:])
236 | elif line[0].find(find_str2) > -1:
237 | bug_event_num_list.append(temp)
238 |
239 | if len(directory_num_list) == 0:
240 | continue
241 |
242 | insert_lines = insert_lines + '
Policy: ' + strategy + '
' + '\n'
243 |
244 | for directory_num, bug_event_num in zip(directory_num_list, bug_event_num_list):
245 | directory_num = directory_num.strip('\n')
246 | insert_lines = insert_lines + 'Bug' + str(bug_index) + ': '\
247 | '
' \
249 | + directory_num.replace('\n', '') + \
250 | '-Picture:' + bug_event_num + '\n'
251 | bug_index = bug_index + 1
252 | insert_lines = insert_lines + '
\n' \
253 | '\n' \
254 | '\n'
255 | f_outline_html.write(''.join(insert_lines))
256 | f_outline_html.close()
257 |
258 | def generate_replay_all_html(self, output_path, strategy_list):
259 | outline_path = output_path + '/all_replay_bugs.html'
260 | f_outline_html = open(outline_path, 'w+', encoding="UTF-8")
261 | insert_lines = '\n' \
262 | '\n' \
263 | '\n' \
264 | '
All bug report\n' \
265 | '\n' \
266 | '\n'
267 |
268 | tip = "
\n" \
269 | "
" \
270 | "This is a bug page that runs the regdroid tool" \
271 | "
\n" \
272 | "
All the bug connections are listed below\n" \
273 | "
\n" \
274 | "
\n" \
275 | "-----------------------------------------------------------------------------------" \
276 | "
\n" \
277 | "
" \
278 | "X_trace.html is a bug's hayperlink, you can click on it" \
279 | "
\n" \
280 | "
" \
281 | "And then slide to the last few images to check the bug" \
282 | "
\n" \
283 | "
\n"
284 | insert_lines = insert_lines + tip + '
\n'
285 | bug_index = 1
286 | for strategy in strategy_list:
287 |
288 | replay_base_path = output_path + "/strategy_" + strategy + "/error_replay/"
289 | files = os.listdir(replay_base_path)
290 | temp_insert_lines = ""
291 | have_html = False
292 | for file in files:
293 | replay_path = replay_base_path + file
294 | html_files = os.listdir(replay_path)
295 | have_html = False
296 |
297 | for html in html_files:
298 | if html.find('html') > -1:
299 | have_html = True
300 | temp_insert_lines = temp_insert_lines + 'Bug' + str(bug_index) + ': '\
301 | '
' \
303 | + html.replace('\n', '') + \
304 | '\n'
305 | if have_html:
306 | insert_lines = insert_lines + '
Policy: ' + strategy + '
\n'
307 | insert_lines = insert_lines + temp_insert_lines
308 | have_html = False
309 | insert_lines = insert_lines + '
\n' \
310 | '\n' \
311 | '\n'
312 | f_outline_html.write(''.join(insert_lines))
313 | f_outline_html.close()
314 |
--------------------------------------------------------------------------------
/RegDroid/view.py:
--------------------------------------------------------------------------------
1 |
2 | class View(object):
3 |
4 | def __init__(self, line, father, sons):
5 | self.level = line.find('