mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-03-23 07:23:10 +08:00
* [fix] fix some bugs small errors from compilation tests * Attempt to fix the detection of failing tests Side effect: the file issues.md is not produced anymore, but still available in stdout, so needs a manual copy if needed
77 lines
2.2 KiB
Python
Executable File
77 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# Parse compiler logs and generate a summary of the errors and warnings
|
|
# Load log file from var/compiler.log
|
|
|
|
import os
|
|
import sys
|
|
import re
|
|
from os import path
|
|
|
|
sys.path.append(path.normpath(path.join(path.dirname(path.abspath(__file__)), 'modules')))
|
|
from TAP import Builder
|
|
|
|
def parse_log(log_file):
|
|
with open(log_file, 'r') as f:
|
|
lines = f.readlines()
|
|
|
|
errors = []
|
|
conf = 'Unknown'
|
|
airframe = ''
|
|
module = ''
|
|
|
|
for line in lines:
|
|
lowerline = line.lower()
|
|
if 'Testing all aircrafts in conf: ' in line:
|
|
conf = line.split('Testing all aircrafts in conf: ')[1].strip()
|
|
#print(conf)
|
|
elif 'tests/modules/test_modules.py' in line:
|
|
conf = 'modules'
|
|
elif 'compiling AIRCRAFT: [' in line:
|
|
airframe = line.split('compiling AIRCRAFT: [')[1].strip().strip(']').replace('] TARGET: [', ' --- ' )
|
|
#print('\t-',airframe)
|
|
if conf == 'modules':
|
|
if ('ok ' in line) and ('_0' in line):
|
|
airframe = line.strip()
|
|
|
|
if conf and airframe:
|
|
if ('error:' in lowerline) or ('failed:' in lowerline):
|
|
errors.append((conf, airframe, line.strip()))
|
|
if 'warning:' in lowerline:
|
|
errors.append((conf, airframe, line.strip()))
|
|
|
|
return errors
|
|
|
|
def print_errors(errors):
|
|
last_conf = ''
|
|
last_airframe = ''
|
|
ok = Builder.create(1).ok
|
|
if len(errors) == 0:
|
|
ok(True,' - everything looks OK!')
|
|
return
|
|
for conf, airframe, error in errors:
|
|
if conf != last_conf:
|
|
print('')
|
|
print(conf+':')
|
|
print('-' * len(conf))
|
|
last_conf = conf
|
|
last_airframe = ''
|
|
|
|
if airframe != last_airframe:
|
|
print(' - ',airframe)
|
|
last_airframe = airframe
|
|
|
|
print('\t- [ ] ```',error,'```')
|
|
ok(False,f'- found {len(errors)} errors')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
print('=========================')
|
|
print('|| SUMMARY ||')
|
|
print('=========================')
|
|
log_file = './var/compile.log'
|
|
errors = parse_log(log_file)
|
|
print_errors(errors)
|
|
|
|
|