TEST: update example script update function

pull/13580/head
Qinghao Shi 2020-09-10 13:06:39 +01:00
parent e9e53e4ba3
commit d86a97b21c
3 changed files with 8 additions and 9 deletions

View File

@ -16,7 +16,7 @@ The scripts in this folder are used for testing `mbed-os` official examples. It
* **deploy** - if the example directory exists as provided by the .json configuration file, pulls in the examples dependencies by using `mbed-cli deploy`. * **deploy** - if the example directory exists as provided by the .json configuration file, pulls in the examples dependencies by using `mbed-cli deploy`.
* **update** - for each example repo identified in the config .json object, updates the version of `mbed-os` to that specified by the supplied GitHub tag. This function assumes that each example repo has already been cloned. * **update** - for each example repo identified in the config .json object, updates the version of example to that specified by the supplied GitHub tag. This function assumes that each example repo has already been cloned.
* **compile** - compiles combinations of example programs, targets and compile chains. * **compile** - compiles combinations of example programs, targets and compile chains.

View File

@ -165,8 +165,8 @@ def do_compile(args, config, examples):
return failures return failures
def do_update(args, config, examples): def do_update(args, config, examples):
""" Test update the mbed-os to the version specified by the tag """ """ Test update the example to the version specified by the tag """
return lib.update_mbedos_version(config, args.TAG, examples) return lib.update_example_version(config, args.TAG, examples)
def do_list(_, config, examples): def do_list(_, config, examples):
"""List the examples in the config file""" """List the examples in the config file"""

View File

@ -438,9 +438,9 @@ def compile_repos(config, toolchains, targets, profiles, verbose, exp_filter, jo
return results return results
def update_mbedos_version(config, tag, exp_filter): def update_example_version(config, tag, exp_filter):
""" 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 example 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:
@ -448,15 +448,14 @@ def update_mbedos_version(config, tag, exp_filter):
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("\nUpdating mbed-os in examples to version '%s'\n" % tag) print("\nUpdating example to version(branch) '%s'\n" % tag)
for example in config['examples']: for example in config['examples']:
if example['name'] not in exp_filter: if example['name'] not in exp_filter:
continue continue
for name in get_sub_examples_list(example): for name in get_sub_examples_list(example):
update_dir = name + "/mbed-os" os.chdir(name)
os.chdir(update_dir)
logging.info("In folder '%s'" % name) logging.info("In folder '%s'" % name)
cmd = "mbed-cli update %s --clean" %tag cmd = "git checkout -B %s origin/%s" %(tag, tag)
logging.info("Executing command '%s'..." % cmd) logging.info("Executing command '%s'..." % cmd)
result = subprocess.call(cmd, shell=True) result = subprocess.call(cmd, shell=True)
os.chdir(CWD) os.chdir(CWD)