summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>2015-05-15 14:21:52 (GMT)
committerTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>2015-05-20 10:59:33 (GMT)
commit5151c30dce029e5efe9f6ac9ef137bb422ad30fd (patch)
treec02f58caba416850c746a1867a97fa051cd5bdf4
parent26065c3f47381c6ebe56ea114015b3c2b1c2a615 (diff)
downloadlz4-5151c30dce029e5efe9f6ac9ef137bb422ad30fd.zip
lz4-5151c30dce029e5efe9f6ac9ef137bb422ad30fd.tar.gz
lz4-5151c30dce029e5efe9f6ac9ef137bb422ad30fd.tar.bz2
Add log of same files and sha1 hash of unique files to versionstest
-rw-r--r--test/test-lz4-versions.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test-lz4-versions.py b/test/test-lz4-versions.py
index b6ed126..f92fa96 100644
--- a/test/test-lz4-versions.py
+++ b/test/test-lz4-versions.py
@@ -6,6 +6,7 @@ import filecmp
import os
import shutil
import sys
+import hashlib
repo_url = 'https://github.com/Cyan4973/lz4.git'
tmp_dir_name = 'test/lz4test'
@@ -37,6 +38,11 @@ def get_git_tags():
tags = stdout.decode('utf-8').split()
return tags
+# http://stackoverflow.com/a/19711609/2132223
+def sha1_of_file(filepath):
+ with open(filepath, 'rb') as f:
+ return hashlib.sha1(f.read()).hexdigest()
+
if __name__ == '__main__':
error_code = 0
base_dir = os.getcwd() + '/..' # /path/to/lz4
@@ -102,6 +108,7 @@ if __name__ == '__main__':
continue
if filecmp.cmp(lz4, lz4t):
os.remove(lz4t)
+ print('{} == {}'.format(lz4, lz4t))
print('Enumerate only different compressed files')
lz4s = sorted(glob.glob('*.lz4'))
@@ -128,6 +135,10 @@ if __name__ == '__main__':
else:
os.remove(dec)
+ lz4s = sorted(glob.glob('*.lz4'))
+ for lz4 in lz4s:
+ print('{} {}'.format(sha1_of_file(lz4), lz4))
+
if error_code != 0:
print('ERROR')