Enable clang-format in the tests
Extend the clang_format.py script to format everything by trace files in
the `test/` directory. Also, we have to add "on/off" marker in
`test-simualtor-inputs-aarch64.h` as clang-format is getting confused
there.
Change-Id: I1159498072bda1bfd049082aeccb347ec55e7825
diff --git a/tools/clang_format.py b/tools/clang_format.py
index 3121ade..aebb458 100755
--- a/tools/clang_format.py
+++ b/tools/clang_format.py
@@ -159,7 +159,7 @@
return rc
-def Find(path, filters = ['*']):
+def Find(path, filters = ['*'], excluded_dir = ""):
files_found = []
def NameMatchesAnyFilter(name, ff):
@@ -169,8 +169,14 @@
return False
for root, dirs, files in os.walk(path):
- files_found += [os.path.relpath(os.path.join(root, fn))
- for fn in files if NameMatchesAnyFilter(fn, filters)]
+ files_found += [
+ os.path.join(root, fn)
+ for fn in files
+ # Include files which names match "filters".
+ # Exclude files for which the base directory is "excluded_dir".
+ if NameMatchesAnyFilter(os.path.relpath(fn), filters) and \
+ not os.path.dirname(os.path.join(root, fn)).endswith(excluded_dir)
+ ]
return files_found
@@ -180,9 +186,10 @@
config.dir_aarch32_examples,
config.dir_aarch64_benchmarks,
config.dir_aarch64_examples,
+ config.dir_tests,
config.dir_src_vixl ]
for directory in source_dirs:
- sources += Find(directory, ['*.h', '*.cc'])
+ sources += Find(directory, ['*.h', '*.cc'], 'traces')
return sources