Commit Graph

23 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek cc5549ca12 scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)

Also remove the few vim config lines that were left. We should either have them
on all files, or none.

Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-12 08:30:31 +02:00
Lennart Poettering f087c7e072 test: add some basic testing that "systemctl start -T" does something 2019-03-27 12:37:37 +01:00
Yu Watanabe 056ae88152 test: mask several unnecessary services
This may make CIs run faster.
2018-11-03 18:00:47 +09:00
Lennart Poettering efd0b6ccca test: make sure output of test TEST-03 test service ends up on console 2018-06-06 11:24:34 +02:00
Lennart Poettering 3edc0c590d test: disable QEMU based testing for TEST-16-EXTEND-TIMEOUT
The test is heavily dependent on timeouts, and if we are run in
potentially very slow QEMU instances there's a good chance we'll miss
some which we normally wouldn't miss. Hence, let's test this one in
nspawn only. Given that the test is purely in service management it
shouldn't matter whether it runs in nspawn or qemu, hence keep running
it in nspawn, but don't bother with qemu.

Similar, do this for TEST-03-JOBS, too, which operates with relatively
short sleep times internally.

Fixes: #9123
2018-06-06 11:24:09 +02:00
Martin Pitt 818567fce6 test: Run qemu/nspawn tests with "set -e"
This catches errors like "ninja not found", missing programs etc. early,
instead of silently ignoring them and trying to boot a broken VM.

In install_config_files(), allow some distro specific files to be absent
(such as /etc/sysconfig/init).
2017-08-10 08:43:13 +02:00
Martin Pitt 054ee249a2 test: Factorize common integration test functions (#6540)
All test/TEST* but TEST-02-CRYPTSETUP share the same check_result_qemu()
and test_cleanup(), so move them into test_functions and only override
them in TEST-02-CRYPTSETUP.

Also provide a common test_run() which by default assumes that both QEMU
and nspawn tests are run. Particular tests which don't support either
need to explicitly opt out by setting $TEST_NO_{QEMU,NSPAWN}. Do it this
way around to avoid accidentally forgetting to opt in, and to encourage
test authors to at least always support nspawn.
2017-08-04 15:34:14 +03:00
Martin Pitt 5209e9afd2 tests: use less aggressive systemctl --wait timeout in TEST-03-JOBS (#4606)
If the "systemctl start" happens at an "unlucky" time such as 1000.9 seconds
and then e. g.  runs for 2.6 s (sleep 2 plus the overhead of starting the unit
and waiting for it) the END_SEC would be 1003.5s which would round to 1004,
making the difference 4. On busier testbeds the overhead apparently can take a
bit more than 0.5s. The main point is really that it doesn't wait that much
longer, so "-le 4" seems perfectly fine. We allow up to 1.5s in the subsequent
"wait5fail" test below too.

Fixes #4582
2016-11-07 21:51:20 +03:00
Martin Pitt 93a0884126 systemctl: Add --wait option to wait until started units terminate again
Fixes #3830
2016-10-01 17:58:59 +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
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 b46f4ef107 tests: fix TEST-03-JOBS
We have

JOB UNIT                     TYPE  STATE
  1 testsuite.target         start waiting
 81 end.service              start waiting
187 sleep.service            start waiting
136 hello.service            start waiting
 82 testsuite.service        start running
135 hello-after-sleep.target start waiting

sometimes
2016-01-18 03:56:51 +00:00
Evgeny Vereshchagin cd949ee734 tests: don't run tests on incomplete setup 2015-11-25 17:51:17 +00: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
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
Michal Schmidt 06c1c4f98c test: add test for crash when adding a JOB_NOP 2014-11-26 16:33:40 +01:00
Ronny Chevalier c6a77179a4 test: rework run_qemu
It tries to find a suitable QEMU binary and will use KVM if present.
We can now configure QEMU from outside with 4 variables :
  - $QEMU_BIN : path to QEMU's binary
  - $KERNEL_APPEND : arguments appended to kernel cmdline
  - $KERNEL_BIN : path to a kernel
    Default /boot/vmlinuz-$KERNEL_VER
  - $INITRD : path to an initramfs
    Default /boot/initramfs-${KERNEL_VER}.img
  - $QEMU_SMP : number of CPU simulated by QEMU.
    Default 1

(from Alexander Graf's script: http://www.spinics.net/lists/kvm/msg72389.html)
2013-12-10 07:46:21 -05:00
Ronny Chevalier 889a90422d test: remove duplicated code 2013-11-07 01:23:54 -05:00
Harald Hoyer 41a5ef639b TEST-03-JOBS/test.sh: do not output the "failed" if it does not exist 2013-09-17 15:19:17 -05:00
Zbigniew Jędrzejewski-Szmek fff87a35d9 test: make it easier to override kernel version 2013-04-24 00:25:04 -04:00
Michal Schmidt d710d36375 test: test irreversible jobs 2013-02-23 14:18:17 +01:00
Zbigniew Jędrzejewski-Szmek 7bcd865d38 test: some trivial fixes to test scripts
- fix typo
- use compiled systemd-nspawn
- drop --capability=... from systemd-nspawn invocation, is is the default now
- simplify sudo make invocations
2013-01-29 19:01:41 -05:00
Michal Schmidt b5da077ddf test: add test for jobs
Add a test case for job merging with --ignore-dependencies.

test.sh is copied from TEST-01-*, only lightly modified (this
should be refactored better in the future).
test-jobs.sh is the core of this test.
2013-01-25 22:29:56 +01:00