Commit graph

206 commits

Author SHA1 Message Date
Alexander Kurtz 00f69504a2 bootctl: Always use upper case for "/EFI/BOOT" and "/EFI/BOOT/BOOT*.EFI".
If the ESP is not mounted with "iocharset=ascii", but with "iocharset=utf8"
(which is for example the default in Debian), the file system becomes case
sensitive. This means that a file created as "FooBarBaz" cannot be accessed as
"foobarbaz" since those are then considered different files.

Moreover, a file created as "FooBar" can then also not be accessed as "foobar",
and it also prevents such a file from being created, as both would use the same
8.3 short name "FOOBAR".

Even though the UEFI specification [0] does give the canonical spelling for
the files mentioned above, not all implementations completely conform to that,
so it's possible that those files would already exist, but with a different
spelling, causing subtle bugs when scanning or modifying the ESP.

While the proper fix would of course be that everybody conformed to the
standard, we can work around this problem by just referencing the files by
their 8.3 short names, i.e. using upper case.

Fixes: #3740

[0] <http://www.uefi.org/specifications>, version 2.6, section 3.5.1.1
2016-07-21 03:02:15 +02:00
Felipe Sateler 11ea343126 tests: Install missing libraries for things installed in /usr too 2016-07-03 18:56:54 -04:00
Felipe Sateler d7a4278d29 tests: follow RUNPATH when installing missing libraries
Fixes #3630
2016-07-03 18:33:02 -04:00
Martin Pitt 30b42a9a36 test: check resolved generated resolv.conf in networkd-test (#3628)
* test: check resolved generated resolv.conf in networkd-test

Directly verify the contents of /run/systemd/resolve/resolv.conf instead of
/etc/resolv.conf. The latter might be a plain file or a symlink to something
else (like Debian's resolvconf output), and in these cases we cannot make
strong assumptions about the contents.

Drop the "/etc/resolv.conf is a symlink" conditions and the "resolv.conf can
have at most three nameservers" alternatives, as we know that resolved always
adds all nameservers.

Explicitly start resolved at the start of a test to ensure that it is running.

* test: get along with existing system search domains in resolv.conf

The previous change has uncovered a bug in the tests: Existing search domains
can exist in resolv.conf which test_search_domains{,_too_long} didn't take into account.

As existing domains take some of the "max 6 domains" and "max 255 chars" limit,
don't expect that the last items from our test data actually appears in the
output, just the first few.
2016-06-30 16:44:22 +03:00
Martin Pitt 94363cbbf3 resolved: add test for route-only domain filtering (#3609)
With commit 6f7da49d00 route-only domains do not get put into resolv.conf's
"search" list any more. Add a comment about the tri-state, to clarify its
semantics and why we are passing a bool parameter into an int type. Also add a
test case for it.
2016-06-28 18:18:27 +02:00
Martin Pitt 7cad32bbde test: merge check_nspawn() into run_nspawn()
This makes nspawn tests symmetric with run_qemu() which also exits with 1 if
QEMU is not available.
2016-06-24 16:23:39 +02:00
Martin Pitt b2ecd099dc tests: track and check for timeouts
If run_qemu() exits with non-zero, this either meant that QEMU was not
available (which should be a SKIP) or that QEMU timed out if $QEMU_TIMEOUT was
set (which then should be a FAIL).

Limit the exit code of run_qemu() to QEMU availability only, and track timeouts
separately through the new $TIMED_OUT variable, which is then checked in
check_result_qemu().

Do the same for $NSPAWN_TIMEOUT and run_nspawn() so that nspawn and QEMU work
similarly.
2016-06-24 16:07:16 +02:00
Martin Pitt 633736bbf4 tests: make TEST-12-ISSUE-3171 nspawn invocation consistent with other tests
The result of check_nspawn does not mean much, and this forgot to ask
check_nspawn() whether nspawn can be used at all. This brings
TEST-12-ISSUE-3171 in line with other nspawn tests.
2016-06-24 12:07:18 +02:00
Martin Pitt eaa03c05f7 tests: don't fail if QEMU is not available
Fix TEST-{08,09,10,11} to properly skip the test if QEMU is not available
instead of failing, like in the other tests.
2016-06-24 11:28:35 +02:00
Martin Pitt a415d43655 tests: force booting the kernel with SELinux
selinux=1 is not sufficient when running on a kernel which also has another LSM
(such as AppArmor) enabled and defaults to that.
2016-06-24 11:28:35 +02:00
Lennart Poettering f921f5739e networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA
The long name is just too hard to type. We generally should avoid using
acronyms too liberally, if they aren't established enough, but it appears that
"RA" is known well enough. Internally we call the option "ipv6_accept_ra"
anyway, and the kernel also exposes it under this name. Hence, let's rename the
IPv6AcceptRouterAdvertisements= setting and the
[IPv6AcceptRouterAdvertisements] section to IPv6AcceptRA= and [IPv6AcceptRA].

The old setting IPv6AcceptRouterAdvertisements= is kept for compatibility with
older configuration. (However the section [IPv6AcceptRouterAdvertisements] is
not, as it was never available in a published version of systemd.
2016-06-07 11:24:30 +02:00
Evgeny Vereshchagin 856ca72b29 tests: introduce UNIFIED_CGROUP_HIERARCHY (#3419)
There are many cgroups-related changes (thanks, @htejun!)
This commit will simplify testing a bit.

Use:
make run UNIFIED_CGROUP_HIERARCHY=yes to enable cgroup-v2
make run UNIFIED_CGROUP_HIERARCHY=no to enable cgroup-v1
2016-06-03 11:17:00 +02:00
Martin Pitt d2bc125132 resolved: fix comments in resolve.conf for search domain overflows (#3422)
Write comments about "too many search domains" and "Total length of all search
domains is too long" just once. Also put it on a separate line, as
resolv.conf(5) only specifies comments in a line by themselves.

This is ugly to do if write_resolv_conf_search() gets called once for every
search domain. So change it to receive the complete OrderedSet instead and do
the iteration by itself.

Add test cases to networkd-test.py.

https://launchpad.net/bugs/1588229
2016-06-03 11:15:44 +02:00
Tejun Heo 538b48524c core: translate between IO and BlockIO settings to ease transition
Due to the substantial interface changes in cgroup unified hierarchy, new IO
settings are introduced.  Currently, IO settings apply only to unified
hierarchy and BlockIO to legacy.  While the transition is necessary, it's
painful for users to have to provide configs for both.  This patch implements
translation from one config set to another for configs which make sense.

* The translation takes place during application of the configs.  Users won't
  see IO or BlockIO settings appearing without being explicitly created.

* The translation takes place only if there is no config for the matching
  cgroup hierarchy type at all.

While this doesn't provide comprehensive compatibility, it should considerably
ease transition to the new IO settings which are a superset of BlockIO
settings.

v2:

- Update test-cgroup-mask.c so that it accounts for the fact that
  CGROUP_MASK_IO and CGROUP_MASK_BLKIO move together.  Also, test/parent.slice
  now sets IOWeight instead of BlockIOWeight.
2016-05-18 17:35:12 -07:00
Zbigniew Jędrzejewski-Szmek 62a992bed9 TEST-08: make sure / is remounted rw
In this test /etc/fstab is replaced by -.mount unit. This causes
systemd-remount-fs.service to not remount / rw, which in turn causes various
failures becuase /var is not writable. In particular
systemd-tmpfiles-setup.service reports many failures. This is something
to possibly fix on its own (see https://github.com/systemd/systemd/issues/791);
in the meanwhile let's fix this test so that it doesn't fail, since the
point of the test is to check aliases on mount units, and not a ro root.
2016-05-08 22:00:23 -04:00
Zbigniew Jędrzejewski-Szmek 61b480b68b tests: enable logging for pid1, disable for other systemd services
systemd-udev generated an insane amount of log output at debug level.
It would break TEST-02-CRYPTSETUP by filling the overflowing the disk
(which seems to be a bug in itself!).
2016-05-08 20:27:34 -04:00
Zbigniew Jędrzejewski-Szmek e14b866bc1 tests: allow root to login with empty password to test images 2016-05-08 20:27:33 -04:00
Zbigniew Jędrzejewski-Szmek ed1190498f tree-wide: remove uses of --failed
It has been replaced by --state=failed.
2016-05-08 20:27:33 -04:00
Zbigniew Jędrzejewski-Szmek 5b23cef0bb tests: specify format=raw for qemu to avoid warning
WARNING: Image format was not specified for
         '/var/tmp/systemd-test.tGi3od/rootdisk.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write
         operations on block 0 will be restricted.  Specify the 'raw' format
         explicitly to remove the restrictions.

Also use unsafe caching mode, we don't care about data integrity here.
2016-05-08 20:27:33 -04:00
Evgeny Vereshchagin 03ae6f7dee tests: add test for #3171 (#3206) 2016-05-06 23:05:59 +02:00
Evgeny Vereshchagin 0b2abe0f03 tests: add test for #3166 (#3180) 2016-05-03 11:43:22 +02:00
Evgeny Vereshchagin 33e40442c6 tests: add test for https://github.com/systemd/systemd/issues/2467 (#3168) 2016-05-02 10:57:19 +02:00
Evgeny Vereshchagin cd4c260323 tests: use symlink to Makefile 2016-05-01 16:40:21 +00:00
Zbigniew Jędrzejewski-Szmek 94a0ef6e57 path-util: also support ".old" and ".new" suffixes and recommend them
~ 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.
2016-04-29 10:21:07 -04:00
Zbigniew Jędrzejewski-Szmek 1f7be300e9 test: chmod +x sysv-generator-test
Just for convenience.
2016-04-28 08:25:17 -04:00
Martin Pitt daad34dfa3 tests: document requirements of networkd integration tests (#3125)
Document the necessary dependencies and nspawn/lxd options to run
test/networkd-test.py.
2016-04-26 12:16:43 +02:00
Evgeny Vereshchagin 4f4d6ee4be tests: add test for coredump handler hanging at shutdown (#3101)
Test for #2691.
2016-04-24 20:24:41 -04:00
Evgeny Vereshchagin 43bbb8f005 tests: don't rely on the host's systemd-nspawn, don't register test machine (#3023)
Fixes:
$ cd test/TEST-07-ISSUE-1981/
$ sudo make clean setup run
...
timeout: failed to run command ‘systemd-nspawn’: No such file or directory
...
TEST RUN: https://github.com/systemd/systemd/issues/1981 [FAILED]
Makefile:10: recipe for target 'run' failed
make: *** [run] Error 1
2016-04-13 09:57:06 -04:00
Martin Pitt bf8f7583ee test: udev: Check tags
Add two more tests:

 - Add a single tag, match on it, don't match on another.
 - Add 10.000 tags to a device, ensure that udev survives this.
   (Reproduces crash fixed by commit 1d88a271a)
2016-04-06 23:30:10 +02:00
Martin Pitt efc9f70325 test: udev: check exit code of test-udev
We expect test-udev to succeed. Verify that its exit code is zero, particularly
to spot crashes (e. g. a segfault would be error code 139).
2016-04-06 23:30:10 +02:00
Evgeny Vereshchagin 21d9e3f339 tests: don't rely on the underlying fs in test-udev (v2)
* This reverts commit 646048b40a.
Let's test really big numbers again

* Don't be so brutal: use rmdir instead of rm -rf
As suggested https://github.com/systemd/systemd/pull/2966#issuecomment-205751680
2016-04-06 04:08:39 +00:00
Evgeny Vereshchagin 2ce8d27b1f tests: don't rely on underlying fs in udev-test, use tmpfs instead
Fixes: #457
2016-04-05 10:38:09 +00:00
Evgeny Vereshchagin 331fb4ca51 basic: fallback to fstatat if entry->d_type is DT_UNKNOWN
* tests-functions: improve FSTYPE-support

make clean setup FSTYPE=reiserfs is working fine now :)

* basic: fallback to fstatat if entry->d_type is DT_UNKNOWN

Fixes localectl on reiserfs:

-bash-4.3# mkdir -p /usr/lib/locale
-bash-4.3# stat -f /usr/lib/locale/
  File: "/usr/lib/locale/"
    ID: bdb0322715b5366e Namelen: 255     Type: reiserfs
Block size: 4096
Blocks: Total: 99835      Free: 60262      Available: 60262
Inodes: Total: 0          Free: 0
-bash-4.3# mkdir /usr/lib/locale/HeyHo
-bash-4.3# localectl list-locales --no-pager

-bash-4.3# mount -t tmpfs tmpfs /usr/lib/locale
-bash-4.3# mkdir /usr/lib/locale/HeyHo
-bash-4.3# localectl list-locales --no-pager
HeyHo
2016-04-04 13:07:56 +02:00
Daniel Mack 68de79d6a4 Merge pull request #2760 from ronnychevalier/rc/core_no_new_privileges_seccompv3
core: set NoNewPrivileges for seccomp if we don't have CAP_SYS_ADMIN
2016-03-21 12:57:43 +01:00
Zbigniew Jędrzejewski-Szmek fdbf7b554e Merge pull request #2797 from evverx/selinux-use-raw
selinux: use *_raw API from libselinux
2016-03-16 01:13:29 -04:00
Evgeny Vereshchagin 45dbd7b6cb tests: add create_strace_wrapper
Very handy for early-boot debugging
See https://github.com/systemd/systemd/pull/2781#discussion_r54782628
2016-03-04 01:55:46 +00:00
Evgeny Vereshchagin 91f9f8f1ba tests: add test for https://github.com/systemd/systemd/issues/2730 2016-03-01 03:12:24 +00:00
Ronny Chevalier 50f130c286 test-execute: add nfsnobody alternative as a nobody user 2016-02-28 15:00:18 +01:00
Ronny Chevalier 19c0b0b9a5 core: set NoNewPrivileges for seccomp if we don't have CAP_SYS_ADMIN
The manpage of seccomp specify that using seccomp with
SECCOMP_SET_MODE_FILTER will return EACCES if the caller do not have
CAP_SYS_ADMIN set, or if the no_new_privileges bit is not set. Hence,
without NoNewPrivilege set, it is impossible to use a SystemCall*
directive with a User directive set in system mode.

Now, NoNewPrivileges is set if we are in user mode, or if we are in
system mode and we don't have CAP_SYS_ADMIN, and SystemCall*
directives are used.
2016-02-28 14:44:26 +01:00
Zbigniew Jędrzejewski-Szmek 587751eb66 udev-test.pl: add --strace option
It's useful when trying to see what the tests are doing.
I hardcoded '-efile' as the option to strace, but in the future
it might be useful to make this configurable.
2016-02-22 13:21:32 -05:00
Evgeny Vereshchagin 252549990f tests: add test for https://github.com/systemd/systemd/issues/2637
+ perl -e 'exit(!(qq{0} eq qq{\x25U}))'
exec-spec-interpolation.service: Main process exited, code=exited, status=1/FAILURE
exec-spec-interpolation.service: Unit entered failed state.
exec-spec-interpolation.service: Failed with result 'exit-code'.
        PID: 11270
        Start Timestamp: Wed 2016-02-17 22:21:31 UTC
        Exit Timestamp: Wed 2016-02-17 22:21:31 UTC
        Exit Code: exited
        Exit Status: 1
Assertion 'service->main_exec_status.status == status_expected' failed at src/test/test-execute.c:65, function check(). Aborting.
2016-02-17 22:40:26 +00:00
Evgeny Vereshchagin 09f6f45a29 tests: add test for https://github.com/systemd/systemd/issues/1981 2016-02-10 18:19:08 +00:00
Lennart Poettering 9e7454e0e2 Merge pull request #2535 from PhillipSz/remove-exit-0
test: remove exit 0 at the end
2016-02-08 17:27:18 +01:00
Evgeny Vereshchagin 646048b40a tests: fix #457
There are some limits on XFS:
major_max=511
minor_max=262143
see https://github.com/torvalds/linux/blob/master/fs/xfs/xfs_iops.c

if (S_ISCHR(mode) || S_ISBLK(mode)) {
    if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
        return -EINVAL;
2016-02-08 11:23:18 +00:00
Phillip Sz e3ceb75be3 test: remove exit 0 at the end
We don't need that at the end, as it will always exit with 0 if
everything is okey.
2016-02-05 11:38:58 +01:00
Evgeny Vereshchagin 5c7290b195 tests: add test-selinux-checks 2016-01-31 09:02:51 +00:00
Evgeny Vereshchagin d5172c7913 tests: fix install_pam
* pam_unix depends on unix_chkpwd
* selinux=1 -> pam_unix runs unix_chkpwd for root too

https://git.fedorahosted.org/cgit/linux-pam.git/tree/modules/pam_unix/passverify.c?id=e89d4c97385ff8180e6e81e84c5aa745daf28a79#n202
2016-01-25 05:30:19 +00:00
Evgeny Vereshchagin e3ce42e705 tests: add setup_selinux 2016-01-25 05:30:06 +00:00
Lukas Nykryn c584ffc0b7 sysv-generator: do not join dependencies on one line, split them
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
2016-01-21 12:53:14 +01:00
Evgeny Vereshchagin 5a613464fa tests: add STRIP_BINARIES
We need a beautiful stacktraces sometimes
For example https://github.com/systemd/systemd/pull/2328
2016-01-18 07:27:49 +00:00