Skip to content

Commit d1521d2

Browse files
Support test drivers in tests/src/drivers
Signed-off-by: Gilles Peskine <[email protected]>
1 parent 8e48184 commit d1521d2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tools/bin/mbedtls-prepare-build

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,8 @@ class MakefileMaker:
717717
[sjoin(script_path, '-o $@', *sources)])
718718
self.object_target('LIBRARY', GeneratedFile(generated), [])
719719

720-
def list_source_files(self, root, pattern):
721-
"""List the source files matching the specified pattern.
720+
def list_source_files(self, root, *patterns):
721+
"""List the source files matching any of the specified patterns.
722722
723723
Look for the specified wildcard pattern under all submodules, including
724724
the root tree. If a given file name is present in multiple submodules,
@@ -734,8 +734,10 @@ class MakefileMaker:
734734
start = len(submodule_root)
735735
if submodule:
736736
start += 1
737-
abs_pattern = os.path.join(submodule_root, pattern)
738-
sources = [src[start:] for src in glob.glob(abs_pattern)]
737+
sources = []
738+
for pattern in patterns:
739+
abs_pattern = os.path.join(submodule_root, pattern)
740+
sources += [src[start:] for src in glob.glob(abs_pattern)]
739741
for source_name in sources:
740742
src = SourceFile(root, submodule, source_name)
741743
base = src.base()
@@ -994,7 +996,8 @@ class MakefileMaker:
994996
definition must come before both targets for programs and tests.
995997
"""
996998
tests_common_sources = self.list_source_files(self.options.source,
997-
'tests/src/*.c')
999+
'tests/src/*.c',
1000+
'tests/src/drivers/*.c')
9981001
tests_common_objects = []
9991002
for src in tests_common_sources:
10001003
self.object_target('TESTS', src, [])
@@ -1420,7 +1423,7 @@ class BuildTreeMaker:
14201423
"""Go ahead and prepate the build tree."""
14211424
for subdir in ([['include', 'mbedtls'],
14221425
['library'],
1423-
['tests', 'src']] +
1426+
['tests', 'src', 'drivers']] +
14241427
[['programs', d] for d in self.programs_subdirs()]):
14251428
self.make_subdir(subdir)
14261429
source_link = os.path.join(self.options.dir, 'source')

0 commit comments

Comments
 (0)