test-zstd-speed.py: added support for directories

This commit is contained in:
inikep 2016-09-15 19:56:04 +02:00
parent 6173931868
commit d28afac4f8

View File

@ -17,7 +17,7 @@ import time
import traceback import traceback
import hashlib import hashlib
script_version = 'v1.0.0 (2016-09-12)' script_version = 'v1.0.1 (2016-09-15)'
default_repo_url = 'https://github.com/facebook/zstd.git' default_repo_url = 'https://github.com/facebook/zstd.git'
working_dir_name = 'speedTest' working_dir_name = 'speedTest'
working_path = os.getcwd() + '/' + working_dir_name # /path/to/zstd/tests/speedTest working_path = os.getcwd() + '/' + working_dir_name # /path/to/zstd/tests/speedTest
@ -130,7 +130,7 @@ def get_last_results(resultsFileName):
csize = [] csize = []
cspeed = [] cspeed = []
dspeed = [] dspeed = []
if (len(words) == 8): # results if (len(words) == 8) or (len(words) == 9): # results: "filename" or "XX files"
csize.append(int(words[1])) csize.append(int(words[1]))
cspeed.append(float(words[3])) cspeed.append(float(words[3]))
dspeed.append(float(words[5])) dspeed.append(float(words[5]))
@ -145,7 +145,7 @@ def benchmark_and_compare(branch, commit, last_commit, args, executableName, md5
% (os.getloadavg()[0], args.maxLoadAvg, sleepTime)) % (os.getloadavg()[0], args.maxLoadAvg, sleepTime))
time.sleep(sleepTime) time.sleep(sleepTime)
start_load = str(os.getloadavg()) start_load = str(os.getloadavg())
result = execute('programs/%s -qi5b1e%s %s' % (executableName, args.lastCLevel, testFilePath), result = execute('programs/%s -rqi5b1e%s %s' % (executableName, args.lastCLevel, testFilePath),
print_output=True) print_output=True)
end_load = str(os.getloadavg()) end_load = str(os.getloadavg())
linesExpected = args.lastCLevel + 1 linesExpected = args.lastCLevel + 1
@ -198,8 +198,7 @@ def test_commit(branch, commit, last_commit, args, testFilePaths, have_mutt, hav
if not args.dry_run: if not args.dry_run:
execute('make -C programs clean zstd CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -DZSTD_GIT_COMMIT=%s" && ' % version + execute('make -C programs clean zstd CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -DZSTD_GIT_COMMIT=%s" && ' % version +
'mv programs/zstd programs/zstd_clang && ' + 'mv programs/zstd programs/zstd_clang && ' +
'make -C programs clean zstd MOREFLAGS="-DZSTD_GIT_COMMIT=%s" && ' % version + 'make -C programs clean zstd zstd32 MOREFLAGS="-DZSTD_GIT_COMMIT=%s"' % version)
'make -B -C programs zstd32 MOREFLAGS="-DZSTD_GIT_COMMIT=%s"' % version)
md5_zstd = hashfile(hashlib.md5(), clone_path + '/programs/zstd') md5_zstd = hashfile(hashlib.md5(), clone_path + '/programs/zstd')
md5_zstd32 = hashfile(hashlib.md5(), clone_path + '/programs/zstd32') md5_zstd32 = hashfile(hashlib.md5(), clone_path + '/programs/zstd32')
md5_zstd_clang = hashfile(hashlib.md5(), clone_path + '/programs/zstd_clang') md5_zstd_clang = hashfile(hashlib.md5(), clone_path + '/programs/zstd_clang')
@ -251,10 +250,10 @@ if __name__ == '__main__':
testFilePaths = [] testFilePaths = []
for fileName in testFileNames: for fileName in testFileNames:
fileName = os.path.expanduser(fileName) fileName = os.path.expanduser(fileName)
if os.path.isfile(fileName): if os.path.isfile(fileName) or os.path.isdir(fileName):
testFilePaths.append(os.path.abspath(fileName)) testFilePaths.append(os.path.abspath(fileName))
else: else:
log("ERROR: File not found: " + fileName) log("ERROR: File/directory not found: " + fileName)
exit(1) exit(1)
# check availability of e-mail senders # check availability of e-mail senders