Open bansan85 opened 7 months ago
Hi, I've pushed some new changes, could you re-run it also with CTCACHE_DEBUG=1 and paste the output here?
I have :
Options: ClangTidyCacheOpts(clang_tidy_args:['-p', '/home/...', '', '-list-checks', '-'],compiler_args:[],original_args:['-p=/home/...', '', '-list-checks', '-'])
Traceback (most recent call last):
File "/usr/local/bin/clang-tidy-cache", line 1163, in <module>
sys.exit(main())
File "/usr/local/bin/clang-tidy-cache", line 1151, in main
return run_clang_tidy_cached(log, opts)
File "/usr/local/bin/clang-tidy-cache", line 1102, in run_clang_tidy_cached
proc = subprocess.Popen(
File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '-p=/home/...'
Unable to run clang-tidy.
Command exited with non-zero status 1
0.18user 0.02system 0:00.22elapsed 91%CPU (0avgtext+0avgdata 26648maxresident)k
720inputs+8outputs (1major+5864minor)pagefaults 0swaps
This will take some time. I need to have a look how run-clang-tidy actually invokes clang tidy, because the command-line passed to the cache misses the required first argument.
You'll probably need to pass a script like this to run-clang-tidy instead of giving it the cache client directly
Okay, thanks for your help.
CTCACHE_CLANG_TIDY=/usr/bin/clang-tidy-17 CTCACHE_DIR=/tmp/ctcache run-clang-tidy-17 -clang-tidy-binary /usr/local/bin/clang-tidy
works like a charm.
Now I have to chose between you and kokulshan/clang-tidy-cache because both of you works well. 🎲
Isn't the "compile_commands.json" path required? or I create a "compile_commands.json" during the cmake_configuration phase(-DCMAKE_EXPORT_COMPILE_COMMANDS=ON). How can I run this ctcache with this method?
Also, I thought it was necessary to set the following variables. export CTCACHE_LOCAL=1 export CTCACHE_SAVE_OUTPUT=1
My run command:
python3 tools/host/ctcache/clang_tidy_cache.py /usr/bin/run-clang-tidy-11 -clang-tidy-binary /usr/bin/clang-tidy-11 -p <compile_commands.json_path> -quiet
where am i making a mistake?
@matus-chochlik @bansan85 Thank you in advance.
Hi,
when clang-tidy-cache is parsing arguments they are split between arguments for the cache tool and arguments forwarded to clang-tidy and these two sets should be separated by an --
argument. So this should work:
python3 tools/host/ctcache/clang_tidy_cache.py /usr/bin/run-clang-tidy-11 -clang-tidy-binary /usr/bin/clang-tidy-11 -p <compile_commands.json_path> -- -quiet
IIRC neither CTACHE_LOCAL nor CTCACHE_SAVE_OUTPUT should be necessary for the compile_commands to be used.
Hello again,
I apologize for bothering you once more.
CMD:
python3 tools/host/ctcache/clang_tidy_cache.py /usr/bin/run-clang-tidy-11 -clang-tidy-binary /usr/bin/clang-tidy-11 -p <compile_commands.json_path>
When I run the script, the cache directory under /tmp is created as follows:
ls /tmp/ctcache-user
52/
stats
However, when I run the script again, clang-tidy still takes the same amount of time. In this case, it seems that the cache is not being utilized.
Before using the script, as I mentioned earlier, when I set the following variables:
export CTCACHE_LOCAL=1
export CTCACHE_SAVE_OUTPUT=1
the second clang-tidy run uses the cache and completes much faster and the cache dir under /tmp is created as follows:
ls /tmp/ctcache-user
52/
213284d23c794fce9b69d01d8c5ecb9c999dfc stats
Could the reason for this situation be that it cannot detect which file has changed? After all, run-clang-tidy only requires the compile_command.json_path parameter. Who can detect changes to that file? Should I manage this manually?
Thank you very much for your patience.
@matus-chochlik @bansan85 @jeremy-coulon
P.S: I got to know you from the discussion over there :) Issue: run-clang-tidy support #16." @jeremy-coulon
Hi, this looks like a bug, I'll have a look at it, this week.
Thanks a lot..
It's probably related to #16
I did exactly the same thing:
CTCACHE_CLANG_TIDY=/usr/bin/clang-tidy-17 CTCACHE_DIR=/tmp/ctcache run-clang-tidy-17 -clang-tidy-binary /usr/local/bin/clang-tidy-cache
I tried with clang-tidy-cache from main and from commit 03644275e794b0587849bfc2ec6123d5ae0bdb1c (Jan 20, 2023). Both have the same problem.
I have: