mirror of
https://github.com/facebook/zstd.git
synced 2025-10-11 00:03:06 -04:00
cleaner versionsTest script and output
This commit is contained in:
parent
ddbb8e27bf
commit
ebc13bc180
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
# Based on LZ4 version test script, by Takayuki Matsuoka
|
# Based on LZ4 version test script, by Takayuki Matsuoka
|
||||||
|
|
||||||
import glob
|
|
||||||
import subprocess
|
|
||||||
import filecmp
|
import filecmp
|
||||||
|
import glob
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import hashlib
|
|
||||||
|
|
||||||
repo_url = 'https://github.com/Cyan4973/zstd.git'
|
repo_url = 'https://github.com/Cyan4973/zstd.git'
|
||||||
tmp_dir_name = 'versionsTest/zstdtest'
|
tmp_dir_name = 'versionsTest/zstdtest'
|
||||||
@ -18,6 +18,7 @@ test_dat_src = 'README.md'
|
|||||||
test_dat = 'test_dat'
|
test_dat = 'test_dat'
|
||||||
head = 'vdevel'
|
head = 'vdevel'
|
||||||
|
|
||||||
|
|
||||||
def proc(cmd_args, pipe=True, dummy=False):
|
def proc(cmd_args, pipe=True, dummy=False):
|
||||||
if dummy:
|
if dummy:
|
||||||
return
|
return
|
||||||
@ -29,17 +30,21 @@ def proc(cmd_args, pipe=True, dummy=False):
|
|||||||
subproc = subprocess.Popen(cmd_args)
|
subproc = subprocess.Popen(cmd_args)
|
||||||
return subproc.communicate()
|
return subproc.communicate()
|
||||||
|
|
||||||
|
|
||||||
def make(args, pipe=True):
|
def make(args, pipe=True):
|
||||||
return proc([make_cmd] + args, pipe)
|
return proc([make_cmd] + args, pipe)
|
||||||
|
|
||||||
|
|
||||||
def git(args, pipe=True):
|
def git(args, pipe=True):
|
||||||
return proc([git_cmd] + args, pipe)
|
return proc([git_cmd] + args, pipe)
|
||||||
|
|
||||||
|
|
||||||
def get_git_tags():
|
def get_git_tags():
|
||||||
stdout, stderr = git(['tag', '-l', 'v[0-9].[0-9].[0-9]'])
|
stdout, stderr = git(['tag', '-l', 'v[0-9].[0-9].[0-9]'])
|
||||||
tags = stdout.decode('utf-8').split()
|
tags = stdout.decode('utf-8').split()
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
|
||||||
def compress_sample(tag, sample):
|
def compress_sample(tag, sample):
|
||||||
try:
|
try:
|
||||||
from subprocess import DEVNULL # py3k
|
from subprocess import DEVNULL # py3k
|
||||||
@ -58,11 +63,13 @@ def compress_sample(tag, sample):
|
|||||||
# zstdFiles = glob.glob("*.zst*")
|
# zstdFiles = glob.glob("*.zst*")
|
||||||
# print(zstdFiles)
|
# print(zstdFiles)
|
||||||
|
|
||||||
|
|
||||||
# http://stackoverflow.com/a/19711609/2132223
|
# http://stackoverflow.com/a/19711609/2132223
|
||||||
def sha1_of_file(filepath):
|
def sha1_of_file(filepath):
|
||||||
with open(filepath, 'rb') as f:
|
with open(filepath, 'rb') as f:
|
||||||
return hashlib.sha1(f.read()).hexdigest()
|
return hashlib.sha1(f.read()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def remove_duplicates():
|
def remove_duplicates():
|
||||||
list_of_zst = sorted(glob.glob('*.zst'))
|
list_of_zst = sorted(glob.glob('*.zst'))
|
||||||
for i, ref_zst in enumerate(list_of_zst):
|
for i, ref_zst in enumerate(list_of_zst):
|
||||||
@ -76,6 +83,7 @@ def remove_duplicates():
|
|||||||
os.remove(compared_zst)
|
os.remove(compared_zst)
|
||||||
print('duplicated : {} == {}'.format(ref_zst, compared_zst))
|
print('duplicated : {} == {}'.format(ref_zst, compared_zst))
|
||||||
|
|
||||||
|
|
||||||
def decompress_zst(tag):
|
def decompress_zst(tag):
|
||||||
dec_error = 0
|
dec_error = 0
|
||||||
list_zst = sorted(glob.glob('*.zst'))
|
list_zst = sorted(glob.glob('*.zst'))
|
||||||
@ -116,7 +124,7 @@ if __name__ == '__main__':
|
|||||||
print('Retrieve all release tags :')
|
print('Retrieve all release tags :')
|
||||||
os.chdir(clone_dir)
|
os.chdir(clone_dir)
|
||||||
tags = get_git_tags() + [head]
|
tags = get_git_tags() + [head]
|
||||||
print(tags);
|
print(tags)
|
||||||
|
|
||||||
# Build all release zstd
|
# Build all release zstd
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
@ -144,11 +152,12 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
print('Compress test.dat by all released zstd')
|
print('Compress test.dat by all released zstd')
|
||||||
|
|
||||||
error_code = 0;
|
error_code = 0
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
print(tag)
|
print(tag)
|
||||||
compress_sample(tag, test_dat)
|
compress_sample(tag, test_dat)
|
||||||
remove_duplicates()
|
remove_duplicates()
|
||||||
|
if tag >= 'v0.5.1':
|
||||||
error_code += decompress_zst(tag)
|
error_code += decompress_zst(tag)
|
||||||
|
|
||||||
print('')
|
print('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user