pytorch
7d9a6197 - [PyTorch] Fix bin hash comparison failure in clang format script (#55281)

Commit
4 years ago
[PyTorch] Fix bin hash comparison failure in clang format script (#55281) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55281 ## Summary ` python3 tools/clang_format_all.py` is complaining that binary is not what expected. Find out the reference hash include an extra new line comparing with the actual hash. In this pr, 1. Use `expr(hash)` to show the raw string, such that it's easier to compare two string. 2. Remove the extra new line. 3. Run `python3 tools/clang_format_all.py `, and it formats `torch/csrc/jit/runtime/static/passes.h`. Before the change, ``` (base) chenlai@chenlai-mp pytorch % python3 tools/clang_format_all.py -v Found pre-existing clang-format binary, skipping download Reference Hash: '5fde7bccf65032da297dfb1f18e4a95e96e278fa397e9dcaf364dfe23ec46353' Actual Hash: '5fde7bccf65032da297dfb1f18e4a95e96e278fa397e9dcaf364dfe23ec46353' The downloaded binary is not what was expected! (base) chenlai@chenlai-mp pytorch % ``` After the change, ``` (base) chenlai@chenlai-mp pytorch % python3 tools/clang_format_all.py -v Found pre-existing clang-format binary, skipping download Reference Hash: '5fde7bccf65032da297dfb1f18e4a95e96e278fa397e9dcaf364dfe23ec46353\n' Actual Hash: '5fde7bccf65032da297dfb1f18e4a95e96e278fa397e9dcaf364dfe23ec46353' The downloaded binary is not what was expected! (base) chenlai@chenlai-mp pytorch % ``` After strip the hash str: ``` (base) chenlai@chenlai-mp pytorch % python3 tools/clang_format_all.py -v Downloading clang-format to /Users/chenlai/pytorch/.clang-format-bin 0% |################################################################| 100% Reference Hash: '5fde7bccf65032da297dfb1f18e4a95e96e278fa397e9dcaf364dfe23ec46353' Actual Hash: '5fde7bccf65032da297dfb1f18e4a95e96e278fa397e9dcaf364dfe23ec46353' Using clang-format located at /Users/chenlai/pytorch/.clang-format-bin/clang-format ``` Test Plan: Imported from OSS Reviewed By: iseeyuan Differential Revision: D27556372 Pulled By: cccclai fbshipit-source-id: 2fd1ba220733e767ffab41ab31e162f0bf3f1d62
Author
Parents
Loading