summaryrefslogtreecommitdiffstats
path: root/test/sysv-generator-test.py
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-10 05:59:30 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-14 00:56:36 +0200
commit7f0cc63771aeb792bb5fff1e22c471132ffa054b (patch)
tree4d93ab89b9be781daaa75896bd7aa311f576e0c3 /test/sysv-generator-test.py
parentgpt-auto-generator: use generator_add_symlink() (diff)
downloadsystemd-7f0cc63771aeb792bb5fff1e22c471132ffa054b.tar.xz
systemd-7f0cc63771aeb792bb5fff1e22c471132ffa054b.zip
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),