Skip to content

Commit d86a97b

Browse files
Qinghao ShiQinghao Shi
Qinghao Shi
authored and
Qinghao Shi
committed
TEST: update example script update function
1 parent e9e53e4 commit d86a97b

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

tools/test/examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The scripts in this folder are used for testing `mbed-os` official examples. It
1616

1717
* **deploy** - if the example directory exists as provided by the .json configuration file, pulls in the examples dependencies by using `mbed-cli deploy`.
1818

19-
* **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.
19+
* **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.
2020

2121
* **compile** - compiles combinations of example programs, targets and compile chains.
2222

tools/test/examples/examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ def do_compile(args, config, examples):
165165
return failures
166166

167167
def do_update(args, config, examples):
168-
""" Test update the mbed-os to the version specified by the tag """
169-
return lib.update_mbedos_version(config, args.TAG, examples)
168+
""" Test update the example to the version specified by the tag """
169+
return lib.update_example_version(config, args.TAG, examples)
170170

171171
def do_list(_, config, examples):
172172
"""List the examples in the config file"""

tools/test/examples/examples_lib.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,25 +438,24 @@ def compile_repos(config, toolchains, targets, profiles, verbose, exp_filter, jo
438438
return results
439439

440440

441-
def update_mbedos_version(config, tag, exp_filter):
441+
def update_example_version(config, tag, exp_filter):
442442
""" For each example repo identified in the config json object, update the version of
443-
mbed-os to that specified by the supplied GitHub tag. This function assumes that each
443+
example to that specified by the supplied GitHub tag. This function assumes that each
444444
example repo has already been cloned.
445445
446446
Args:
447447
config - the json object imported from the file.
448448
tag - GitHub tag corresponding to a version of mbed-os to upgrade to.
449449
450450
"""
451-
print("\nUpdating mbed-os in examples to version '%s'\n" % tag)
451+
print("\nUpdating example to version(branch) '%s'\n" % tag)
452452
for example in config['examples']:
453453
if example['name'] not in exp_filter:
454454
continue
455455
for name in get_sub_examples_list(example):
456-
update_dir = name + "/mbed-os"
457-
os.chdir(update_dir)
456+
os.chdir(name)
458457
logging.info("In folder '%s'" % name)
459-
cmd = "mbed-cli update %s --clean" %tag
458+
cmd = "git checkout -B %s origin/%s" %(tag, tag)
460459
logging.info("Executing command '%s'..." % cmd)
461460
result = subprocess.call(cmd, shell=True)
462461
os.chdir(CWD)

0 commit comments

Comments
 (0)