-
Notifications
You must be signed in to change notification settings - Fork 83
Deterministic create manifest entry #235
Conversation
Current coverage is 88.86% (diff: 100%)@@ master #235 diff @@
==========================================
Files 1 1
Lines 996 997 +1
Methods 0 0
Messages 0 0
Branches 158 158
==========================================
+ Hits 885 886 +1
Misses 83 83
Partials 28 28
|
b7d2513 to
087e1c6
Compare
|
It might be too early for me, but is the manifest creation really broken right now? My understanding is that the order of the include files certainly should influence the manifest hash, since the order of includes is relevant for what code the preprocessor generates. Consider e.g. the two header files // a.h
void f()
{
#ifdef SOMEDEFINE
std::cout << 'f(): 1\n';
#else
std::cout << 'f(): 2\n';
#endif
}// b.h
#define SOMEDEFINEIf Or am I missing something, and this isn't only about the order of the include files? |
|
The example scenario should still be handled after the modifications. @webmaster128 explained somewhere else that the order and duplicity of the includes is taken care of by the hashing of the includes and the cpp file. In the specific case of direct mode, the manifesthash contains the contents of the cpp file and the objectHash stored per ManifestEntry also uses the manifesthash. There are a few integration tests that show this behavior in integrationTests.py TestHits. I have another question: I had some problems with line endings
I wrote the md5sum of some files in the repository assuming crlf line endings which didn't match when run in Appveyor. For the moment I changed the appveyor configuration with autocrlf=true which fixed the problem but I would like to know your opinion. |
|
I am also planning to do some cleanup on this branch today. |
7e6ed04 to
f03606f
Compare
I think we cannot assume that any specific option is set in the user's environment. But if clcache really needs to rely on a specific line break value, we can use a per-repo setting like this: https://help.github.com/articles/dealing-with-line-endings/#per-repository-settings |
|
I think the include paths should be represented as a set whenever possible because this is the proper data structure: unsorted, no duplicates. There are two interfaces where the set needs to be converted:
This I would pass a set into |
|
One other thing: Could we avoid testing concrete hashes? Those values just change too often, e.g. when file format version changes or we add some salt to the hash. Instead I would test something like: If we put in the same thing in, do we get the same hash out? |
|
@webmaster128 I agree that testing concrete hashes is not a good idea, it is harder to maintain. I will change the tests, remove the include files and the problem with the line endings will disappear. I will look at your other suggestions too. |
3c81de3 to
2479ad6
Compare
2479ad6 to
fc41196
Compare
|
I get it now - I think this makes sense. Thanks for cleaning up the commits. Merged! |
|
@frerich thanks for merging, I was about to report the latest changes:
Sorry for all the rebases ;) |
|
@siu The rebases are greatly appreciated, it was only at the very end, with three commits, that I somehow managed to connect all the dots in my mind. :-) |
I was doing some preliminary work trying to understand #155 and I found that createManifestEntry does not give consistent results between runs. This is probably broken since #222. In this PR I added the unit tests to show the (old) bad behavior and fixed it. As the order of the includes changes in the manifest files the MANIFEST_FILE_FORMAT_VERSION is bumped too.