generate_build_files: enforce uniqueness of test names.
This changes the test names to use the last component, which is
generally the test data file, in place of the 2nd component, which is
less unique.
Change-Id: I182ad1ffb59595a6579a6a87e07af6cb11036e93
Reviewed-on: https://boringssl-review.googlesource.com/15584
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/util/generate_build_files.py b/util/generate_build_files.py
index 0554b14..1d56059 100644
--- a/util/generate_build_files.py
+++ b/util/generate_build_files.py
@@ -250,13 +250,22 @@
name_counts[name] = name_counts.get(name, 0) + 1
first = True
+ test_names = set()
for test in files['tests']:
name = os.path.basename(test[0])
if name_counts[name] > 1:
- if '/' in test[1]:
- name += '_' + os.path.splitext(os.path.basename(test[1]))[0]
+ if '/' in test[-1]:
+ arg = test[-1].replace('crypto/cipher/test/','') # boooring
+ arg = arg.replace('/', '_')
+ arg = os.path.splitext(arg)[0] # remove .txt
+ arg = arg.replace('_tests', '')
+ name += '_' + arg
else:
- name += '_' + test[1].replace('-', '_')
+ name += '_' + test[-1].replace('-', '_')
+
+ if name in test_names:
+ raise ValueError("test name %s is not unique" % name)
+ test_names.add(name)
if not first:
out.write('\n')