Merge pull request #383 from M4xi1m3/omega-dev-e14

[ci] Added customs RAM and ROM sections to the metric system
This commit is contained in:
Quentin
2020-07-18 17:16:28 +02:00
committed by GitHub
2 changed files with 12 additions and 4 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

@@ -37,7 +37,7 @@ def row_for_elf(elf, requested_section_prefixes):
# String formatting
def iso_separate(string):
space = ' ' # We may want to use a thin non-breaking space as thousands separator
space = '' # We may want to use a thin non-breaking space as thousands separator
return string.replace('_',space).replace('+','+'+space).replace('-','-'+space)
def format_bytes(value, force_sign=False):
@@ -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,10 +129,17 @@ 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:
print(urllib.parse.quote(formatted_table, safe='| :*+'))
print(urllib.parse.quote(formatted_table, safe='| :*+()'))
else:
print(formatted_table)