summaryrefslogtreecommitdiff
path: root/src/shared/tests.h
Commit message (Collapse)AuthorAgeFilesLines
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tests: add helper function to autodetect CI environmentsZbigniew Jędrzejewski-Szmek2020-10-221-0/+3
| | | | | Sadly there is no standarized way to check if we're running in some CI environment. So let's try to gather the heuristics in one helper function.
* systemd-oomd: unit testable helper functionsAnita Zhang2020-10-071-0/+1
| | | | | | | | Helpers used by the systemd-oomd daemon to read/fill in various contexts and make detection and kill decisions. i.e. a simplified/less configurable version of https://github.com/facebookincubator/oomd/tree/master/src/oomd.
* tests: move unit files to units/ subdirectoryZbigniew Jędrzejewski-Szmek2020-03-191-1/+1
| | | | | We have a bazillion of those unit files, and keeping them all directly in tests/ has become rather unwieldy.
* tests: modify enter_cgroup_subroot() to return the new pathZbigniew Jędrzejewski-Szmek2019-11-111-1/+1
|
* tests: get rid of test-helper.[ch] completelyZbigniew Jędrzejewski-Szmek2019-11-111-0/+10
| | | | | I don't think there's any particular reason to keep those functions in a separate file.
* tests: make manager_skip_test() not a macro and move to tests.hZbigniew Jędrzejewski-Szmek2019-11-111-0/+13
| | | | There is nothing magic in it.
* tests: move memlock helper to shared codeZbigniew Jędrzejewski-Szmek2019-11-101-0/+4
|
* tests: add helper call have_namespaces() to test whether Linux namespaces ↵Lennart Poettering2018-10-241-0/+2
| | | | | | are available A slighly sloppy test call for conditionalizing several tests.
* test-sd-hwdb: add a simple test for export sd-hwdb functionsZbigniew Jędrzejewski-Szmek2018-09-301-0/+2
|
* tests: add a helper function to skip with errnoZbigniew Jędrzejewski-Szmek2018-09-141-0/+1
|
* tests: use a helper function to parse environment and open loggingZbigniew Jędrzejewski-Szmek2018-09-141-0/+1
| | | | | The advantages are that we save a few lines, and that we can override logging using environment variables in more test executables.
* tests: add helper to unify skipping a test and exitingZbigniew Jędrzejewski-Szmek2018-09-141-0/+1
|
* tests: centralize check for slow testsZbigniew Jędrzejewski-Szmek2018-09-131-0/+1
|
* test: use ${builddir}/systemd-runtest.env for $SYSTEMD_CATALOG_DIRFilipe Brandenburger2018-09-121-1/+1
| | | | | | | | | | | | | This makes it so that tests no longer need to know the absolute paths to the source and build dirs, instead using the systemd-runtest.env file to get these paths when running from the build tree. Confirmed that test-catalog works on `ninja test`, when called standalone and also when the environment file is not present, in which case it will use the installed location under /usr/lib/systemd/catalog. The location can now also be overridden for this test by setting the $SYSTEMD_CATALOG_DIR environment variable.
* test: remove support for suffix in get_testdata_dir()Filipe Brandenburger2018-09-121-1/+1
| | | | Instead, use path_join() in callers wherever needed.
* test: introduce test_is_running_from_builddir()Yu Watanabe2018-09-111-0/+1
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* test: drop TEST_DATA_DIR, fold into get_testdata_dir()Martin Pitt2017-02-161-1/+1
| | | | | | Drop the TEST_DATA_DIR macro as this was using alloca() within a function call which is allegedly unsafe. So add a "suffix" argument to get_testdata_dir() instead and call that directly.
* test: show error message if $SYSTEMD_TEST_DATA does not existMartin Pitt2017-02-161-1/+1
| | | | | | Rename get_exe_relative_testdata_dir() to get_testdata_dir() and move the env var check into that, so that everything interesting happens at the same place.
* test: make unit tests relocatableMartin Pitt2017-02-131-0/+1
| | | | | | | | | | | | | | | | It is useful to package test-* binaries and run them as root under autopkgtest or manually on particular machines. They currently have a built-in hardcoded absolute path to their test data, which does not work when running the test programs from any other path than the original build directory. By default, make the tests look for their data in <test_exe_directory>/testdata/ so that they can be called from any directory (provided that the corresponding test data is installed correctly). As we don't have a fixed static path in the build tree (as build and source tree are independent), set $TEST_DIR with "make check" to point to <srcdir>/test/, as we previously did with an automake variable.
* tests: override XDG_RUNTIME_DIR where we use the user runtime dirLennart Poettering2016-04-121-0/+22
We don#t really support systems where XDG_RUNTIME_DIR is not supported for systemd --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that involve systemd --user, so that we know it is set, and that it doesn't polute the user's actual runtime dir.