diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2019-06-08 13:25:49 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2019-06-08 21:17:48 +0200 |
commit | 10bce6078e74c19dfea9f19d15daff5ca7ab2a2c (patch) | |
tree | cda5b6ca9eca8f4a77fc2bfd4fe251e56f08ed02 /test/suites/base.bash | |
parent | 2b568ba6ba93cec78e478fb63f5353975055539b (diff) | |
download | ccache-10bce6078e74c19dfea9f19d15daff5ca7ab2a2c.tar.gz |
Improve how <MD4, number of hashed bytes> is represented
Internally, the tuple <MD4 hash, number of hashed bytes>,which is the
key used for cached results and manifests, was represented as 16 bytes +
1 uint32_t. Externally, i.e. in file names, it was represented as
<MD4>-<size>, with <MD4> being 32 hex digits and <size> being the number
of hashed bytes in human-readable form.
This commits changes the internal representation to 20 bytes, where the
last 4 bytes are the number of hashed bytes in big-endian order. The
external representation has been changed to match this, i.e. to be 40
hex digits. This makes the code slightly less complex and more
consistent. Also, the code that converts the key into string form has
been rewritten to not allocate on the heap but to just write the output
into a buffer owned by the caller.
struct file_hash (16 bytes + 1 uint32_t) has been renamed to struct
digest (20 bytes) in order to emphasize that it represents the output of
a hash algorithm that not necessarily gets file content as its input.
The documentation of the manifest format has been updated to reflect the
logical change of keys, even though the actual serialized content of
manifest files hasn’t changed. While at it, reading of the obsolete
“hash_size” and “reserved” fields has been removed. (Future changes in
the manifest format will be handled by just stepping the version.)
Diffstat (limited to 'test/suites/base.bash')
-rw-r--r-- | test/suites/base.bash | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/suites/base.bash b/test/suites/base.bash index dc02939a..bafb876a 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -1058,12 +1058,11 @@ EOF # ------------------------------------------------------------------------- TEST "--hash-file" - >empty - $CCACHE --hash-file empty > hash.out + $CCACHE --hash-file /dev/null > hash.out printf "a" | $CCACHE --hash-file - >> hash.out - if grep '31d6cfe0d16ae931b73c59d7e0c089c0-0' hash.out >/dev/null 2>&1 && \ - grep 'bde52cb31de33e46245e05fbdbd6fb24-1' hash.out >/dev/null 2>&1; then + if grep '31d6cfe0d16ae931b73c59d7e0c089c000000000' hash.out >/dev/null && \ + grep 'bde52cb31de33e46245e05fbdbd6fb2400000001' hash.out >/dev/null; then : OK else test_failed "Unexpected output of --hash-file" |