Skip to content
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

TEST: Update example scripts for cmake feature #13580

Merged
merged 3 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/test/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

* **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.

Expand Down
5 changes: 3 additions & 2 deletions tools/test/examples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def parse_args():
default=0,
help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")

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

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

def do_list(_, config, examples):
"""List the examples in the config file"""
Expand Down
15 changes: 7 additions & 8 deletions tools/test/examples/examples_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,25 +438,24 @@ def compile_repos(config, toolchains, targets, profiles, verbose, exp_filter, jo
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
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.

Args:
config - the json object imported from the file.
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']:
if example['name'] not in exp_filter:
continue
for name in get_sub_examples_list(example):
update_dir = name + "/mbed-os"
os.chdir(update_dir)
os.chdir(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)
result = subprocess.call(cmd, shell=True)
os.chdir(CWD)
Expand All @@ -476,8 +475,8 @@ def symlink_mbedos(config, path, exp_filter):
os.chdir(name)
logging.info("In folder '%s'" % name)
if os.path.exists("mbed-os.lib"):
logging.info("Removing 'mbed-os.lib' in '%s'" % name)
os.remove("mbed-os.lib")
logging.info("Replacing 'mbed-os.lib' with empty file in '%s'" % name)
open("mbed-os.lib", 'w').close()
else:
logging.warning("No 'mbed-os.lib' found in '%s'" % name)
if os.path.exists("mbed-os"):
Expand Down