summaryrefslogtreecommitdiffstats
path: root/test/sysv-generator-test.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* test: sort imports and use "new" string formattingBatuhan Osman Taşkaya2018-02-051-18/+17
| | | | | | Followed PEP8 and PEP3101 rules (#8079) Imports re-ordered by Alphabetical Standarts for following PEP8 Old type string formattings (" example %s " % exampleVar ) re-writed as new type string formattings ( " example {} ".format(exampleVar) ) for following PEP3101
* Add SPDX license headers to python scriptsZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
|
* sysv-generator-test: do not query $builddirZbigniew Jędrzejewski-Szmek2017-09-261-1/+1
| | | | | | | | | | This variable is not set by meson, so let's not try to use it. We could use some more elaborate scheme (e.g. based on $MESON_BUILD_ROOT and $MESON_SUBDIR) to find the path to systemd-sysv-generator, but it seems that plain ./systemd-sysv-generator works just as well and has the advantage that it's easy to invoke the test by hand (as long as one cd's to the meson build dir).
* sysv-generator-test: drop python2 work-aroundZbigniew Jędrzejewski-Szmek2017-09-261-6/+1
| | | | | We require python3 for meson anyway, so support python2 doesn't seem useful anymore.
* sysv-generator: use generator_add_symlink()Zbigniew Jędrzejewski-Szmek2017-07-141-1/+2
| | | | | | | | | | | | | | 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.
* more portable python shebangs (#5816)Jörg Thalheim2017-05-011-1/+1
| | | | | This is useful on systems like NixOS, where python3 is not in /usr/bin/python3 as well as for people using alternative ways to install python such as virtualenv/pyenv.
* python: adjust imports, indentation, unused variables following pylint adviceZbigniew Jędrzejewski-Szmek2016-12-021-1/+1
|
* Use python3 explicitly in all python scriptsFelipe Sateler2016-11-281-1/+1
|
* path-util: also support ".old" and ".new" suffixes and recommend themZbigniew Jędrzejewski-Szmek2016-04-291-2/+3
| | | | | | | | | ~ suffix works fine, but looks to much like it the file is supposed to be automatically cleaned up. For new versions of configuration files installers might want to using something that looks more permanent like foobar.new. So let's add treat ".old" and ".new" as special. Update test to match.
* test: chmod +x sysv-generator-testZbigniew Jędrzejewski-Szmek2016-04-281-0/+2
| | | | Just for convenience.
* sysv-generator: do not join dependencies on one line, split themLukas Nykryn2016-01-211-2/+16
| | | | | | | | If there is a lot of initscripts and dependencies between them we might end generating After= (and similar) lines which are longer then LINE_MAX and thus rejected by parser in systemd. Fixes #2099
* sysv-generator test: Fix random ordering failureMartin Pitt2015-07-011-1/+1
| | | | | | | | test_simple_escaped() sometimes fails with AssertionError: Lists differ: ['foo\\x2b.service', 'foo-admin.service'] != ['foo-admin.service', 'foo\\x2b.service'] We don't need to assume any order here, so compare them as a set, not a list.
* sysv-generator: escape names when translating from sysv nameFelipe Sateler2015-06-291-0/+19
| | | | | | While the LSB suggests only [A-Za-z0-9], that doesn't prevent admins from doing the wrong thing. Lets not generate invalid names in that case.
* sysv-generator test: always log to consoleMartin Pitt2015-06-151-0/+1
| | | | | | | Set $SYSTEMD_LOG_TARGET so that the output always goes to stdout/stderr. This fixes running the test as root, as that logged to the journal previously. https://github.com/systemd/systemd/issues/195
* sysv-generator test: Fix assertionAlberto Fanjul Alonso2015-04-281-2/+2
|
* sysv-generator: fix wrong "Overwriting existing symlink" warningsMartin Pitt2015-02-191-0/+7
| | | | | | | | Fix result testing of is_symlink() to ignore negative results, which happen if the file name does not exist at all. In this case we do not want a warning and unlink the non-existing link. https://bugs.debian.org/778700
* systemd-sysv-generator test: Adjust to dropped runlevelN.target mappingMartin Pitt2015-02-191-14/+14
| | | | | Commit d5d8429a dropped the explicit runlevelN.target mapping. Adjust the tests accordingly to explicitly state the expected targets instead of runlevels.
* sysv-generator: Skip init scripts for existing native servicesMartin Pitt2015-02-111-0/+12
| | | | | | | | | This avoids taking the SysV init script enablement state into account if we have native units. Otherwise systemctl disable on native unit would not be respected in the presence of an enabled SysV script. Also, there's no need to do all the parsing and creation of service files if we already have a native systemd unit for the processed SysV init script.
* sysv-generator: Replace Provides: symlinks with real unitsMartin Pitt2015-01-211-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit b7e7184 the SysV generator creates symlinks for all "Provides:" in the LSB header. However, this is too greedy; there are cases where the creation of a unit .service file fails because of an already existing symlink with the same name: - Backup files such as /etc/init.d/foo.bak still have "Provides: foo", and thus get a foo.service -> foo.bak.service link. foo.bak would not be enabled in rcN.d/, but we (deliberately) create units for all executables in init.d/ so that a manual "systemctl start" works. If foo.bak is processed before, the symlink already exists. - init.d/bar has "Provides: foo", while there also is a real init.d/foo. The former would create a link foo.service -> bar.service, while the latter would fail to create the real foo.service. If we encounter an existing symlink, just remove it before writing a real unit. Note that two init.d scripts "foo" and "bar" which both provide the same name "common" already work. The first processed init script wins and creates the "common.service" symlink, and the second just fails to create the symlink again. Thus create an additional test case for this to ensure that it keeps working sensibly. https://bugs.debian.org/775404
* systemd-sysv-generator test: test scripts with hidden suffixesMartin Pitt2015-01-211-0/+14
| | | | | We don't expect any unit generated from temporary package manager, swap, and similar files.
* sysv-generator: Handle .sh suffixes when translating Provides:Martin Pitt2015-01-211-0/+36
| | | | | | | | | | | | | | | When deciding whether the provided name equals the file name in sysv_translate_facility(), also consider them equal if the file name has a ".sh" suffix. This was uncovered by commit b7e7184 which then created a symlink "<name>.service" to itself for ".sh" suffixed init.d scripts. For additional robustness, refuse to create symlinks to itself in add_alias(). Add test case which reproduces the bug. https://bugs.debian.org/775889
* systemd-sysv-generator test: fix enabled checkMartin Pitt2015-01-211-2/+2
| | | | Fix hardcoded "foo.service", test for the actual unit parameter.
* systemd-sysv-generator test: don't parse symlinksMartin Pitt2015-01-211-2/+5
| | | | | Generated services which are symlinks should be tested/handled differently from files, so ignore them in run_generator()'s result parsing.
* test: add integration test for systemd-sysv-generatorMartin Pitt2015-01-211-0/+280
This covers the general functionality as well as regression tests for recent fixes like commits b7e718 and 1ed0c19.