summaryrefslogtreecommitdiff
path: root/testit
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-04-25 06:09:23 +1200
committerLars Wirzenius <liw@liw.fi>2010-04-25 06:09:23 +1200
commitdc39bf76e7255d4a022216cc96c7bc0a9b1679fc (patch)
treebb8b2108b34b532358837140349bb119223268a2 /testit
parent12db03c7f917f6d53f2b8990af8ac55ffe21b4f0 (diff)
downloaddupfiles-dc39bf76e7255d4a022216cc96c7bc0a9b1679fc.tar.gz
Do not follow symlinks when statting.
Report all hardlinks to the same file as duplicates. This is probably stupid, but avoids a bug: if foo and bar are hardlinks to the same inode, and foobar is not, but has identical content, then previously it would be random whether foo or bar was reported as the hardlinks. Further, only one of foo and bar would be made into a hardlink with foobar. So the next run would report the other one as a duplicate.
Diffstat (limited to 'testit')
-rwxr-xr-xtestit28
1 files changed, 21 insertions, 7 deletions
diff --git a/testit b/testit
index e385366..28ec43d 100755
--- a/testit
+++ b/testit
@@ -92,7 +92,16 @@ class TwoHardlinksToSameContent(TestCase):
def setUp(self):
self.create('foo', 'foo')
self.hardlink('foo', 'bar')
- self.identical = []
+ self.identical = ['foo', 'bar']
+
+
+class TwoHardlinksToSameContentPlusSecondIdenticalCopy(TestCase):
+
+ def setUp(self):
+ self.create('foo', 'foo')
+ self.hardlink('foo', 'bar')
+ self.create('foobar', 'foo')
+ self.identical = ['foo', 'bar', 'foobar']
class Symlink(TestCase):
@@ -110,12 +119,17 @@ def main():
issubclass(o, TestCase) and
o != TestCase]
for klass in klasses:
- test = klass()
- test.setUp()
- test.test()
- test.tearDown()
- test.cleanup()
- print "Test PASS: %s" % (klass.__name__)
+ try:
+ test = klass()
+ test.setUp()
+ test.test()
+ test.tearDown()
+ test.cleanup()
+ except Exception, e:
+ print 'Test FAIL: %s' % klass.__name__
+ raise e
+ else:
+ print "Test PASS: %s" % klass.__name__
if __name__ == '__main__':