2 # -*- coding: utf-8 -*-
6 from datetime import datetime
9 from matrix_runner import main, matrix_axis, matrix_action, matrix_command, matrix_filter, \
10 FileReport, JUnitReport
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 CM52 = ('Cortex-M52', 'CM52')
33 CM52S = ('Cortex-M52S', 'CM52S')
34 CM52NS = ('Cortex-M52NS', 'CM52NS')
35 CM55 = ('Cortex-M55', 'CM55')
36 CM55S = ('Cortex-M55S', 'CM55S')
37 CM55NS = ('Cortex-M55NS', 'CM55NS')
38 CM85 = ('Cortex-M85', 'CM85')
39 CM85S = ('Cortex-M85S', 'CM85S')
40 CM85NS = ('Cortex-M85NS', 'CM85NS')
41 CA5 = ('Cortex-A5', 'CA5')
42 CA7 = ('Cortex-A7', 'CA7')
43 CA9 = ('Cortex-A9', 'CA9')
44 CA5NEON = ('Cortex-A5neon', 'CA5neon')
45 CA7NEON = ('Cortex-A7neon', 'CA7neon')
46 CA9NEON = ('Cortex-A9neon', 'CA9neon')
49 @matrix_axis("compiler", "c", "Compiler(s) to be considered.")
50 class CompilerAxis(Enum):
57 @matrix_axis("optimize", "o", "Optimization level(s) to be considered.")
58 class OptimizationAxis(Enum):
60 BALANCED = ('balanced')
66 return datetime.now().strftime('%Y%m%d%H%M%S')
70 def lit(config, results):
71 """Run tests for the selected configurations using llvm's lit."""
72 yield run_lit(config.compiler[0], config.device[1], config.optimize[0])
73 results[0].test_report.write(f"lit-{config.compiler[0]}-{config.optimize[0]}-{config.device[1]}-{timestamp()}.xunit")
77 return datetime.now().strftime('%Y%m%d%H%M%S')
80 @matrix_command(test_report=FileReport(f"lit.xml") | JUnitReport())
81 def run_lit(toolchain, device, optimize):
82 return ["lit", "--xunit-xml-output", f"lit.xml", "-D", f"toolchain={toolchain}", "-D", f"device={device}", "-D", f"optimize={optimize}", "src" ]
86 def filter_iar(config):
87 return config.compiler == CompilerAxis.IAR
91 def filter_gcc_cm52(config):
92 device = config.device.match('CM52*')
93 compiler = config.compiler == CompilerAxis.GCC
94 return device and compiler
97 if __name__ == "__main__":