diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-07-19 18:28:25 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-07-19 18:28:25 +0000 |
commit | 318878a9b7bc3bd03f18f33aa42257c3d457c7f7 (patch) | |
tree | 046f28d3bd470350eccfce5fe0175623630f9359 /rdiff-backup | |
parent | bd8c21e288b4268ae59ef2ac2eb5824d4f3e2b8c (diff) | |
download | rdiff-backup-318878a9b7bc3bd03f18f33aa42257c3d457c7f7.tar.gz |
May have fixed recursion bug in resource forks; added another test
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@348 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup')
-rw-r--r-- | rdiff-backup/rdiff_backup/rpath.py | 7 | ||||
-rw-r--r-- | rdiff-backup/testing/resourceforktest.py | 53 |
2 files changed, 56 insertions, 4 deletions
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py index 8308b87..2ad52bd 100644 --- a/rdiff-backup/rdiff_backup/rpath.py +++ b/rdiff-backup/rdiff_backup/rpath.py @@ -1021,13 +1021,16 @@ class RPath(RORPath): assert self.isreg() try: rfork = self.data['resourcefork'] except KeyError: - rfork = self.append('rsrc').get_data() + rfork_fp = self.conn.open(os.path.join(self.path, 'rsrc'), 'rb') + rfork = rfork_fp.read() + assert not rfork_fp.close() self.data['resourcefork'] = rfork return rfork def write_resource_fork(self, rfork_data): """Write new resource fork to self""" - fp = self.append('rsrc').open('wb') + log.Log("Writing resource fork to %s" % (self.index,), 7) + fp = self.conn.open(os.path.join(self.path, 'rsrc'), 'wb') fp.write(rfork_data) assert not fp.close() diff --git a/rdiff-backup/testing/resourceforktest.py b/rdiff-backup/testing/resourceforktest.py index 09cc1d0..453f2b6 100644 --- a/rdiff-backup/testing/resourceforktest.py +++ b/rdiff-backup/testing/resourceforktest.py @@ -14,8 +14,11 @@ Globals.read_resource_forks = Globals.write_resource_forks = 1 class ResourceForkTest(unittest.TestCase): """Test dealing with Mac OS X style resource forks""" - tempdir = rpath.RPath(Globals.local_connection, - 'testfiles/resource_fork_test') + tempdir = rpath.RPath(Globals.local_connection, 'testfiles/output') + rf_testdir1 = rpath.RPath(Globals.local_connection, + 'testfiles/resource_fork_test1') + rf_testdir2 = rpath.RPath(Globals.local_connection, + 'testfiles/resource_fork_test2') def make_temp(self): """Make temp directory testfiles/resource_fork_test""" if self.tempdir.lstat(): self.tempdir.delete() @@ -49,5 +52,51 @@ class ResourceForkTest(unittest.TestCase): assert rorp_out == rp, (rorp_out, rp) assert rorp_out.get_resource_fork() == 'hello' + def make_backup_dirs(self): + """Create testfiles/resource_fork_test[12] dirs for testing""" + if self.rf_testdir1.lstat(): self.rf_testdir1.delete() + if self.rf_testdir2.lstat(): self.rf_testdir2.delete() + self.rf_testdir1.mkdir() + rp1_1 = self.rf_testdir1.append('1') + rp1_2 = self.rf_testdir1.append('2') + rp1_3 = self.rf_testdir1.append('3') + rp1_1.touch() + rp1_2.touch() + rp1_3.symlink('foo') + rp1_1.write_resource_fork('This should appear in resource fork') + rp1_2.write_resource_fork('Data for the resource fork 2') + + + self.rf_testdir2.mkdir() + rp2_1 = self.rf_testdir2.append('1') + rp2_2 = self.rf_testdir2.append('2') + rp2_3 = self.rf_testdir2.append('3') + rp2_1.touch() + rp2_2.touch() + rp2_3.touch() + rp2_1.write_resource_fork('New data for resource fork 1') + rp2_3.write_resource_fork('New fork') + + def testSeriesLocal(self): + """Test backing up and restoring directories with ACLs locally""" + Globals.read_resource_forks = Globals.write_resource_forks = 1 + self.make_backup_dirs() + dirlist = ['testfiles/resource_fork_test1', 'testfiles/empty', + 'testfiles/resource_fork_test2', + 'testfiles/resource_fork_test1'] + # BackupRestoreSeries(1, 1, dirlist, compare_resource_forks = 1) + BackupRestoreSeries(1, 1, dirlist) + + def testSeriesRemote(self): + """Test backing up and restoring directories with ACLs locally""" + Globals.read_resource_forks = Globals.write_resource_forks = 1 + self.make_backup_dirs() + dirlist = ['testfiles/resource_fork_test1', + 'testfiles/resource_fork_test2', 'testfiles/empty', + 'testfiles/resource_fork_test1'] + # BackupRestoreSeries(1, 1, dirlist, compare_resource_forks = 1) + BackupRestoreSeries(1, 1, dirlist) + if __name__ == "__main__": unittest.main() + |