From: Amir Ayupov Date: Tue, 10 Jan 2023 02:07:26 +0000 (-0800) Subject: [perf-training] Check extension in findFilesWithExtension X-Git-Tag: upstream/17.0.6~21504 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fbbf92e4fda3c7a3be1c02e1f7240135557846d;p=platform%2Fupstream%2Fllvm.git [perf-training] Check extension in findFilesWithExtension `findFilesWithExtension` helper checks for `endswith(extension)` instead of exactly matching the file extension. This causes it to match unrelated files, for example, `.profdata` files while matching `.fdata` files: http://157.230.108.44:8011/#/builders/56/builds/247 ``` Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/prof.fdata.1124569.fdata... Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/test/Frontend/Output/optimization-remark-with-hotness-new-pm.c.tmp.profdata... ``` Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D141342 --- diff --git a/clang/utils/perf-training/perf-helper.py b/clang/utils/perf-training/perf-helper.py index c6a815e..d68ab3c 100644 --- a/clang/utils/perf-training/perf-helper.py +++ b/clang/utils/perf-training/perf-helper.py @@ -23,7 +23,7 @@ def findFilesWithExtension(path, extension): filenames = [] for root, dirs, files in os.walk(path): for filename in files: - if filename.endswith(extension): + if os.path.splitext(filename)[1] == extension: filenames.append(os.path.join(root, filename)) return filenames