Skip to content

Commit

Permalink
tools/compile_test_board: allow use of wildcards for applications
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed Dec 19, 2019
1 parent 501e700 commit ac33697
Showing 1 changed file with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,33 @@ def __init__(self, message, application, errorfile):
self.errorfile = errorfile


def _expand_apps_directories(apps_dirs, riotdir, skip=False):
"""Expand the list of applications using wildcards."""
# Get the full list of RIOT applications in riotdir
_riot_applications = _riot_applications_dirs(riotdir)

if apps_dirs is None:
if skip is True:
return []
return _riot_applications

ret = []
for app_dir in apps_dirs:
if os.path.isdir(app_dir):
# Case where the application directory exists: don't use globbing.
# the application directory can also be outside of riotdir and
# relative to it.
ret += [app_dir]
else:
ret += [
os.path.relpath(el, riotdir)
for el in glob.glob(os.path.join(riotdir, app_dir))
if os.path.relpath(el, riotdir) in _riot_applications
]

return ret


def apps_directories(riotdir, apps_dirs=None, apps_dirs_skip=None):
"""Return sorted list of test directories relative to `riotdir`.
Expand Down Expand Up @@ -617,9 +644,14 @@ def main():
board = check_is_board(args.riot_directory, args.board)
logger.debug('board: %s', board)

app_dirs = apps_directories(args.riot_directory,
apps_dirs=args.applications,
apps_dirs_skip=args.applications_exclude)
# Expand application directories: allows use of glob in application names
apps_dirs = _expand_apps_directories(args.applications,
args.riot_directory)
apps_dirs_skip = _expand_apps_directories(args.applications_exclude,
args.riot_directory, skip=True)

app_dirs = apps_directories(args.riot_directory, apps_dirs=apps_dirs,
apps_dirs_skip=apps_dirs_skip)

logger.debug('app_dirs: %s', app_dirs)
logger.debug('resultdir: %s', args.result_directory)
Expand Down

0 comments on commit ac33697

Please sign in to comment.