Skip to content

Commit fc6fbd9

Browse files
authored
Merge pull request #13580 from jamesbeyond/cmake_exp
TEST: Update example scripts for cmake feature
2 parents f7d5dfb + d86a97b commit fc6fbd9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def parse_args():
9393
default=0,
9494
help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
9595

96+
compile_cmd.add_argument("--cmake", action="store_true", dest="cmake", default=False, help="Use Cmake to build example")
9697
compile_cmd.add_argument("-v", "--verbose",
9798
action="store_true",
9899
dest="verbose",
@@ -164,8 +165,8 @@ def do_compile(args, config, examples):
164165
return failures
165166

166167
def do_update(args, config, examples):
167-
""" Test update the mbed-os to the version specified by the tag """
168-
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)
169170

170171
def do_list(_, config, examples):
171172
"""List the examples in the config file"""

tools/test/examples/examples_lib.py

Lines changed: 7 additions & 8 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)
@@ -476,8 +475,8 @@ def symlink_mbedos(config, path, exp_filter):
476475
os.chdir(name)
477476
logging.info("In folder '%s'" % name)
478477
if os.path.exists("mbed-os.lib"):
479-
logging.info("Removing 'mbed-os.lib' in '%s'" % name)
480-
os.remove("mbed-os.lib")
478+
logging.info("Replacing 'mbed-os.lib' with empty file in '%s'" % name)
479+
open("mbed-os.lib", 'w').close()
481480
else:
482481
logging.warning("No 'mbed-os.lib' found in '%s'" % name)
483482
if os.path.exists("mbed-os"):

0 commit comments

Comments
 (0)