|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | + |
| 4 | +import logging |
| 5 | + |
| 6 | +from datetime import datetime |
| 7 | +from enum import Enum |
| 8 | + |
| 9 | +from matrix_runner import main, matrix_axis, matrix_action, matrix_command, matrix_filter, \ |
| 10 | + FileReport, JUnitReport |
| 11 | + |
| 12 | + |
| 13 | +@matrix_axis("device", "d", "Device(s) to be considered.") |
| 14 | +class DeviceAxis(Enum): |
| 15 | + CM0 = ('Cortex-M0', 'CM0') |
| 16 | + CM0plus = ('Cortex-M0plus', 'CM0plus') |
| 17 | + CM3 = ('Cortex-M3', 'CM3') |
| 18 | + CM4 = ('Cortex-M4', 'CM4') |
| 19 | + CM4FP = ('Cortex-M4FP', 'CM4FP') |
| 20 | + CM7 = ('Cortex-M7', 'CM7') |
| 21 | + CM7SP = ('Cortex-M7SP', 'CM7SP') |
| 22 | + CM7DP = ('Cortex-M7DP', 'CM7DP') |
| 23 | + CM23 = ('Cortex-M23', 'CM23') |
| 24 | + CM23S = ('Cortex-M23S', 'CM23S') |
| 25 | + CM23NS = ('Cortex-M23NS', 'CM23NS') |
| 26 | + CM33 = ('Cortex-M33', 'CM33') |
| 27 | + CM33S = ('Cortex-M33S', 'CM33S') |
| 28 | + CM33NS = ('Cortex-M33NS', 'CM33NS') |
| 29 | + CM35P = ('Cortex-M35P', 'CM35P') |
| 30 | + CM35PS = ('Cortex-M35PS', 'CM35PS') |
| 31 | + CM35PNS = ('Cortex-M35PNS', 'CM35PNS') |
| 32 | + CM55 = ('Cortex-M55', 'CM55') |
| 33 | + CM55S = ('Cortex-M55S', 'CM55S') |
| 34 | + CM55NS = ('Cortex-M55NS', 'CM55NS') |
| 35 | + CM85 = ('Cortex-M85', 'CM85') |
| 36 | + CM85S = ('Cortex-M85S', 'CM85S') |
| 37 | + CM85NS = ('Cortex-M85NS', 'CM85NS') |
| 38 | + CA5 = ('Cortex-A5', 'CA5') |
| 39 | + CA7 = ('Cortex-A7', 'CA7') |
| 40 | + CA9 = ('Cortex-A9', 'CA9') |
| 41 | + CA5NEON = ('Cortex-A5neon', 'CA5neon') |
| 42 | + CA7NEON = ('Cortex-A7neon', 'CA7neon') |
| 43 | + CA9NEON = ('Cortex-A9neon', 'CA9neon') |
| 44 | + |
| 45 | + |
| 46 | +@matrix_axis("compiler", "c", "Compiler(s) to be considered.") |
| 47 | +class CompilerAxis(Enum): |
| 48 | + AC6 = ('AC6') |
| 49 | + GCC = ('GCC') |
| 50 | + IAR = ('IAR') |
| 51 | + CLANG = ('Clang') |
| 52 | + |
| 53 | +@matrix_axis("optimize", "o", "Optimization level(s) to be considered.") |
| 54 | +class OptimizationAxis(Enum): |
| 55 | + NONE = ('none') |
| 56 | + BALANCED = ('balanced') |
| 57 | + SPEED = ('speed') |
| 58 | + SIZE = ('size') |
| 59 | + |
| 60 | + |
| 61 | +@matrix_action |
| 62 | +def lit(config): |
| 63 | + """Run tests for the selected configurations using llvm's lit.""" |
| 64 | + yield run_lit(config.compiler[0], config.device[1], config.optimize[0]) |
| 65 | + |
| 66 | + |
| 67 | +def timestamp(): |
| 68 | + return datetime.now().strftime('%Y%m%d%H%M%S') |
| 69 | + |
| 70 | +@matrix_command() |
| 71 | +def run_lit(toolchain, device, optimize): |
| 72 | + return ["lit", "--xunit-xml-output", f"lit-{toolchain}-{optimize}-{device}.xunit", "-D", f"toolchain={toolchain}", "-D", f"device={device}", "-D", f"optimize={optimize}", "." ] |
| 73 | + |
| 74 | +@matrix_filter |
| 75 | +def filter_iar(config): |
| 76 | + return config.compiler == CompilerAxis.IAR |
| 77 | + |
| 78 | +@matrix_filter |
| 79 | +def filter_gcc_cm85(config): |
| 80 | + return config.compiler == CompilerAxis.GCC and config.device.match('CM85*') |
| 81 | + |
| 82 | +#@matrix_filter |
| 83 | +#def filter_clang_cortex_a(config): |
| 84 | +# return config.compiler == CompilerAxis.CLANG and config.device.match('CA*') |
| 85 | + |
| 86 | + |
| 87 | +if __name__ == "__main__": |
| 88 | + main() |
0 commit comments