summaryrefslogtreecommitdiff
path: root/test/sysv-generator-test.py
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-09 23:59:30 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-13 18:56:36 -0400
commit7f0cc63771aeb792bb5fff1e22c471132ffa054b (patch)
tree4d93ab89b9be781daaa75896bd7aa311f576e0c3 /test/sysv-generator-test.py
parent9cdcf3681c1a4139aff34541b5648234bf4aa1b1 (diff)
downloadsystemd-7f0cc63771aeb792bb5fff1e22c471132ffa054b.tar.gz
sysv-generator: use generator_add_symlink()
generator_add_symlink() is extended to ignore EEXIST. This should be fine for all existing callers. There's a small difference in behaviour when adding symlinks in sysv-generator: the message is more generic and does not include ", ignored". But creation of symlinks shouldn't ever fail except if things are very wrong, so in practice this shouldn't matter. Test needed updating: os.path.exists(os.readlink(link)) only works if the link is absolute (or if we are in the right directory). Let's just use os.path.exists(link), which properly tests that the symlink target exists.
Diffstat (limited to 'test/sysv-generator-test.py')
-rwxr-xr-xtest/sysv-generator-test.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index d116fffe38..99e323db3b 100755
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -153,7 +153,8 @@ class SysvGeneratorTest(unittest.TestCase):
link = os.path.join(self.out_dir, '%s.target.wants' % target, unit)
if target in targets:
unit_file = os.readlink(link)
- self.assertTrue(os.path.exists(unit_file))
+ # os.path.exists() will fail on a dangling symlink
+ self.assertTrue(os.path.exists(link))
self.assertEqual(os.path.basename(unit_file), unit)
else:
self.assertFalse(os.path.exists(link),