[ci] Added customs RAM and ROM sections to the metric system

This commit is contained in:
M4x1m3
2020-07-18 15:40:03 +02:00
parent 57a37d7028
commit b87e9879bc
2 changed files with 10 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ jobs:
run: make -j2 -C head epsilon.elf
- name: Retrieve binary size analysis
id: binary_size
run: echo "::set-output name=table::$(python3 head/build/metrics/binary_size.py base/output/release/device/n0110/epsilon.elf head/output/release/device/n0110/epsilon.elf --labels Base Head --sections .text .rodata .bss .data --escape)"
run: echo "::set-output name=table::$(python3 head/build/metrics/binary_size.py base/output/release/device/n0110/epsilon.elf head/output/release/device/n0110/epsilon.elf --labels Base Head --sections .text .rodata .bss .data --custom 'Total (RAM)' .data .bss --custom 'Total (ROM)' .text .rodata .data --escape)"
- name: Prepare comment auth
run: echo "::set-env name=GITHUB_TOKEN::$(echo YjgxYTk1YTQ4YzYxNjU4ZTA3YWQzNDYwNTk3ZTI2MTlkODU5MThlOQo= | base64 --decode)"
- name: Add comment

View File

@@ -118,6 +118,7 @@ parser.add_argument('files', type=str, nargs='+', help='an ELF file')
parser.add_argument('--labels', type=str, nargs='+', help='label for ELF file')
parser.add_argument('--sections', type=str, nargs='+', help='Section (prefix) to list')
parser.add_argument('--escape', action='store_true', help='Escape the output')
parser.add_argument('--custom', type=str, action='append', nargs='+', help='Custom sections, made from the addition of other sections.')
args = parser.parse_args()
@@ -128,7 +129,14 @@ for i,filename in enumerate(args.files):
label = os.path.basename(filename)
if args.labels and i < len(args.labels):
label = args.labels[i]
table.append({'label': label, 'values': row_for_elf(filename, args.sections)})
values = row_for_elf(filename, args.sections)
for custom_section in args.custom:
if (len(custom_section) >= 2):
custom_section_size = 0
for i in range(len(custom_section) - 1):
custom_section_size += values[custom_section[i + 1]]
values[custom_section[0]] = custom_section_size
table.append({'label': label, 'values': values})
formatted_table = format_table(table)
if args.escape: