From a1db6c4379c787124d7ee825adbcc76d2069a3c6 Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 19 Jul 2019 10:01:35 -0500 Subject: [Draft] Add check to travis to make sure new boards are built, fix #1886 --- tools/travis_new_boards_check.py | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tools/travis_new_boards_check.py (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py new file mode 100644 index 000000000..b12f6d127 --- /dev/null +++ b/tools/travis_new_boards_check.py @@ -0,0 +1,42 @@ +#! /usr/bin/env python3 + +import os +import re +import json + +import build_board_info + +# Get boards in json format +boards_info_json = build_board_info.get_board_mapping() +# print(boards_info_json) + +# TODO (Carlos) Find all the boards on the json format + +# We need to know the path of the .travis.yml file +base_path = os.path.dirname(__file__) +travis_path = os.path.abspath(os.path.join(base_path, '..', '.travis.yml')) + +# Loading board list based on TRAVIS_BOARDS env variable on .travis.yml +travis_boards = [] +with open(travis_path, 'r') as travis: + + # Get all lines that contain the substring 'TRAVIS_BOARDS' + for line in travis: + line = travis.readline() + + if 'TRAVIS_BOARDS' in line: + print('TRAVIS_BOARDS found') + print(line) + # TODO (Carlos) Store the line content + + # We've reached the end of the env: section + elif 'addons' in line: + break + else: + pass + + # TODO (Carlos) Getting all the boards on TRAVIS_BOARDS using regex matching + # Tranks sommersoft for the pattern + pattern = '(.+)' + +# TODO (Carlos) Comparing boards listed in TRAVIS_BOARDS and boards got from get_board_mapping -- cgit v1.2.3 From b279d6b335f6968c1cca281ef2ad250e68a688c2 Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 19 Jul 2019 12:11:16 -0500 Subject: [travis new boards check] We now have two lists that contain the boards based on board_info and TRAVIS_BOARDS --- tools/travis_new_boards_check.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index b12f6d127..0d6d4ebf9 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -8,9 +8,9 @@ import build_board_info # Get boards in json format boards_info_json = build_board_info.get_board_mapping() -# print(boards_info_json) -# TODO (Carlos) Find all the boards on the json format +# Get all the boards out of the json format +info_boards = boards_info_json.keys() # We need to know the path of the .travis.yml file base_path = os.path.dirname(__file__) @@ -22,12 +22,15 @@ with open(travis_path, 'r') as travis: # Get all lines that contain the substring 'TRAVIS_BOARDS' for line in travis: - line = travis.readline() - if 'TRAVIS_BOARDS' in line: - print('TRAVIS_BOARDS found') - print(line) - # TODO (Carlos) Store the line content + # Get the lines with TRAVIS_BOARDS= in it + if line.find('TRAVIS_BOARDS=') is not -1: + # Store all the boards names into travis_boards + begin_of_names = line.find('TRAVIS_BOARDS=') + len('TRAVIS_BOARDS=') + 1 + end_of_names = line.rfind('"') + boards = line[begin_of_names:end_of_names] + boards = boards.split(' ') + travis_boards.extend(boards) # We've reached the end of the env: section elif 'addons' in line: @@ -35,8 +38,4 @@ with open(travis_path, 'r') as travis: else: pass - # TODO (Carlos) Getting all the boards on TRAVIS_BOARDS using regex matching - # Tranks sommersoft for the pattern - pattern = '(.+)' - # TODO (Carlos) Comparing boards listed in TRAVIS_BOARDS and boards got from get_board_mapping -- cgit v1.2.3 From ae41bb369f23169a79c8b4164f2eebb46b1771fb Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 19 Jul 2019 12:36:13 -0500 Subject: [travis new boards check] sort both lists of boards --- tools/travis_new_boards_check.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index 0d6d4ebf9..389c2a237 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -11,6 +11,8 @@ boards_info_json = build_board_info.get_board_mapping() # Get all the boards out of the json format info_boards = boards_info_json.keys() +# Turn the dict_keys into a list +info_boards = list(info_boards) # We need to know the path of the .travis.yml file base_path = os.path.dirname(__file__) @@ -38,4 +40,6 @@ with open(travis_path, 'r') as travis: else: pass -# TODO (Carlos) Comparing boards listed in TRAVIS_BOARDS and boards got from get_board_mapping +# All the travis_boards elements must be on info_boards +info_boards.sort() +travis_boards.sort() -- cgit v1.2.3 From fc1594104b4c09ab7576da2f87a98bb76f0fe6d2 Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 19 Jul 2019 12:59:04 -0500 Subject: [travis new boards check] Exit with failure if a board in info isn't in travis --- tools/travis_new_boards_check.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index 389c2a237..568df50ae 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -1,5 +1,6 @@ #! /usr/bin/env python3 +import sys import os import re import json @@ -43,3 +44,17 @@ with open(travis_path, 'r') as travis: # All the travis_boards elements must be on info_boards info_boards.sort() travis_boards.sort() + +exit_status = 0 + +missing_boards = list(set(info_boards) - set(travis_boards)) + +if len(missing_boards) is not 0: + exit_status = 1 + +if exit_status is 1: + print('Boards missing in TRAVIS_BOARDS:') + for board in missing_boards: + print(board) + +sys.exit(exit_status) -- cgit v1.2.3 From 22c265b170ec57fc78e9b2eb01ed2120e0116e95 Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 19 Jul 2019 16:54:42 -0500 Subject: [travis check new boards] Reduce code logic to exit with failure --- tools/travis_new_boards_check.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index 568df50ae..f4492830d 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -45,16 +45,10 @@ with open(travis_path, 'r') as travis: info_boards.sort() travis_boards.sort() -exit_status = 0 - missing_boards = list(set(info_boards) - set(travis_boards)) if len(missing_boards) is not 0: - exit_status = 1 - -if exit_status is 1: print('Boards missing in TRAVIS_BOARDS:') for board in missing_boards: print(board) - -sys.exit(exit_status) + sys.exit(1) -- cgit v1.2.3 From d1fecf5025958ac4c2447a3757ab03a0bfdebdbf Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 20 Jul 2019 01:08:22 -0500 Subject: Fix missing module sh and remove unused module re --- .travis.yml | 8 ++++---- tools/travis_new_boards_check.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/.travis.yml b/.travis.yml index 528582eae..ce7cba944 100755 --- a/.travis.yml +++ b/.travis.yml @@ -71,10 +71,6 @@ before_script: - function var_search () { case "$1" in *$2*) true;; *) false;; esac; } - sudo dpkg --add-architecture i386 - # Check if there's any board missing in TRAVIS_BOARDS - - cd tools && python3 -u travis_new_boards_check.py - - cd .. - - (! var_search "${TRAVIS_SDK-}" arm || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) # For huzzah builds @@ -89,6 +85,10 @@ before_script: - (! var_search "${TRAVIS_TESTS-}" docs || pip install --user Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter) - (! var_search "${TRAVIS_TESTS-}" translations || pip3 install --user polib) + # Check if there's any board missing in TRAVIS_BOARDS + - cd tools && python3 -u travis_new_boards_check.py + - cd .. + # report some good version numbers to the build - gcc --version - (! var_search "${TRAVIS_SDK-}" arm || arm-none-eabi-gcc --version) diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index f4492830d..01751b4b9 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -2,7 +2,6 @@ import sys import os -import re import json import build_board_info -- cgit v1.2.3 From b630e561a7186637965560c4a902b1811c8b90c3 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 21 Jul 2019 12:13:13 -0500 Subject: exclude aliased boards from 'get_board_mapping()' --- tools/travis_new_boards_check.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index 01751b4b9..7e8116a1a 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -10,9 +10,7 @@ import build_board_info boards_info_json = build_board_info.get_board_mapping() # Get all the boards out of the json format -info_boards = boards_info_json.keys() -# Turn the dict_keys into a list -info_boards = list(info_boards) +info_boards = [board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)] # We need to know the path of the .travis.yml file base_path = os.path.dirname(__file__) -- cgit v1.2.3 From c316231dd23f333cd8d7be869f8018bd17082fda Mon Sep 17 00:00:00 2001 From: C47D Date: Tue, 23 Jul 2019 13:02:07 -0500 Subject: [travis check new boards] Do not end test if there are missing boards --- tools/travis_new_boards_check.py | 1 - 1 file changed, 1 deletion(-) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index 7e8116a1a..facfb601d 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -48,4 +48,3 @@ if len(missing_boards) is not 0: print('Boards missing in TRAVIS_BOARDS:') for board in missing_boards: print(board) - sys.exit(1) -- cgit v1.2.3 From 8864cefba6a6b307a2678d4de7540a9db15c03e1 Mon Sep 17 00:00:00 2001 From: C47D Date: Tue, 23 Jul 2019 13:03:29 -0500 Subject: [travis check new boards] missing_boards as set --- tools/travis_new_boards_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index facfb601d..81ccec675 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -42,9 +42,9 @@ with open(travis_path, 'r') as travis: info_boards.sort() travis_boards.sort() -missing_boards = list(set(info_boards) - set(travis_boards)) +missing_boards = set(info_boards) - set(travis_boards) -if len(missing_boards) is not 0: +if missing_boards: print('Boards missing in TRAVIS_BOARDS:') for board in missing_boards: print(board) -- cgit v1.2.3 From 7e4d7a5373f281c1448b650115ad1a6f79842e23 Mon Sep 17 00:00:00 2001 From: C47D Date: Thu, 25 Jul 2019 16:11:45 -0500 Subject: [travis check new boards] Fail in case of any missing boards --- tools/travis_new_boards_check.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py index 81ccec675..5ae05aec4 100644 --- a/tools/travis_new_boards_check.py +++ b/tools/travis_new_boards_check.py @@ -48,3 +48,4 @@ if missing_boards: print('Boards missing in TRAVIS_BOARDS:') for board in missing_boards: print(board) + sys.exit(1) -- cgit v1.2.3