Fix generate_build_files.py to account for crypto/test.
crypto/test contains not tests, but a test support library that should be
linked into each test.
Change-Id: If1c85eda2a3df1717edd38575e1ec792323c400b
Reviewed-on: https://boringssl-review.googlesource.com/4720
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/util/generate_build_files.py b/util/generate_build_files.py
index 94de546..e534a56 100644
--- a/util/generate_build_files.py
+++ b/util/generate_build_files.py
@@ -90,6 +90,7 @@
],
'sources': [
'%s',
+ '<@(boringssl_test_support_sources)',
],
# TODO(davidben): Fix size_t truncations in BoringSSL.
# https://crbug.com/429039
@@ -99,9 +100,12 @@
test_names.sort()
- test_gypi.write(""" ],
- 'variables': {
- 'boringssl_test_targets': [\n""")
+ test_gypi.write(' ],\n \'variables\': {\n')
+
+ self.PrintVariableSection(
+ test_gypi, 'boringssl_test_support_sources', files['test_support'])
+
+ test_gypi.write(' \'boringssl_test_targets\': [\n')
for test in test_names:
test_gypi.write(""" '%s',\n""" % test)
@@ -174,10 +178,16 @@
"""Filter function that can be passed to FindCFiles in order to remove
non-test sources."""
if is_dir:
- return True
+ return dent != 'test'
return '_test.' in dent or dent.startswith('example_')
+def AllFiles(dent, is_dir):
+ """Filter function that can be passed to FindCFiles in order to include all
+ sources."""
+ return True
+
+
def FindCFiles(directory, filter_func):
"""Recurses through directory and returns a list of paths to all the C source
files that pass filter_func."""
@@ -304,6 +314,9 @@
stdout=err_data)
crypto_c_files.append('err_data.c')
+ test_support_cc_files = FindCFiles(os.path.join('src', 'crypto', 'test'),
+ AllFiles)
+
test_c_files = FindCFiles(os.path.join('src', 'crypto'), OnlyTests)
test_c_files += FindCFiles(os.path.join('src', 'ssl'), OnlyTests)
@@ -312,6 +325,7 @@
'ssl': ssl_c_files,
'tool': tool_cc_files,
'test': test_c_files,
+ 'test_support': test_support_cc_files,
}
asm_outputs = sorted(WriteAsmFiles(ReadPerlAsmOperations()).iteritems())