Skip to content

Commit

Permalink
The test suite framework now displays timing information.
Browse files Browse the repository at this point in the history
git-svn-id: svn://deltup.org/bdelta@10 0b3c7260-62b7-4bd3-8502-661595b7e89c
  • Loading branch information
jjwhitney committed Jun 2, 2010
1 parent bade4ec commit c475fc2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/suite.py
Expand Up @@ -6,8 +6,10 @@
import sys import sys
import os import os
import filecmp import filecmp
import time


basePath = sys.argv[1] basePath = sys.argv[1]
initialTime = time.time()


def isValidFile(x): def isValidFile(x):
return not x.startswith('.') and os.path.isdir(os.path.join(basePath, x)) return not x.startswith('.') and os.path.isdir(os.path.join(basePath, x))
Expand All @@ -18,14 +20,18 @@ def isValidFile(x):
for test in testFolders: for test in testFolders:
def path(fName): def path(fName):
return os.path.join(basePath, test, fName) return os.path.join(basePath, test, fName)
t1 = time.time()
os.system("../src/bdelta %s %s %s" % (path("1"), path("2"), path("patch.bdelta"))) os.system("../src/bdelta %s %s %s" % (path("1"), path("2"), path("patch.bdelta")))
t2 = time.time()
os.system("../src/bpatch %s %s %s" % (path("1"), path("2.new"), path("patch.bdelta"))) os.system("../src/bpatch %s %s %s" % (path("1"), path("2.new"), path("patch.bdelta")))
print ("%20s:" % test), print ("%20s:" % test),
if filecmp.cmp(path("2"), path("2.new"), shallow=False): if filecmp.cmp(path("2"), path("2.new"), shallow=False):
print "%10s" % os.stat(path("patch.bdelta")).st_size, print "uncompressed=%s\t" % os.stat(path("patch.bdelta")).st_size,
os.system("bzip2 %s" % path("patch.bdelta")) os.system("bzip2 %s" % path("patch.bdelta"))
print "%10s" % os.stat(path("patch.bdelta.bz2")).st_size print "bz2=%s\t" % os.stat(path("patch.bdelta.bz2")).st_size,
print "time=%f" % (t2-t1)
else: else:
print "ERROR" print "ERROR"
os.remove(path("patch.bdelta.bz2")) os.remove(path("patch.bdelta.bz2"))
os.remove(path("2.new")) os.remove(path("2.new"))
print "Total time:", (time.time()-initialTime)

0 comments on commit c475fc2

Please sign in to comment.