mirror of https://github.com/ARMmbed/mbed-os.git
Allowing examples to specify which repo source to use for testing.
They can pick from either the mbed developer site or the GitHub repository.pull/4385/head
parent
186f406c24
commit
3966139cd7
|
@ -6,6 +6,7 @@
|
||||||
"mbed": [
|
"mbed": [
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-blinky"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-blinky"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : [],
|
"targets" : [],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-tls-hashing",
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-tls-hashing",
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-tls-authcrypt"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-tls-authcrypt"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "mbed",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F", "NUCLEO_F429ZI"],
|
"targets" : ["K64F", "NUCLEO_F429ZI"],
|
||||||
"toolchains" : ["GCC_ARM", "ARM"],
|
"toolchains" : ["GCC_ARM", "ARM"],
|
||||||
|
@ -37,6 +39,7 @@
|
||||||
"mbed": [
|
"mbed": [
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["DISCO_F469NI", "DISCO_F746NG", "K64F", "K66F",
|
"targets" : ["DISCO_F469NI", "DISCO_F746NG", "K64F", "K66F",
|
||||||
"NUCLEO_F429ZI", "NUCLEO_F439ZI", "NUCLEO_F746ZG",
|
"NUCLEO_F429ZI", "NUCLEO_F439ZI", "NUCLEO_F746ZG",
|
||||||
|
@ -63,6 +66,7 @@
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Button",
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Button",
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-BatteryLevel"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-BatteryLevel"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "mbed",
|
||||||
"features" : ["BLE"],
|
"features" : ["BLE"],
|
||||||
"targets" : ["NRF51_DK", "NRF52_DK", "K64F", "NUCLEO_F401RE"],
|
"targets" : ["NRF51_DK", "NRF52_DK", "K64F", "NUCLEO_F401RE"],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -77,6 +81,7 @@
|
||||||
"mbed": [
|
"mbed": [
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-client"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-client"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : ["LWIP"],
|
"features" : ["LWIP"],
|
||||||
"targets" : [],
|
"targets" : [],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -90,6 +95,7 @@
|
||||||
"github":"https://github.com/ARMmbed/mbed-os-example-sockets",
|
"github":"https://github.com/ARMmbed/mbed-os-example-sockets",
|
||||||
"mbed": [
|
"mbed": [
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : ["LWIP"],
|
"features" : ["LWIP"],
|
||||||
"targets" : [],
|
"targets" : [],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -103,6 +109,7 @@
|
||||||
"github":"https://github.com/ARMmbed/mbed-os-example-wifi",
|
"github":"https://github.com/ARMmbed/mbed-os-example-wifi",
|
||||||
"mbed": [
|
"mbed": [
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : [],
|
"targets" : [],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -115,6 +122,7 @@
|
||||||
"name": "mbed-os-example-uvisor",
|
"name": "mbed-os-example-uvisor",
|
||||||
"github":"https://github.com/ARMmbed/mbed-os-example-uvisor",
|
"github":"https://github.com/ARMmbed/mbed-os-example-uvisor",
|
||||||
"mbed": [],
|
"mbed": [],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F"],
|
"targets" : ["K64F"],
|
||||||
"toolchains" : ["GCC_ARM"],
|
"toolchains" : ["GCC_ARM"],
|
||||||
|
@ -127,6 +135,7 @@
|
||||||
"name": "mbed-os-example-uvisor-thread",
|
"name": "mbed-os-example-uvisor-thread",
|
||||||
"github":"https://github.com/ARMmbed/mbed-os-example-uvisor-thread",
|
"github":"https://github.com/ARMmbed/mbed-os-example-uvisor-thread",
|
||||||
"mbed": [],
|
"mbed": [],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F"],
|
"targets" : ["K64F"],
|
||||||
"toolchains" : ["GCC_ARM"],
|
"toolchains" : ["GCC_ARM"],
|
||||||
|
@ -139,6 +148,7 @@
|
||||||
"name": "mbed-os-example-uvisor-number-store",
|
"name": "mbed-os-example-uvisor-number-store",
|
||||||
"github":"https://github.com/ARMmbed/mbed-os-example-uvisor-number-store",
|
"github":"https://github.com/ARMmbed/mbed-os-example-uvisor-number-store",
|
||||||
"mbed": [],
|
"mbed": [],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F"],
|
"targets" : ["K64F"],
|
||||||
"toolchains" : ["GCC_ARM"],
|
"toolchains" : ["GCC_ARM"],
|
||||||
|
@ -153,6 +163,7 @@
|
||||||
"mbed": [
|
"mbed": [
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-bootloader"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-bootloader"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F", "NUCLEO_F429ZI", "UBLOX_EVK_ODIN_W2"],
|
"targets" : ["K64F", "NUCLEO_F429ZI", "UBLOX_EVK_ODIN_W2"],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -167,6 +178,7 @@
|
||||||
"mbed": [
|
"mbed": [
|
||||||
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-fat-filesystem"
|
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-fat-filesystem"
|
||||||
],
|
],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F"],
|
"targets" : ["K64F"],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
@ -179,6 +191,7 @@
|
||||||
"name": "nanostack-border-router",
|
"name": "nanostack-border-router",
|
||||||
"github":"https://github.com/ARMmbed/nanostack-border-router",
|
"github":"https://github.com/ARMmbed/nanostack-border-router",
|
||||||
"mbed": [],
|
"mbed": [],
|
||||||
|
"test-repo-source": "github",
|
||||||
"features" : [],
|
"features" : [],
|
||||||
"targets" : ["K64F", "K66F", "NUCLEO_F429ZI"],
|
"targets" : ["K64F", "K66F", "NUCLEO_F429ZI"],
|
||||||
"toolchains" : [],
|
"toolchains" : [],
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
""" Import and bulid a bunch of example programs
|
""" Import and bulid a bunch of example programs
|
||||||
|
|
||||||
This library includes functions that are shared between the examples.py and
|
This library includes functions that are shared between the examples.py and
|
||||||
the update.py modules.
|
the update.py modules.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from os.path import dirname, abspath, basename
|
from os.path import dirname, abspath, basename
|
||||||
|
@ -123,20 +123,19 @@ def target_cross_ide(allowed_targets, allowed_ides, features=[], toolchains=[]):
|
||||||
|
|
||||||
|
|
||||||
def get_repo_list(example):
|
def get_repo_list(example):
|
||||||
""" Returns a list of all the repos associated with the specific example in the json
|
""" Returns a list of all the repos and their types associated with the
|
||||||
config file.
|
specific example in the json config file.
|
||||||
If there are repos listed under the mbed section then these will be returned as a
|
If the key 'test-repo-source' is set to 'mbed', then it will return the
|
||||||
list. If not then the github single repo with be returned.
|
mbed section as a list. Otherwise, it will return the single github repo.
|
||||||
NOTE: This does not currently deal with multiple examples underneath a github
|
NOTE: This does not currently deal with multiple examples underneath a github
|
||||||
sourced exampe repo.
|
sourced exampe repo.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
example - Example for which the repo list is requested
|
example - Example for which the repo list is requested
|
||||||
repos - The list of repos and types contained within that example in the json file
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
repos = []
|
repos = []
|
||||||
if len(example['mbed']) > 0:
|
if example['test-repo-source'] == 'mbed':
|
||||||
for repo in example['mbed']:
|
for repo in example['mbed']:
|
||||||
repos.append({
|
repos.append({
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
|
@ -156,7 +155,7 @@ def source_repos(config, examples):
|
||||||
there is already a clone of the repo then it will first be removed to
|
there is already a clone of the repo then it will first be removed to
|
||||||
ensure a clean, up to date cloning.
|
ensure a clean, up to date cloning.
|
||||||
Args:
|
Args:
|
||||||
config - the json object imported from the file.
|
config - the json object imported from the file.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
print("\nImporting example repos....\n")
|
print("\nImporting example repos....\n")
|
||||||
|
@ -214,7 +213,7 @@ def get_num_failures(results, export=False):
|
||||||
Args:
|
Args:
|
||||||
results - results summary of the compilation stage. See compile_repos() for
|
results - results summary of the compilation stage. See compile_repos() for
|
||||||
details of the format.
|
details of the format.
|
||||||
num_failures
|
num_failures
|
||||||
|
|
||||||
"""
|
"""
|
||||||
num_failures = 0
|
num_failures = 0
|
||||||
|
@ -314,23 +313,23 @@ def export_repos(config, ides, targets, examples):
|
||||||
|
|
||||||
def compile_repos(config, toolchains, targets, examples):
|
def compile_repos(config, toolchains, targets, examples):
|
||||||
"""Compiles combinations of example programs, targets and compile chains.
|
"""Compiles combinations of example programs, targets and compile chains.
|
||||||
|
|
||||||
The results are returned in a [key: value] dictionary format:
|
The results are returned in a [key: value] dictionary format:
|
||||||
Where key = The example name from the json config file
|
Where key = The example name from the json config file
|
||||||
value = a list containing: pass_status, successes, and failures
|
value = a list containing: pass_status, successes, and failures
|
||||||
|
|
||||||
where pass_status = The overall pass status for the compilation of the full
|
where pass_status = The overall pass status for the compilation of the full
|
||||||
set of example programs comprising the example suite.
|
set of example programs comprising the example suite.
|
||||||
True if all examples pass, false otherwise
|
True if all examples pass, false otherwise
|
||||||
successes = list of passing examples.
|
successes = list of passing examples.
|
||||||
failures = list of failing examples.
|
failures = list of failing examples.
|
||||||
|
|
||||||
Both successes and failures contain the example name, target and compile chain
|
Both successes and failures contain the example name, target and compile chain
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
config - the json object imported from the file.
|
config - the json object imported from the file.
|
||||||
toolchains - List of toolchains to compile for.
|
toolchains - List of toolchains to compile for.
|
||||||
results - results of the compilation stage.
|
results - results of the compilation stage.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
results = {}
|
results = {}
|
||||||
|
@ -349,8 +348,8 @@ def compile_repos(config, toolchains, targets, examples):
|
||||||
for repo_info in get_repo_list(example):
|
for repo_info in get_repo_list(example):
|
||||||
name = basename(repo_info['repo'])
|
name = basename(repo_info['repo'])
|
||||||
os.chdir(name)
|
os.chdir(name)
|
||||||
|
|
||||||
# Check that the target, toolchain and features combinations are valid and return a
|
# Check that the target, toolchain and features combinations are valid and return a
|
||||||
# list of valid combinations to work through
|
# list of valid combinations to work through
|
||||||
for target, toolchain in target_cross_toolchain(valid_choices(example['targets'], targets),
|
for target, toolchain in target_cross_toolchain(valid_choices(example['targets'], targets),
|
||||||
valid_choices(example['toolchains'], toolchains),
|
valid_choices(example['toolchains'], toolchains),
|
||||||
|
@ -365,7 +364,7 @@ def compile_repos(config, toolchains, targets, examples):
|
||||||
else:
|
else:
|
||||||
successes.append(example_summary)
|
successes.append(example_summary)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
# If there are any compilation failures for the example 'set' then the overall status is fail.
|
# If there are any compilation failures for the example 'set' then the overall status is fail.
|
||||||
if len(failures) > 0:
|
if len(failures) > 0:
|
||||||
pass_status = False
|
pass_status = False
|
||||||
|
@ -378,14 +377,14 @@ def compile_repos(config, toolchains, targets, examples):
|
||||||
|
|
||||||
|
|
||||||
def update_mbedos_version(config, tag, examples):
|
def update_mbedos_version(config, tag, examples):
|
||||||
""" For each example repo identified in the config json object, update the version of
|
""" For each example repo identified in the config json object, update the version of
|
||||||
mbed-os to that specified by the supplied GitHub tag. This function assumes that each
|
mbed-os to that specified by the supplied GitHub tag. This function assumes that each
|
||||||
example repo has already been cloned.
|
example repo has already been cloned.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
config - the json object imported from the file.
|
config - the json object imported from the file.
|
||||||
tag - GitHub tag corresponding to a version of mbed-os to upgrade to.
|
tag - GitHub tag corresponding to a version of mbed-os to upgrade to.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
print("Updating mbed-os in examples to version %s\n" % tag)
|
print("Updating mbed-os in examples to version %s\n" % tag)
|
||||||
for example in config['examples']:
|
for example in config['examples']:
|
||||||
|
@ -397,4 +396,3 @@ def update_mbedos_version(config, tag, examples):
|
||||||
os.chdir(update_dir)
|
os.chdir(update_dir)
|
||||||
subprocess.call(["mbed-cli", "update", tag, "--clean"])
|
subprocess.call(["mbed-cli", "update", tag, "--clean"])
|
||||||
os.chdir("../..")
|
os.chdir("../..")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue