[PATCH] D155779: [BOLT][Utils] Make nfc-check-setup compatible with ninja
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 21:50:23 PDT 2023
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Preserve llvm-bolt timestamps to trick Ninja into not rebuilding the binary
after it has been replaced by a symlink.
This makes it possible to use the script and then run `ninja check-bolt` as
usual, instead of resorting to llvm-lit invocation.
Test Plan:
nfc-check-setup.py
ninja check-bolt
ls -l bin/llvm-bolt # still a symlink
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155779
Files:
bolt/utils/nfc-check-setup.py
Index: bolt/utils/nfc-check-setup.py
===================================================================
--- bolt/utils/nfc-check-setup.py
+++ bolt/utils/nfc-check-setup.py
@@ -61,6 +61,8 @@
subprocess.run(
shlex.split("cmake --build . --target llvm-bolt"), cwd=args.build_dir
)
+ # preserve llvm-bolt's timestamp to trick Ninja not to rebuild it
+ stat = os.stat(bolt_path)
# rename llvm-bolt
os.replace(bolt_path, f"{bolt_path}.new")
# memorize the old hash for logging
@@ -96,6 +98,8 @@
f.write(ini)
# symlink llvm-bolt-wrapper
os.symlink(wrapper_path, bolt_path)
+ # restore original [am]time on symlink
+ os.utime(bolt_path, (stat.st_atime, stat.st_mtime))
if args.switch_back:
if stash:
subprocess.run(shlex.split("git stash pop"), cwd=source_dir)
@@ -108,8 +112,7 @@
)
print(
f"Build directory {args.build_dir} is ready to run BOLT tests, e.g.\n"
- "\tbin/llvm-lit -sv tools/bolt/test\nor\n"
- "\tbin/llvm-lit -sv tools/bolttests"
+ "\tninja check-bolt"
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155779.542303.patch
Type: text/x-patch
Size: 1108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/6708ebb1/attachment.bin>
More information about the llvm-commits
mailing list