summaryrefslogtreecommitdiff
path: root/test/TEST-01-BASIC
Commit message (Collapse)AuthorAgeFilesLines
* test: make masking of supplementary services configurableFrantisek Sumsal2022-06-191-0/+1
|
* tests: add spdx headers to scripts and MakefilesZbigniew Jędrzejewski-Szmek2021-10-182-0/+3
|
* test: correctly mask supporting services in tests, take #2Frantisek Sumsal2021-06-241-12/+0
| | | | | | | | | Due to a little misunderstanding the last patch doesn't work as expected, since test_create_image() is called only for the first image (usually TEST-01-BASIC), and all subsequent images are then (possibly) modified with test_append_files(). Follow-up to 179ca4d2b1b5579014773a128462475f99b7a91b.
* test: correctly mask supporting services in testsFrantisek Sumsal2021-06-221-0/+12
| | | | | | | | | | | | | | It turns out the "supporting services" were run in _all_ tests if TEST-01-BASIC was run as the first test (which is usually the case), since with the original condition in test_create_image() we would skip the masking and then propagate the change to the default image used by other tests. This has been causing multiple bogus test timeouts (especially when the hwdb was being rebuilt in tests with short timeouts, like TEST-52-HONORFIRSTSHUTDOWN). Let's "fix" this by making the call to mask_supporting_services() uncoditional and override the test_create_image() function in TEST-01-BASIC to avoid the masking in this single case.
* test: "detect" the test number automagicallyFrantisek Sumsal2021-04-261-1/+1
| | | | | | Specifying the test number manually is tedious and prone to errors (as recently proven). Since we have all the necessary data to work out the test number, let's do it automagically.
* test: make the test entrypoint scripts shellcheck-compliantFrantisek Sumsal2021-04-201-3/+5
|
* test/TEST-01-BASIC: also install testsuite.targetDan Streetman2021-01-261-2/+3
| | | | | | | | | This test doesn't require the tests to be installed, so it must manually install required test services and targets itself, including the default target of testsuite.target Also use $TEST_UNITS_DIR which is set by test-functions instead of calculating the path
* test: find $BUILD_DIR in test-functions, remove from other scriptsDan Streetman2021-01-261-3/+1
| | | | | | | | The $BUILD_DIR is only used in test-functions, and doesn't need to be specified in any other scripts. Additionally, to be able to allow the integration test suite to be run against locally installed binaries, instead of built binaries, moving BUILD_DIR logic completely into test-functions allows later patches to be simpler.
* test: remove unused 'basedir' var from integration test makefilesDan Streetman2021-01-261-1/+1
|
* tests: build the image once and then copy/extend itLuca Boccassi2021-01-241-13/+4
| | | | | | Building custom images for each test takes a lot of time. Build the default one, and if the test needs incompatible changes just copy it and extend it instead.
* test: update test_create_imageLuca Boccassi2021-01-011-1/+1
| | | | | Run mask_supporting_services, which was missing, and remove setup_nspawn_root which is now already called outside test_create_image
* test: simplify the MakefilesZbigniew Jędrzejewski-Szmek2020-03-281-4/+1
| | | | | | has-overflow was a temporary hack that was removed in 844da987ef8b8c98f837d3328eeb3ed481f43835 (Oct. 2016). All the makefiles can be the same, and all the targets can be handled identically.
* test/TEST-01: allow running w/o -Dinstall-tests=trueZbigniew Jędrzejewski-Szmek2020-03-281-0/+5
| | | | | This is useful for sanitizer builds under CI, see https://github.com/systemd/systemd-centos-ci/pull/202#issuecomment-566476592.
* test: rework how images are createdZbigniew Jędrzejewski-Szmek2020-03-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we'd create a separate image for each test, in /var/tmp/systemd-test.XXXXX/rootdisk.img. Most of the images where very similar, except that each one had some unit files installed specifically for the test. The installation of those custom unit files was removed in previous commits (all the unit files are always installed). The new approach is to only create as few distinct images as possible. We have: default.img: the "normal" image suitable for almost all the tests basic.img: the same as default image but doesn't mask any services cryptsetup.img: p2 is used for encrypted /var badid.img: /etc/machine-id is overwritten with stuff selinux.img: with selinux added for fun and fun and a few others: ls -l build/test/*img lrwxrwxrwx 1 root root 38 Mar 21 21:23 build/test/badid.img -> /var/tmp/systemd-test.PJFFeo/badid.img lrwxrwxrwx 1 root root 38 Mar 21 21:17 build/test/basic.img -> /var/tmp/systemd-test.na0xOI/basic.img lrwxrwxrwx 1 root root 43 Mar 21 21:18 build/test/cryptsetup.img -> /var/tmp/systemd-test.Tzjv06/cryptsetup.img lrwxrwxrwx 1 root root 40 Mar 21 21:19 build/test/default.img -> /var/tmp/systemd-test.EscAsS/default.img lrwxrwxrwx 1 root root 39 Mar 21 21:22 build/test/nspawn.img -> /var/tmp/systemd-test.HSebKo/nspawn.img lrwxrwxrwx 1 root root 40 Mar 21 21:20 build/test/selinux.img -> /var/tmp/systemd-test.daBjbx/selinux.img lrwxrwxrwx 1 root root 39 Mar 21 21:21 build/test/test08.img -> /var/tmp/systemd-test.OgnN8Z/test08.img I considered trying to use the same image everywhere. It would probably be possible, but it would be very brittle. By using separate images where it is necessary we keep various orthogonal modifications independent. The way that images are cached is complicated by the fact that we still want to keep them in /var/tmp. Thus, an image is created on first use and linked to from build/test/ so it can be found by other tests. Tests cannot be run in parallel. I think that is an acceptable limitation. Creation of the images was probably taking more resources then the actual tests, so we should be better off anyway.
* test: drop cargo-cult lineZbigniew Jędrzejewski-Szmek2020-03-281-2/+0
| | | | p2 is only used in the cryptsetup test...
* test: move TEST-01-BASIC setup to static filesZbigniew Jędrzejewski-Szmek2020-03-281-14/+1
| | | | | After this commit, only tests that were converted will work, because the interface to test_run() changed.
* treewide: more portable bash shebangsJörg Thalheim2020-03-051-1/+1
| | | | | | | | | | | | | | | | As in 2a5fcfae024ffc370bb780572279f45a1da3f946 and in 3e67e5c9928f8b1e1c5a63def88d53ed1fed12eb using /usr/bin/env allows bash to be looked up in PATH rather than being hard-coded. As with the previous changes the same arguments apply - distributions have scripts to rewrite shebangs on installation and they know what locations to rely on. - For tests/compilation we should rather rely on the user to have setup there PATH correctly. In particular this makes testing from git easier on NixOS where do not provide /bin/bash to improve compose-ability.
* test: add create_empty_image_rootdir() to simplify testcase setupDan Streetman2019-07-161-6/+1
| | | | | | | | | Almost all tests were manually mounting/unmounting $TESTDIR/root from the loopback image; this moves all that into test-functions so the test setup functions are simplier. Also add test_setup_cleanup() function, to cleanup what is mounted by create_empty_image_rootdir()
* test: drop || return 1 expression which is incompatible with set -eFrantisek Sumsal2019-07-081-1/+1
| | | | | | The `set -e` option is incompatible with a subshell/compound command, which is followed by || <EXPR>. In such case, the -e option is ignored in all affected subshells/functions (see man bash(1) for command `set`).
* test: correctly fail when system is borkedFrantisek Sumsal2019-05-271-1/+1
| | | | | | | In certain situations, the systemctl commands may fail (e.g. due to missing shared libraries), but the 'script' continues and creates a /testok file, marking the test incorrectly as passed. Let's fix this and bail out immediately when a command exits with a non-zero exit code.
* scripts: use 4 space indentationZbigniew Jędrzejewski-Szmek2019-04-121-2/+0
| | | | | | | | | | | | | | | | | | 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.
* test: drop service masking in TEST-01-BASICFrantisek Sumsal2019-01-111-7/+0
| | | | | This test should ensure all systemd starts correctly, so masking them is counter-productive in this case.
* tests: reproduce https://github.com/systemd/systemd/issues/11251Evgeny Vereshchagin2018-12-291-1/+1
|
* test: don't run TEST-01-BASIC in unprivileged containers on Travis CIEvgeny Vereshchagin2018-12-241-1/+1
|
* tests: clean up again after running tests (#10446)Lennart Poettering2018-10-191-1/+6
| | | | | | | | | | | | | | | | | Currently, if I run the full "run-integration-tests.sh" script it will fail on my machine because it fills up /var/tmp whith just too much crap until the disk is full. Let's make sure that "run-integration-tests.sh" cleans up after every test. For that change the make targets to run from "clean setup run" to "clean setup run clean" — except that that doesn't work since make is smart enough to realize that the same target appears twice on the command line and will only execute it once. Let's fix that by defining another target "clean-again" which is just like "clean", but allows us to be added to the same command line a second time. Then, let's build with "clean setup run clean-again" and all is good. While we are at it, let's also add .PHONY where appropriate, after all these all are phony targets.
* tests: also run TEST-01-BASIC in an unprivileged container (#9957)Evgeny Vereshchagin2018-08-301-0/+1
| | | | | This should make it much easier to catch regressions like https://github.com/systemd/systemd/issues/9914 and https://github.com/systemd/systemd/issues/8535.
* test: make sure "make" in the test directories works againLennart Poettering2017-12-151-1/+1
| | | | Fixes: #7648
* tests: try to autodetect directory betterZbigniew Jędrzejewski-Szmek2017-12-061-1/+1
| | | | | | | | | | Ignore mkosi.builddir. In the future we can also add other patterns if necessary. run-intergration-tests.sh is updated to use the new script, and modified to work from arbitrary directory. Follow-up for #7494.
* test: Run qemu/nspawn tests with "set -e"Martin Pitt2017-08-101-0/+1
| | | | | | | | 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).
* test: Factorize common integration test functions (#6540)Martin Pitt2017-08-041-34/+0
| | | | | | | | | | | 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.
* test: try to guess the build directoryZbigniew Jędrzejewski-Szmek2017-07-181-1/+3
| | | | | This will work if $(TOP_SRC_DIR) has exactly one subdirectory with .ninja_deps. Otherwise, BUILD_DIR has to be specified.
* test: convert test/ to use meson installZbigniew Jędrzejewski-Szmek2017-07-181-10/+2
| | | | | | | | | | | | | Automatic rebuilding is removed: it doesn't play well with ninja, because ninja always writes logs, and even if nothing needs to be built, it will make the log file owned by root. So let's just remove this, and say that the user must always do the build first. I'm also keeping make for the tests, because ninja doesn't play well with sudo. Since the build directory is arbitrary, it needs to be specified, e.g. sudo make BUILD_DIR=/home/zbyszek/src/systemd/build1 -C test/TEST-01-BASIC/
* test: merge check_nspawn() into run_nspawn()Martin Pitt2016-06-241-2/+1
| | | | | This makes nspawn tests symmetric with run_qemu() which also exits with 1 if QEMU is not available.
* tree-wide: remove uses of --failedZbigniew Jędrzejewski-Szmek2016-05-081-1/+1
| | | | It has been replaced by --state=failed.
* tests: don't run tests on incomplete setupEvgeny Vereshchagin2015-11-251-1/+1
|
* Merge pull request #1957 from zonque/qemu-testLennart Poettering2015-11-241-0/+7
|\ | | | | test: make QEMU tests work on Semaphore
| * test: 01-basic: mask some services that currently don't run in qemuDaniel Mack2015-11-191-0/+7
| |
* | tests: fix ls: cannot access /var/tmp/systemd-test.*/journal/*/*.journalEvgeny Vereshchagin2015-11-191-1/+1
|/ | | | don't lose logs from the test machine too
* tests: various fixesEvgeny Vereshchagin2015-11-101-1/+1
| | | | | | * 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
* tests: do not use systemctl status --failedRonny Chevalier2014-06-101-1/+1
| | | | | since v212 calling systemctl status without arguments will show a overall system state
* test: rework run_qemuRonny Chevalier2013-12-101-6/+2
| | | | | | | | | | | | | | | 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)
* test: remove duplicated codeRonny Chevalier2013-11-071-178/+12
|
* TEST-01-BASIC, TEST-02-CRYPTSETUP: fixed stripHarald Hoyer2013-09-171-3/+3
| | | | also output more status about failed jobs
* test: make it easier to override kernel versionZbigniew Jędrzejewski-Szmek2013-04-241-3/+1
|
* test: some trivial fixes to test scriptsZbigniew Jędrzejewski-Szmek2013-01-291-3/+3
| | | | | | | - fix typo - use compiled systemd-nspawn - drop --capability=... from systemd-nspawn invocation, is is the default now - simplify sudo make invocations
* test: factor out testsuite.target, end.serviceMichal Schmidt2013-01-251-10/+4
| | | | | | Tests can use the same testsuite.target. Add end.service to call poweroff instead of doing it from ExecStopPost where it may be skipped on failure of ExecStart.
* test: use non-blocking systemctl calls in testsuite.serviceMichal Schmidt2013-01-251-1/+1
| | | | | "systemctl poweroff" called from testsuite.service will cause this unit itself to stop. To avoid deadlock, the call must not be synchronous.
* test: split of cryptsetup into its own testLennart Poettering2012-09-131-35/+2
|
* nspawn: introduce new --capabilities= flag and make use of it in the nspawn ↵Lennart Poettering2012-06-281-1/+1
| | | | test case
* test: reenable nspawn, even if it fails for nowLennart Poettering2012-06-281-2/+1
|