mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #14338 from keszybz/functional-test-rework
Functional test rework
This commit is contained in:
27
meson.build
27
meson.build
@@ -49,9 +49,12 @@ fuzzer_build = want_ossfuzz or want_libfuzzer
|
||||
#####################################################################
|
||||
|
||||
# Try to install the git pre-commit hook
|
||||
git_hook = run_command(join_paths(project_source_root, 'tools/add-git-hook.sh'))
|
||||
if git_hook.returncode() == 0
|
||||
message(git_hook.stdout().strip())
|
||||
add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
|
||||
if add_git_hook_sh.found()
|
||||
git_hook = run_command(add_git_hook_sh)
|
||||
if git_hook.returncode() == 0
|
||||
message(git_hook.stdout().strip())
|
||||
endif
|
||||
endif
|
||||
|
||||
#####################################################################
|
||||
@@ -2503,7 +2506,7 @@ if conf.get('ENABLE_BINFMT') == 1
|
||||
endif
|
||||
|
||||
if conf.get('ENABLE_REPART') == 1
|
||||
executable('systemd-repart',
|
||||
exe = executable('systemd-repart',
|
||||
systemd_repart_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libshared],
|
||||
@@ -2515,6 +2518,12 @@ if conf.get('ENABLE_REPART') == 1
|
||||
install_rpath : rootlibexecdir,
|
||||
install : true,
|
||||
install_dir : rootbindir)
|
||||
|
||||
if want_tests != 'false'
|
||||
test('test-repart',
|
||||
test_repart_sh,
|
||||
args : exe.full_path())
|
||||
endif
|
||||
endif
|
||||
|
||||
if conf.get('ENABLE_VCONSOLE') == 1
|
||||
@@ -2959,13 +2968,20 @@ if conf.get('ENABLE_NETWORKD') == 1
|
||||
install_dir : rootbindir)
|
||||
public_programs += exe
|
||||
|
||||
executable('systemd-network-generator',
|
||||
exe = executable('systemd-network-generator',
|
||||
network_generator_sources,
|
||||
include_directories : includes,
|
||||
link_with : [networkd_link_with],
|
||||
install_rpath : rootlibexecdir,
|
||||
install : true,
|
||||
install_dir : rootlibexecdir)
|
||||
|
||||
if want_tests != 'false'
|
||||
test('test-network-generator-conversion',
|
||||
test_network_generator_conversion_sh,
|
||||
# https://github.com/mesonbuild/meson/issues/2681
|
||||
args : exe.full_path())
|
||||
endif
|
||||
endif
|
||||
|
||||
executable('systemd-sulogin-shell',
|
||||
@@ -3467,6 +3483,7 @@ foreach tuple : [
|
||||
['debug siphash'],
|
||||
['valgrind', conf.get('VALGRIND') == 1],
|
||||
['trace logging', conf.get('LOG_TRACE') == 1],
|
||||
['install tests', install_tests],
|
||||
['link-udev-shared', get_option('link-udev-shared')],
|
||||
['link-systemctl-shared', get_option('link-systemctl-shared')],
|
||||
['link-networkd-shared', get_option('link-networkd-shared')],
|
||||
|
||||
@@ -17,7 +17,7 @@ PHASES=(${@:-SETUP RUN})
|
||||
create_container() {
|
||||
# create autopkgtest LXC image; this sometimes fails with "Unable to fetch
|
||||
# GPG key from keyserver", so retry a few times
|
||||
for retry in $(seq 5); do
|
||||
for retry in {1..5}; do
|
||||
sudo lxc-create -n $CONTAINER -t download -- -d $DISTRO -r $RELEASE -a $ARCH --keyserver hkp://keyserver.ubuntu.com:80 && break
|
||||
sleep $((retry*retry))
|
||||
done
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
systemd_repart_sources = files('''
|
||||
repart.c
|
||||
'''.split())
|
||||
|
||||
test_repart_sh = find_program('test-repart.sh')
|
||||
|
||||
111
src/partition/test-repart.sh
Executable file
111
src/partition/test-repart.sh
Executable file
@@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
repart=$1
|
||||
test -x $repart
|
||||
|
||||
D=$(mktemp --directory)
|
||||
trap "rm -rf '$D'" EXIT INT QUIT PIPE
|
||||
mkdir -p $D/definitions
|
||||
|
||||
truncate -s 1G $D/zzz
|
||||
|
||||
SEED=e2a40bf9-73f1-4278-9160-49c031e7aef8
|
||||
|
||||
$repart $D/zzz --empty=force --dry-run=no --seed=$SEED
|
||||
|
||||
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' > $D/empty
|
||||
|
||||
cmp $D/empty - <<EOF
|
||||
label: gpt
|
||||
label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
|
||||
device: $D/zzz
|
||||
unit: sectors
|
||||
first-lba: 2048
|
||||
last-lba: 2097118
|
||||
EOF
|
||||
|
||||
cat >$D/definitions/root.conf <<EOF
|
||||
[Partition]
|
||||
Type=root
|
||||
EOF
|
||||
|
||||
ln -s root.conf $D/definitions/root2.conf
|
||||
|
||||
cat >$D/definitions/home.conf <<EOF
|
||||
[Partition]
|
||||
Type=home
|
||||
EOF
|
||||
|
||||
cat > $D/definitions/swap.conf <<EOF
|
||||
[Partition]
|
||||
Type=swap
|
||||
SizeMaxBytes=64M
|
||||
PaddingMinBytes=92M
|
||||
EOF
|
||||
|
||||
$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
|
||||
|
||||
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated
|
||||
|
||||
cmp $D/populated - <<EOF
|
||||
label: gpt
|
||||
label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
|
||||
device: $D/zzz
|
||||
unit: sectors
|
||||
first-lba: 2048
|
||||
last-lba: 2097118
|
||||
$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
|
||||
$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
|
||||
$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
|
||||
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
|
||||
EOF
|
||||
|
||||
cat >$D/definitions/swap.conf <<EOF
|
||||
[Partition]
|
||||
Type=swap
|
||||
SizeMaxBytes=64M
|
||||
EOF
|
||||
|
||||
cat >$D/definitions/extra.conf <<EOF
|
||||
[Partition]
|
||||
Type=linux-generic
|
||||
EOF
|
||||
|
||||
$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
|
||||
|
||||
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated2
|
||||
|
||||
cmp $D/populated2 - <<EOF
|
||||
label: gpt
|
||||
label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
|
||||
device: $D/zzz
|
||||
unit: sectors
|
||||
first-lba: 2048
|
||||
last-lba: 2097118
|
||||
$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
|
||||
$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
|
||||
$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
|
||||
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
|
||||
$D/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
|
||||
EOF
|
||||
|
||||
truncate -s 2G $D/zzz
|
||||
|
||||
$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
|
||||
|
||||
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated3
|
||||
|
||||
cmp $D/populated3 - <<EOF
|
||||
label: gpt
|
||||
label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
|
||||
device: $D/zzz
|
||||
unit: sectors
|
||||
first-lba: 2048
|
||||
last-lba: 4194270
|
||||
$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
|
||||
$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
|
||||
$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
|
||||
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
|
||||
$D/zzz5 : start= 1908696, size= 2285568, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
|
||||
EOF
|
||||
@@ -92,7 +92,6 @@ static void test_packet_from_file(const char* filename, bool canonical) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i, N;
|
||||
_cleanup_free_ char *pkts_glob = NULL;
|
||||
_cleanup_globfree_ glob_t g = {};
|
||||
char **fnames;
|
||||
|
||||
@@ -102,7 +101,8 @@ int main(int argc, char **argv) {
|
||||
N = argc - 1;
|
||||
fnames = argv + 1;
|
||||
} else {
|
||||
pkts_glob = path_join(get_testdata_dir(), "test-resolve/*.pkts");
|
||||
_cleanup_free_ char *pkts_glob = NULL;
|
||||
assert_se(get_testdata_dir("test-resolve/*.pkts", &pkts_glob) >= 0);
|
||||
assert_se(glob(pkts_glob, GLOB_NOSORT, NULL, &g) == 0);
|
||||
N = g.gl_pathc;
|
||||
fnames = g.gl_pathv;
|
||||
|
||||
@@ -58,21 +58,25 @@ static void load_testdata_env(void) {
|
||||
setenv(*k, *v, 0);
|
||||
}
|
||||
|
||||
const char* get_testdata_dir(void) {
|
||||
const char *env;
|
||||
int get_testdata_dir(const char *suffix, char **ret) {
|
||||
const char *dir;
|
||||
char *p;
|
||||
|
||||
load_testdata_env();
|
||||
|
||||
/* if the env var is set, use that */
|
||||
env = getenv("SYSTEMD_TEST_DATA");
|
||||
if (!env)
|
||||
env = SYSTEMD_TEST_DATA;
|
||||
if (access(env, F_OK) < 0) {
|
||||
fprintf(stderr, "ERROR: $SYSTEMD_TEST_DATA directory [%s] does not exist\n", env);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
dir = getenv("SYSTEMD_TEST_DATA");
|
||||
if (!dir)
|
||||
dir = SYSTEMD_TEST_DATA;
|
||||
if (access(dir, F_OK) < 0)
|
||||
return log_error_errno(errno, "ERROR: $SYSTEMD_TEST_DATA directory [%s] not accesible: %m", dir);
|
||||
|
||||
return env;
|
||||
p = path_join(dir, suffix);
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
*ret = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* get_catalog_dir(void) {
|
||||
|
||||
@@ -20,7 +20,7 @@ static inline bool manager_errno_skip_test(int r) {
|
||||
|
||||
char* setup_fake_runtime_dir(void);
|
||||
int enter_cgroup_subroot(char **ret_cgroup);
|
||||
const char* get_testdata_dir(void);
|
||||
int get_testdata_dir(const char *suffix, char **ret);
|
||||
const char* get_catalog_dir(void);
|
||||
bool slow_tests_enabled(void);
|
||||
void test_setup_logging(int level);
|
||||
|
||||
@@ -48,7 +48,9 @@ int main(int argc, char *argv[]) {
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
assert_se(set_unit_path(get_testdata_dir()) >= 0);
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
r = bpf_program_new(BPF_PROG_TYPE_CGROUP_SKB, &p);
|
||||
|
||||
@@ -38,7 +38,9 @@ static int test_cgroup_mask(void) {
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
/* Prepare the manager. */
|
||||
assert_se(set_unit_path(get_testdata_dir()) >= 0);
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (IN_SET(r, -EPERM, -EACCES)) {
|
||||
|
||||
@@ -22,7 +22,9 @@ static int test_default_memory_low(void) {
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
assert_se(set_unit_path(get_testdata_dir()) >= 0);
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (IN_SET(r, -EPERM, -EACCES)) {
|
||||
|
||||
@@ -26,8 +26,11 @@ int main(int argc, char *argv[]) {
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
/* prepare the test */
|
||||
assert_se(set_unit_path(get_testdata_dir()) >= 0);
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (manager_errno_skip_test(r))
|
||||
return log_tests_skipped_errno(r, "manager_new");
|
||||
|
||||
@@ -806,7 +806,6 @@ static int run_tests(UnitFileScope scope, const test_entry tests[], char **patte
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
|
||||
_cleanup_free_ char *test_execute_path = NULL;
|
||||
|
||||
static const test_entry user_tests[] = {
|
||||
entry(test_exec_basic),
|
||||
@@ -878,9 +877,10 @@ int main(int argc, char *argv[]) {
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("test-execute/", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
test_execute_path = path_join(get_testdata_dir(), "test-execute");
|
||||
assert_se(set_unit_path(test_execute_path) >= 0);
|
||||
|
||||
/* Unset VAR1, VAR2 and VAR3 which are used in the PassEnvironment test
|
||||
* cases, otherwise (and if they are present in the environment),
|
||||
|
||||
@@ -444,20 +444,20 @@ static void test_write_string_file_verify(void) {
|
||||
_cleanup_free_ char *buf = NULL, *buf2 = NULL;
|
||||
int r;
|
||||
|
||||
assert_se(read_one_line_file("/proc/cmdline", &buf) >= 0);
|
||||
assert_se(read_one_line_file("/proc/version", &buf) >= 0);
|
||||
assert_se(buf2 = strjoin(buf, "\n"));
|
||||
|
||||
r = write_string_file("/proc/cmdline", buf, 0);
|
||||
r = write_string_file("/proc/version", buf, 0);
|
||||
assert_se(IN_SET(r, -EACCES, -EIO));
|
||||
r = write_string_file("/proc/cmdline", buf2, 0);
|
||||
r = write_string_file("/proc/version", buf2, 0);
|
||||
assert_se(IN_SET(r, -EACCES, -EIO));
|
||||
|
||||
assert_se(write_string_file("/proc/cmdline", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
|
||||
assert_se(write_string_file("/proc/cmdline", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
|
||||
assert_se(write_string_file("/proc/version", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
|
||||
assert_se(write_string_file("/proc/version", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
|
||||
|
||||
r = write_string_file("/proc/cmdline", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE);
|
||||
r = write_string_file("/proc/version", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE);
|
||||
assert_se(IN_SET(r, -EACCES, -EIO));
|
||||
assert_se(write_string_file("/proc/cmdline", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
|
||||
assert_se(write_string_file("/proc/version", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
|
||||
}
|
||||
|
||||
static void test_load_env_file_pairs(void) {
|
||||
@@ -757,7 +757,7 @@ static void test_read_line3(void) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
int r;
|
||||
|
||||
f = fopen("/proc/cmdline", "re");
|
||||
f = fopen("/proc/uptime", "re");
|
||||
if (!f && IN_SET(errno, ENOENT, EPERM))
|
||||
return;
|
||||
assert_se(f);
|
||||
|
||||
@@ -25,7 +25,7 @@ static void test_basic_parsing(void) {
|
||||
_cleanup_free_ char *journal_data_path = NULL;
|
||||
int r;
|
||||
|
||||
journal_data_path = path_join(get_testdata_dir(), "journal-data/journal-1.txt");
|
||||
assert_se(get_testdata_dir("journal-data/journal-1.txt", &journal_data_path) >= 0);
|
||||
imp.fd = open(journal_data_path, O_RDONLY|O_CLOEXEC);
|
||||
assert_se(imp.fd >= 0);
|
||||
|
||||
@@ -56,7 +56,7 @@ static void test_bad_input(void) {
|
||||
_cleanup_free_ char *journal_data_path = NULL;
|
||||
int r;
|
||||
|
||||
journal_data_path = path_join(get_testdata_dir(), "journal-data/journal-2.txt");
|
||||
assert_se(get_testdata_dir("journal-data/journal-1.txt", &journal_data_path) >= 0);
|
||||
imp.fd = open(journal_data_path, O_RDONLY|O_CLOEXEC);
|
||||
assert_se(imp.fd >= 0);
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
test_path = path_join(get_testdata_dir(), "test-path");
|
||||
assert_se(get_testdata_dir("test-path", &test_path) >= 0);
|
||||
assert_se(set_unit_path(test_path) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
|
||||
@@ -25,8 +25,11 @@ int main(int argc, char *argv[]) {
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
/* prepare the test */
|
||||
assert_se(set_unit_path(get_testdata_dir()) >= 0);
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (manager_errno_skip_test(r))
|
||||
return log_tests_skipped_errno(r, "manager_new");
|
||||
|
||||
@@ -15,8 +15,10 @@ static void test_mount_points_list(const char *fname) {
|
||||
|
||||
log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/self/mountinfo");
|
||||
|
||||
if (fname)
|
||||
fname = testdata_fname = path_join(get_testdata_dir(), fname);
|
||||
if (fname) {
|
||||
assert_se(get_testdata_dir(fname, &testdata_fname) >= 0);
|
||||
fname = testdata_fname;
|
||||
}
|
||||
|
||||
LIST_HEAD_INIT(mp_list_head);
|
||||
assert_se(mount_points_list_get(fname, &mp_list_head) >= 0);
|
||||
@@ -37,8 +39,10 @@ static void test_swap_list(const char *fname) {
|
||||
|
||||
log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/swaps");
|
||||
|
||||
if (fname)
|
||||
fname = testdata_fname = path_join(get_testdata_dir(), fname);
|
||||
if (fname) {
|
||||
assert_se(get_testdata_dir(fname, &testdata_fname) >= 0);
|
||||
fname = testdata_fname;
|
||||
}
|
||||
|
||||
LIST_HEAD_INIT(mp_list_head);
|
||||
assert_se(swap_list_get(fname, &mp_list_head) >= 0);
|
||||
|
||||
@@ -20,7 +20,10 @@ int main(int argc, char *argv[]) {
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
assert_se(set_unit_path(get_testdata_dir()) >= 0);
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units/", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
assert_se(manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
|
||||
|
||||
@@ -10,10 +10,10 @@ ninja: no work to do.
|
||||
--x-- Running TEST-01-BASIC --x--
|
||||
+ make -C TEST-01-BASIC BUILD_DIR=/home/zbyszek/src/systemd/build clean setup run
|
||||
make: Entering directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
|
||||
TEST CLEANUP: Basic systemd setup
|
||||
TEST SETUP: Basic systemd setup
|
||||
TEST-01-BASIC CLEANUP: Basic systemd setup
|
||||
TEST-01-BASIC SETUP: Basic systemd setup
|
||||
...
|
||||
TEST RUN: Basic systemd setup [OK]
|
||||
TEST-01-BASIC RUN: Basic systemd setup [OK]
|
||||
make: Leaving directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
|
||||
--x-- Result of TEST-01-BASIC: 0 --x--
|
||||
--x-- Running TEST-02-CRYPTSETUP --x--
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
|
||||
|
||||
all setup run:
|
||||
all setup run clean clean-again:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||
|
||||
clean clean-again:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --clean
|
||||
|
||||
.PHONY: all setup run clean clean-again
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user