Commit 3302350b authored by bescoto's avatar bescoto

Misc changes, passes all tests now


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@651 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent d0ae6345
......@@ -458,24 +458,15 @@ def list_to_acl(entry_list, map_names = 1):
"trigger further warnings" % (name,), 2)
dropped_acl_names[name] = name
def map_id_name(owner_pair, group = None):
"""Return id of mapped id and user given original owner_pair"""
id, name = owner_pair
Map = group and user_group.GroupMap or user_group.UserMap
if name: return Map.get_id_from_name(name)
else:
assert id is not None
return Map.get_id_from_id(id)
acl = posix1e.ACL()
for typechar, owner_pair, perms in entry_list:
id = None
if owner_pair:
if map_names:
if typechar == "u": id = map_id_name(owner_pair, 0)
if typechar == "u": id = user_group.acl_user_map(*owner_pair)
else:
assert typechar == "g", (typechar, owner_pair, perms)
id = map_id_name(owner_pair, 1)
id = user_group.acl_group_map(*owner_pair)
if id is None:
warn_drop(owner_pair[1])
continue
......
......@@ -155,7 +155,7 @@ class NumericalMap:
def map_acl(self, id, name = None): return id
############ Public section - don't use outside user_group ###########
############ Public section - can use these outside user_group ###########
def uid2uname(uid):
......@@ -213,3 +213,5 @@ def map_rpath(rp):
uname, gname = rp.getuname(), rp.getgname()
return (UserMap(uid, uname), GroupMap(gid, gname))
def acl_user_map(uid, uname): return UserMap.map_acl(uid, uname)
def acl_group_map(gid, gname): return GroupMap.map_acl(gid, gname)
......@@ -41,11 +41,11 @@ class testIterFile(unittest.TestCase):
def testFileException(self):
"""Test encoding a file which raises an exception"""
f = FileException(100*1024)
f = FileException(200*1024) # size depends on buffer size
new_iter = IterWrappingFile(FileWrappingIter(iter([f, "foo"])))
f_out = new_iter.next()
assert f_out.read(10000) == "a"*10000
try: buf = f_out.read(100*1024)
assert f_out.read(50000) == "a"*50000
try: buf = f_out.read(190*1024)
except IOError: pass
else: assert 0, len(buf)
......
......@@ -171,6 +171,11 @@ class IncStatTest(unittest.TestCase):
could change with different file systems...
"""
def sorti(inclist):
l = [(inc.getinctime(), inc) for inc in inclist]
l.sort()
return [inc for (t, inc) in l]
Globals.compression = 1
Myrm("testfiles/output")
InternalBackup(1, 1, "testfiles/stattest1", "testfiles/output")
......@@ -180,7 +185,7 @@ class IncStatTest(unittest.TestCase):
rbdir = rpath.RPath(Globals.local_connection,
"testfiles/output/rdiff-backup-data")
incs = restore.get_inclist(rbdir.append("session_statistics"))
incs = sorti(restore.get_inclist(rbdir.append("session_statistics")))
assert len(incs) == 2
s2 = statistics.StatsObj().read_stats_from_rp(incs[0])
assert s2.SourceFiles == 7
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment