Commit graph

121 commits

Author SHA1 Message Date
Lennart Poettering b95292a152 Merge pull request #1834 from filbranden/testexecute2
test-execute: Fix systemd escaping and shell issues (v2)
2015-11-10 19:49:51 +01:00
Evgeny Vereshchagin 5c404f1ab8 tests: various fixes
* remove journal flushing (systemd-journal-flush.service runs journalctl --flush on boot)
* use sh -c and PATH instead of @SYSTEMCTL@ expansion
* remove unnecessary semicolons etc
2015-11-10 18:01:15 +00:00
Filipe Brandenburger cdaf507048 test-execute: Fix systemd escaping and shell issues
In most cases, systemd requires escaping $ (for systemd variable
substitution) and % (for specifiers) by doubling them. This was somewhat
of an issue in tests like exec-environment*.service where systemd was
doing the substitutions and we were not really checking that those were
available in the actual environment of the command. Fix that.

Expressions such as `exit $(test ...)` are incorrect. They only work
because $(test ...) will produce no output, so the command will become a
bare "exit" which will exit with the status of the latest executed
command which turns out to be the test... The direct approach is simply
calling "test" as the last command, for which the shell will propagate
the exit status.

One situation where this was breaking tests was on `exit $(test ...) &&
$(test ...) && $(test ...)` where the second and third tests were not
really executing, since the first command is actually `exit` so && was
doing nothing there. Fixed it by just using `test ... && test ... &&
test ...` as it was initially intended.

Pass -x to all shell executions for them to produce useful debugging
output to stderr. Consequently, removed most of the explicit `echo`s
that are no longer needed.

Mark all units as Type=oneshot explicitly.

Also made sure all shell variables are properly quoted.

v2: Added an explicit LC_ALL=C to ionice invocations since some locales
(such as French) will add a space before the colon in the output.

Tested by running `sudo ./test-execute` and confirming all tests enabled
on my system (essentially all of them except for the s390 one) passed.
Tweaked the variables or options or expected values and confirmed the
tests do indeed fail when the values are not exactly the expected ones.

v2: Also tested with `LANG=fr_FR.UTF-8 sudo ./test-execute` to confirm
it still works in a different locale.
2015-11-10 07:58:29 -08:00
Jesus Ornelas Aguayo 59ef392e00 test: Fix typo in TEST-03-JOBS/test-jobs.sh
Fix typo s/enqueueing/enqueuing/

Signed-off-by: Jesus Ornelas Aguayo <jesus.ornelas.aguayo@intel.com>
2015-11-06 13:01:21 -06:00
Evgeny Vereshchagin 64810140a1 test-execute: don't use /usr/bin/uname. use sh and PATH 2015-11-06 15:45:32 +00:00
Evgeny Vereshchagin e63b61be53 test-functions: fix dbus-1 installation
The basic setup for the well-known system and session buses is
now done in read-only files in ${datadir} (normally /usr/share).
See the NEWS entry for 1.9.18 for details.

http://cgit.freedesktop.org/dbus/dbus/tree/NEWS
2015-11-04 18:33:37 +00:00
Ronny Chevalier aa8e00da54 test-path: move all related test files to a specific directory
To avoid polluting test/
2015-10-31 15:07:19 +01:00
Ronny Chevalier ac40081621 test-execute: move all files related to a specific directory
To avoid polluting test/
2015-10-31 15:07:19 +01:00
Ronny Chevalier a622675862 test-execute: add tests for IOSchedulingClass 2015-10-31 15:07:19 +01:00
Ronny Chevalier c388dfea5a test-execute: add tests for OOMScoreAdjust 2015-10-31 15:07:19 +01:00
Ronny Chevalier 03bd70dd01 test-execute: add test for EnvironmentFile 2015-10-31 15:07:19 +01:00
Ronny Chevalier 63447f1153 test-execute: add test for PrivateNetwork 2015-10-31 15:07:19 +01:00
Ronny Chevalier ff4ca461ed test: add tests to ensure that the capabilities are properly set 2015-10-29 17:14:18 +01:00
Hendrik Brueckner 7517f51ef9 s390: add personality support
Introduce personality support for Linux on z Systems to run
particular services with a 64-bit or 31-bit personality.
2015-09-24 13:03:18 +02:00
Ronny Chevalier 5bc7452b32 core: fix group ownership when Group is set
When Group is set in the unit, the runtime directories are owned by
this group and not the default group of the user (same for cgroup paths
and standard outputs)

Fix #1231
2015-09-21 18:14:44 +02:00
Ronny Chevalier cc3ddc851f test-execute: add tests for RuntimeDirectory 2015-09-21 18:14:44 +02:00
Filipe Brandenburger 4d55fc5b21 test: udev - Signal that test was skipped when running as non-root
It is more accurate to report that the test was skipped rather than
succeeded if we did not get to run it because it requires root.

Tested by running `make check` and inspecting the log file:

  $ cat test/udev-test.pl.log
  Must have root permissions to run properly.
  SKIP test/udev-test.pl (exit status: 77)

The `make check` output also reported:

  SKIP: test/udev-test.pl
2015-08-30 22:10:30 -07:00
Martin Pitt 52a321d839 sysv-generator test: Fix random ordering failure
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.
2015-07-01 07:34:23 +02:00
Kay Sievers f2b8052fb6 udev: remove WAIT_FOR key
This facility was never a proper solution, but only papered over
real bugs in the kernel. There are no known sysfs "timing bugs"
since a long time.
2015-06-30 19:57:40 +02:00
Felipe Sateler 264581a2f1 sysv-generator: escape names when translating from sysv name
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.
2015-06-29 16:07:49 -03:00
Martin Pitt 6b7d32add4 sysv-generator test: always log to console
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
2015-06-15 08:59:44 +02:00
Kay Sievers 2375607039 remove gudev and gtk-doc
The library moved to:
  https://git.gnome.org/browse/libgudev/
2015-06-03 00:22:53 +02:00
Zbigniew Jędrzejewski-Szmek 903e7c37ca Use "new" --job-mode= option in more places
--irreversible/--ignore-dependencies/--fail are deprececated since 4dc5b821ae.

Also add shell completions for --jobs-mode.
2015-05-18 01:08:09 -04:00
Alberto Fanjul Alonso 230f048566 sysv-generator test: Fix assertion 2015-04-28 15:44:23 +02:00
Tom Gundersen b3f2490072 test: udev, valgrind - track origins of uninitiaziled memory 2015-04-03 17:27:45 +02:00
Tom Gundersen 333e07b793 test: udev - add gdb support 2015-03-27 16:23:46 +01:00
Kay Sievers 7361099e42 boot: efi - remove custom splash support 2015-02-26 19:51:08 +01:00
Kay Sievers 37fa369066 boot: efi - support embedded splash image 2015-02-26 18:58:30 +01:00
Kay Sievers a19b0678be boot: efi - remove default boot splash handling 2015-02-26 01:03:29 +01:00
Martin Pitt 4e5589836c sysv-generator: fix wrong "Overwriting existing symlink" warnings
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
2015-02-19 11:06:24 +01:00
Martin Pitt 0377e373d1 systemd-sysv-generator test: Adjust to dropped runlevelN.target mapping
Commit d5d8429a dropped the explicit runlevelN.target mapping. Adjust the tests
accordingly to explicitly state the expected targets instead of runlevels.
2015-02-19 09:09:57 +01:00
Didier Roche 89ea179b60 Add mock fsck process 2015-02-18 16:33:46 +01:00
Tom Gundersen e7dd673d1e gummiboot/sd-boot/systemd-boot: rename galore
What used to be gummiboot, was renamed sd-boot when it was merged into
systemd. Let's try to be a bit more consistent with the rest of systemd
and rename it again as follows:

The EFI bootloader is now called 'systemd-bootx64.efi', and its sources are in
'src/boot/efi/'. The drop-in directory where bootctl will find EFI loaders
is now /usr/lib/systemd/boot/efi/.
2015-02-18 15:23:23 +01:00
Kay Sievers 0fa2cac4f0 sd-boot: add EFI boot manager and stub loader 2015-02-17 14:36:59 +01:00
Martin Pitt f4f01ec146 sysv-generator: Skip init scripts for existing native services
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.
2015-02-11 13:02:01 +01:00
Harald Hoyer b6f0c419e3 test-functions: search for the initrd and kernel according to the BLS
Also search for the initrd and kernel according to the boot loader
specification.
2015-02-03 10:51:29 +01:00
Harald Hoyer edbced8a15 test-functions: use sfdisk without cyl,head,sectors
newer sfdisk implementations do not work with these anymore
2015-02-03 10:47:06 +01:00
Harald Hoyer 99877b7e37 test-functions:install_libnss() call dracut_install with all $NSS_LIBS
dracut_install() can cope with more than one file
2015-02-03 10:46:57 +01:00
Martin Pitt 7d023341c7 tests: install ldconfig.real for Debian based distros
In Debian based distributions ldconfig is just a shell wrapper around
ldconfig.real, for deferring it during package installation.
2015-02-03 09:50:45 +01:00
Martin Pitt c50a4525aa tests: install hostname debug tool
This is mostly a vehicle to pull in libnsl.so which gets dlopen()ed by NSS
under certain NSS configurations.
2015-02-03 09:50:45 +01:00
Martin Pitt cffae62bcb tests: install all required libnss modules
Don't assume "files" for everything in nsswitch. Instead, ask "getent passwd"
about which libnss modules it dlopen()s, and install these.
2015-02-03 09:50:45 +01:00
Martin Pitt 53d90f9582 tests: don't hardcode systemctl path
Get it from type -P instead, to support --enable-split-usr.
2015-02-03 09:50:45 +01:00
Martin Pitt 3486cb6cfa tests: determine rootlibdir from pkg-config
Prefer asking pkg-config for the rootlibdir, to also support systems with
--enable-split-usr. Fall back to the hardcoded /usr/lib/systemd if that fails.
2015-02-03 09:50:45 +01:00
Martin Pitt 4be4833ece tests: Make sushell optional in image creation
sushell does not exist in all distributions, and it can be changed with
configure --with-debug-shell, so make installation of it optional.
2015-02-03 09:50:45 +01:00
Marko Myllynen 25b47f96d9 Use eurlatgr as the example console font
See https://fedoraproject.org/wiki/Changes/NewDefaultConsoleFont

https://bugzilla.redhat.com/show_bug.cgi?id=1182529
2015-01-22 01:14:53 -05:00
Martin Pitt 77354c7e6f sysv-generator: Replace Provides: symlinks with real units
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
2015-01-21 17:01:00 +01:00
Martin Pitt d816e2b790 systemd-sysv-generator test: test scripts with hidden suffixes
We don't expect any unit generated from temporary package manager, swap, and
similar files.
2015-01-21 15:30:01 +01:00
Martin Pitt 29e0e6d8c1 sysv-generator: Handle .sh suffixes when translating Provides:
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
2015-01-21 14:53:38 +01:00
Martin Pitt eb89bc1d25 systemd-sysv-generator test: fix enabled check
Fix hardcoded "foo.service", test for the actual unit parameter.
2015-01-21 10:22:10 +01:00
Martin Pitt 56401ac57a systemd-sysv-generator test: don't parse symlinks
Generated services which are symlinks should be tested/handled differently from
files, so ignore them in run_generator()'s result parsing.
2015-01-21 09:45:15 +01:00