-
Notifications
You must be signed in to change notification settings - Fork 3k
CMake: add CI testing #13477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: add CI testing #13477
Changes from all commits
11bc375
593a08b
ea9b876
3f37bca
ca21805
8ce6c74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"examples": [ | ||
{ | ||
"name": "mbed-os-example-blinky", | ||
"github": "https://github.com/ARMmbed/mbed-os-example-blinky", | ||
"sub-repo-example": false, | ||
"subs": [], | ||
"features" : [], | ||
"targets" : [], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : false, | ||
"baud_rate": 9600, | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-sockets", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-sockets", | ||
"sub-repo-example": false, | ||
"subs": [], | ||
"features" : [], | ||
"targets" : ["K64F", "K66F"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : true, | ||
"baud_rate": 9600, | ||
"compare_log": ["mbed-os-example-sockets/tests/sockets.log"], | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-cellular", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-cellular", | ||
"sub-repo-example": false, | ||
"subs": [], | ||
"features" : [], | ||
"targets" : ["WIO_3G"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : false, | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-lorawan", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-lorawan", | ||
"sub-repo-example": false, | ||
"subs": [], | ||
"features" : [], | ||
"targets" : ["K64F"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": false, | ||
"test" : false, | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-devicekey", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-devicekey", | ||
"sub-repo-example": false, | ||
"subs": [], | ||
"features" : [], | ||
"targets" : ["K66F"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : true, | ||
"baud_rate": 9600, | ||
"compare_log": ["mbed-os-example-devicekey/tests/devicekey.log"], | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-mbed-crypto", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-mbed-crypto", | ||
"sub-repo-example": true, | ||
"subs": ["getting-started"], | ||
"features" : [], | ||
"targets" : ["K64F"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : true, | ||
"baud_rate": 9600, | ||
"compare_log": ["mbed-os-example-mbed-crypto/tests/getting-started.log"], | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-nfc", | ||
"github": "https://github.com/ARMmbed/mbed-os-example-nfc", | ||
"sub-repo-example": true, | ||
"subs": [ | ||
"NFC_EEPROM", | ||
"NFC_SmartPoster" | ||
], | ||
"features" : [], | ||
"targets" : ["NUCLEO_F401RE"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : true, | ||
"baud_rate": 9600, | ||
"compare_log": [ | ||
"mbed-os-example-nfc/tests/EEPROM.log", | ||
"mbed-os-example-nfc/tests/SmartPoster_noShield.log" | ||
], | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-ble", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-ble", | ||
"sub-repo-example": true, | ||
"subs": [ | ||
"BLE_LED" | ||
|
||
], | ||
"features" : [], | ||
"targets" : ["NRF52840_DK", "DISCO_L475VG_IOT01A"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : false, | ||
"auto-update" : true | ||
}, | ||
{ | ||
"name": "mbed-os-example-kvstore", | ||
"github":"https://github.com/ARMmbed/mbed-os-example-kvstore", | ||
"sub-repo-example": false, | ||
"subs": [], | ||
"features" : [], | ||
"targets" : ["K64F", "DISCO_L475VG_IOT01A"], | ||
"toolchains" : [], | ||
"exporters": [], | ||
"compile" : true, | ||
"export": true, | ||
"test" : true, | ||
"baud_rate": 9600, | ||
"compare_log": ["mbed-os-example-kvstore/tests/kvstore.log"], | ||
"auto-update" : true | ||
} | ||
hugueskamba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,7 +329,7 @@ def export_repos(config, ides, targets, exp_filter): | |
return results | ||
|
||
|
||
def compile_repos(config, toolchains, targets, profiles, verbose, exp_filter, jobs=0): | ||
def compile_repos(config, toolchains, targets, profiles, verbose, exp_filter, cmake=False ,jobs=0): | ||
"""Compiles combinations of example programs, targets and compile chains. | ||
|
||
The results are returned in a [key: value] dictionary format: | ||
|
@@ -382,27 +382,36 @@ def compile_repos(config, toolchains, targets, profiles, verbose, exp_filter, jo | |
summary_string = "%s %s %s" % (name, target, toolchain) | ||
logging.info("Compiling %s" % summary_string) | ||
|
||
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-j", str(jobs)] + (['-vv'] if verbose else []) | ||
if profiles: | ||
for profile in profiles: | ||
build_command.extend(["--profile", profile]) | ||
|
||
logging.info("Executing command '%s'..." % " ".join(build_command)) | ||
proc = subprocess.Popen(build_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
std_out, std_err = proc.communicate() | ||
std_out = std_out.decode() | ||
std_err = std_err.decode() | ||
print ("\n#### STDOUT ####\n%s\n#### STDERR ####\n%s\n#### End of STDOUT/STDERR ####\n" % (std_out,std_err)) | ||
|
||
if proc.returncode: | ||
failures.append(example_summary) | ||
if cmake: | ||
build_command_seq = ["mbed-tools build -t {} -m {} -c".format(toolchain, target)] | ||
else: | ||
build_command_seq = ["mbed-cli compile -t {} -m {} -j {} {}".format(toolchain, target, str(jobs), '-vv' if verbose else '') ] | ||
if profiles: | ||
for profile in profiles: | ||
build_command_seq[0] += " --profile {}".format(profile) | ||
Comment on lines
+389
to
+391
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also test all build profiles with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cheers, good to know that. |
||
|
||
failed_flag = False | ||
for build_command in build_command_seq: | ||
logging.info("Executing command '%s'..." % build_command) | ||
proc = subprocess.Popen(build_command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
std_out, std_err = proc.communicate() | ||
std_out = std_out.decode() | ||
std_err = std_err.decode() | ||
print ("\n#### STDOUT ####\n%s\n#### STDERR ####\n%s\n#### End of STDOUT/STDERR ####\n" % (std_out,std_err)) | ||
|
||
if proc.returncode: | ||
failures.append(example_summary) | ||
failed_flag = True | ||
break | ||
|
||
|
||
if not failed_flag: | ||
if example['test']: | ||
log = example['compare_log'].pop(0) | ||
# example['compare_log'] is a list of log file/files, which matches each examples/sub-examples from same repo. | ||
# pop the log file out of list regardless the compilation for each example pass of fail | ||
image = fetch_output_image(std_out) | ||
image = fetch_output_image(std_out,cmake) | ||
if image: | ||
image_info = [{"binary_type": "bootable","path": normpath(join(name,image)),"compare_log":log}] | ||
test_group = "{}-{}-{}".format(target, toolchain, example['baud_rate']) | ||
|
@@ -450,9 +459,8 @@ def update_example_version(config, tag, exp_filter): | |
""" | ||
print("\nUpdating example to version(branch) '%s'\n" % tag) | ||
for example in config['examples']: | ||
if example['name'] not in exp_filter: | ||
continue | ||
for name in get_sub_examples_list(example): | ||
name = example['name'] | ||
if name in exp_filter: | ||
os.chdir(name) | ||
logging.info("In folder '%s'" % name) | ||
cmd = "git checkout -B %s origin/%s" %(tag, tag) | ||
|
@@ -484,17 +492,27 @@ def symlink_mbedos(config, path, exp_filter): | |
else: | ||
logging.info("Creating Symbolic link '%s'->'mbed-os'" % path) | ||
os.symlink(path, "mbed-os") | ||
#Cmake tool currently require 'mbed-os.lib' to be present to perform build. | ||
#Add a empty 'mbed-os.lib' as a workaround | ||
open('mbed-os.lib', 'a').close() | ||
hugueskamba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
os.chdir(CWD) | ||
return 0 | ||
|
||
def fetch_output_image(output): | ||
def fetch_output_image(output,cmake): | ||
"""Find the build image from the last 30 lines of a given log""" | ||
lines = output.splitlines() | ||
last_index = -31 if len(lines)>29 else (-1 - len(lines)) | ||
for index in range(-1,last_index,-1): | ||
if lines[index].startswith("Image:"): | ||
image = lines[index][7:] | ||
if os.path.isfile(image): | ||
return image | ||
if cmake: | ||
if lines[index].startswith("-- built:") and lines[index].endswith(".bin"): | ||
image = lines[index][10:] | ||
print("IMAGE is " + image) | ||
if os.path.isfile(image): | ||
return os.path.relpath(image) | ||
else: | ||
if lines[index].startswith("Image:"): | ||
image = lines[index][7:] | ||
if os.path.isfile(image): | ||
return image | ||
return False | ||
|
Uh oh!
There was an error while loading. Please reload this page.