|
3 | 3 | import sys
|
4 | 4 | import subprocess
|
5 | 5 | import time
|
| 6 | +from multiprocessing import Process |
6 | 7 |
|
7 | 8 | import build_utils
|
8 | 9 |
|
@@ -52,9 +53,15 @@ def build_family(example, family):
|
52 | 53 | all_boards.append(entry.name)
|
53 | 54 | filter_with_input(all_boards)
|
54 | 55 | all_boards.sort()
|
55 |
| - |
| 56 | + |
| 57 | + plist = [] |
56 | 58 | for board in all_boards:
|
57 |
| - build_board(example, board) |
| 59 | + p = Process(target=build_board, args=(example, board)) |
| 60 | + plist.append(p) |
| 61 | + p.start() |
| 62 | + |
| 63 | + for p in plist: |
| 64 | + p.join() |
58 | 65 |
|
59 | 66 | def build_board(example, board):
|
60 | 67 | global success_count, fail_count, skip_count, exit_status
|
@@ -88,25 +95,25 @@ def build_board(example, board):
|
88 | 95 | print(build_result.stdout.decode("utf-8"))
|
89 | 96 |
|
90 | 97 | def build_size(example, board):
|
91 |
| - #elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board) |
92 | 98 | elf_file = 'examples/{}/_build/{}/*.elf'.format(example, board)
|
93 | 99 | size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
|
94 | 100 | size_list = size_output.split('\n')[1].split('\t')
|
95 | 101 | flash_size = int(size_list[0])
|
96 | 102 | sram_size = int(size_list[1]) + int(size_list[2])
|
97 | 103 | return (flash_size, sram_size)
|
98 | 104 |
|
99 |
| -print(build_separator) |
100 |
| -print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) |
101 |
| - |
102 |
| -for example in all_examples: |
| 105 | +if __name__ == '__main__': |
103 | 106 | print(build_separator)
|
104 |
| - for family in all_families: |
105 |
| - build_family(example, family) |
| 107 | + print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) |
106 | 108 |
|
107 |
| -total_time = time.monotonic() - total_time |
108 |
| -print(build_separator) |
109 |
| -print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, total_time)) |
110 |
| -print(build_separator) |
| 109 | + for example in all_examples: |
| 110 | + print(build_separator) |
| 111 | + for family in all_families: |
| 112 | + build_family(example, family) |
| 113 | + |
| 114 | + total_time = time.monotonic() - total_time |
| 115 | + print(build_separator) |
| 116 | + print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, total_time)) |
| 117 | + print(build_separator) |
111 | 118 |
|
112 |
| -sys.exit(exit_status) |
| 119 | + sys.exit(exit_status) |
0 commit comments