44import subprocess
55import time
66
7- travis = False
8- if "TRAVIS" in os .environ and os .environ ["TRAVIS" ] == "true" :
9- travis = True
10-
117all_warnings = False
12- if "ALL_WARNINGS" in os .environ and os .environ ["ALL_WARNINGS" ] == "true" :
13- all_warnings = True
14-
15- ENV_VARIABLE_NAME = 'VARIANT'
16-
17-
188exit_status = 0
199success_count = 0
2010fail_count = 0
11+ skip_count = 0
2112
22- build_format = '| {:20} | {:30 } | {:9} '
23- build_separator = '-' * 78
13+ build_format = '| {:20} | {:35 } | {:9} '
14+ build_separator = '-' * 83
2415
25- variants_dict = {
26- 'feather52832' : 'Feather nRF52832' ,
27- 'feather52840' : 'Feather nRF52840 Express' ,
28- 'cplaynrf52840' : 'Circuit Playground Bluefruit Express' ,
29- 'itsybitsy52840' : 'ItsyBitsy nRF52840 Express' ,
30- 'cluenrf52840' : 'CLUE nRF52840'
31- }
16+ default_boards = [ 'feather52832' , 'feather52840' , 'cplaynrf52840' , 'itsybitsy52840' , 'cluenrf52840' ]
3217
33- all_variants = []
18+ build_boards = []
3419
3520# build all variants if input not existed
3621if len (sys .argv ) > 1 :
37- if (sys .argv [1 ] in variants_dict ):
38- all_variants .append (sys .argv [1 ])
39- else :
40- print ('\033 [31INTERNAL ERR\033 [0m - invalid variant name "{}"' .format (sys .argv [1 ]))
41- sys .exit (- 1 )
22+ build_boards .append (sys .argv [1 ])
4223else :
43- all_variants = list (variants_dict .keys ())
44-
45- print (all_variants )
46- exit
24+ build_boards = default_boards
4725
4826def errorOutputFilter (line ):
4927 if len (line ) == 0 :
@@ -55,11 +33,11 @@ def errorOutputFilter(line):
5533
5634
5735def build_examples (variant ):
58- global exit_status , success_count , fail_count , build_format , build_separator
36+ global exit_status , success_count , fail_count , skip_count , build_format , build_separator
5937
6038 print ('\n ' )
6139 print (build_separator )
62- print ('| {:^74 } |' .format (variants_dict [ variant ] ))
40+ print ('| {:^79 } |' .format ('Board ' + variant ))
6341 print (build_separator )
6442 print ((build_format + '| {:6} |' ).format ('Library' , 'Example' , 'Result' , 'Time' ))
6543 print (build_separator )
@@ -69,12 +47,13 @@ def build_examples(variant):
6947 for sketch in glob .iglob ('libraries/**/*.ino' , recursive = True ):
7048 start_time = time .monotonic ()
7149
72- # skip if example contains: ".skip" or ".skip.variant "
73- # however ".build.variant" file can overwrite ".skip", used to build a specific variant only
50+ # Skip if contains: ".board.test. skip" or ".all.test.skip "
51+ # Skip if not contains: ".board.test.only" for a specific board
7452 sketchdir = os .path .dirname (sketch )
75- if ( (os .path .exists (sketchdir + '/.skip' ) or os .path .exists (sketchdir + '/.skip.' + variant )) and
76- not os .path .exists (sketchdir + '/.build.' + variant )):
77- success = "skipped"
53+ if os .path .exists (sketchdir + '/.all.test.skip' ) or os .path .exists (sketchdir + '/.' + variant + '.test.skip' ):
54+ success = "\033 [33mskipped\033 [0m "
55+ elif glob .glob (sketchdir + "/.*.test.only" ) and not os .path .exists (sketchdir + '/.build.' + variant ):
56+ success = "\033 [33mskipped\033 [0m "
7857 else :
7958 # TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR.
8059 # preferably, would use Python logging handler to get both distinct outputs and one merged output
@@ -106,24 +85,26 @@ def build_examples(variant):
10685
10786 print ((build_format + '| {:5.2f}s |' ).format (sketch .split (os .path .sep )[1 ], os .path .basename (sketch ), success , build_duration ))
10887
109- if success != "skipped " :
88+ if success != "\033 [33mskipped \033 [0m " :
11089 if build_result .returncode != 0 :
11190 print (build_result .stdout .decode ("utf-8" ))
11291 if (build_result .stderr ):
11392 print (build_result .stderr .decode ("utf-8" ))
11493 if len (warningLines ) != 0 :
11594 for line in warningLines :
11695 print (line )
96+ else :
97+ skip_count += 1
11798
11899
119100build_time = time .monotonic ()
120101
121- for var in all_variants :
122- build_examples (var )
102+ for board in build_boards :
103+ build_examples (board )
123104
124105print (build_separator )
125106build_time = time .monotonic () - build_time
126- print ("Build Summary: {} \033 [32msucceeded\033 [0m, {} \033 [31mfailed\033 [0m and took {:.2f}s" .format (success_count , fail_count , build_time ))
107+ print ("Build Summary: {} \033 [32msucceeded\033 [0m, {} \033 [31mfailed\033 [0m, {} \033 [33mskipped \033 [0m and took {:.2f}s" .format (success_count , fail_count , skip_count , build_time ))
127108print (build_separator )
128109
129110sys .exit (exit_status )
0 commit comments