Commit graph

6 commits

Author SHA1 Message Date
Yu Watanabe e327272d79 test-network: ignore tunnel devices automatically added by kernel
Fixes #10934.
2019-02-06 22:04:32 +09:00
Zbigniew Jędrzejewski-Szmek a90c04b6b7 test-execute: filter out ip6tnl0@ and ip6gre0@ interfaces
Those interfaces are created automatically when ip6_tunnel and ip6_gre loaded.
They break the test with exec-privatenetwork-yes.service.

C.f. 6b08180ca6.
2018-10-09 14:08:09 +02:00
Zbigniew Jędrzejewski-Szmek 6b08180ca6 test-execute: allow sit0@ to exist in private network namespace
It's always visible:

$ sudo modprobe sit
$ sudo unshare -n ip l
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    ...
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    ...
2018-03-22 15:57:56 +01:00
Zbigniew Jędrzejewski-Szmek c725631f4b test-execute: simplify checks if grep output is empty
grep already indicates if it matched anything by return value.
Additional advantage is then that if the test fails, the unexpected
matching lines are visible in the log output.
2018-03-22 15:57:56 +01: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
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
Renamed from test/exec-privatenetwork-yes.service (Browse further)