mirror of
https://github.com/systemd/systemd
synced 2026-03-25 00:04:53 +01:00
Compare commits
No commits in common. "d178203d8e2dae9bba48790a93031f2e776a2f83" and "5afcf89ca29b518eb2fa244b015afc2708f77e1d" have entirely different histories.
d178203d8e
...
5afcf89ca2
@ -747,15 +747,8 @@ Service b@0.service not loaded, b.socket cannot be started.
|
||||
<varlistentry>
|
||||
<term><option>--root=<replaceable>PATH</replaceable></option></term>
|
||||
|
||||
<listitem><para>With <command>cat-files</command> and <command>verify</command>,
|
||||
operate on files underneath the specified root path <replaceable>PATH</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--image=<replaceable>PATH</replaceable></option></term>
|
||||
|
||||
<listitem><para>With <command>cat-files</command> and <command>verify</command>,
|
||||
operate on files inside the specified image path <replaceable>PATH</replaceable>.</para></listitem>
|
||||
<listitem><para>With <command>cat-files</command>, show config files underneath
|
||||
the specified root path <replaceable>PATH</replaceable>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
||||
@ -125,7 +125,7 @@ _systemd_analyze() {
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[VERIFY]}; then
|
||||
if [[ $cur = -* ]]; then
|
||||
comps='--help --version --system --user --global --man=no --generators=yes --root --image'
|
||||
comps='--help --version --system --user --global --man=no --generators=yes'
|
||||
else
|
||||
comps=$( compgen -A file -- "$cur" )
|
||||
compopt -o filenames
|
||||
|
||||
@ -87,8 +87,6 @@ _arguments \
|
||||
'--system[Operate on system systemd instance]' \
|
||||
'--user[Operate on user systemd instance]' \
|
||||
'--global[Show global user instance config]' \
|
||||
'--root=[Add support for root argument]:PATH' \
|
||||
'--image=[Add support for discrete images]:PATH' \
|
||||
'--no-pager[Do not pipe output into a pager]' \
|
||||
'--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \
|
||||
'--order[When generating graph for dot, show only order]' \
|
||||
|
||||
@ -83,7 +83,7 @@ int verify_conditions(char **lines, UnitFileScope scope) {
|
||||
return log_error_errno(r, "Failed to initialize manager: %m");
|
||||
|
||||
log_debug("Starting manager...");
|
||||
r = manager_startup(m, /* serialization= */ NULL, /* fds= */ NULL, /* root= */ NULL);
|
||||
r = manager_startup(m, NULL, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ static int verify_socket(Unit *u) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int verify_executable(Unit *u, const ExecCommand *exec, const char *root) {
|
||||
int verify_executable(Unit *u, const ExecCommand *exec) {
|
||||
int r;
|
||||
|
||||
if (!exec)
|
||||
@ -124,14 +124,14 @@ int verify_executable(Unit *u, const ExecCommand *exec, const char *root) {
|
||||
if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
|
||||
return 0;
|
||||
|
||||
r = find_executable_full(exec->path, root, false, NULL, NULL);
|
||||
r = find_executable_full(exec->path, false, NULL, NULL);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int verify_executables(Unit *u, const char *root) {
|
||||
static int verify_executables(Unit *u) {
|
||||
ExecCommand *exec;
|
||||
int r = 0, k;
|
||||
unsigned i;
|
||||
@ -141,20 +141,20 @@ static int verify_executables(Unit *u, const char *root) {
|
||||
exec = u->type == UNIT_SOCKET ? SOCKET(u)->control_command :
|
||||
u->type == UNIT_MOUNT ? MOUNT(u)->control_command :
|
||||
u->type == UNIT_SWAP ? SWAP(u)->control_command : NULL;
|
||||
k = verify_executable(u, exec, root);
|
||||
k = verify_executable(u, exec);
|
||||
if (k < 0 && r == 0)
|
||||
r = k;
|
||||
|
||||
if (u->type == UNIT_SERVICE)
|
||||
for (i = 0; i < ELEMENTSOF(SERVICE(u)->exec_command); i++) {
|
||||
k = verify_executable(u, SERVICE(u)->exec_command[i], root);
|
||||
k = verify_executable(u, SERVICE(u)->exec_command[i]);
|
||||
if (k < 0 && r == 0)
|
||||
r = k;
|
||||
}
|
||||
|
||||
if (u->type == UNIT_SOCKET)
|
||||
for (i = 0; i < ELEMENTSOF(SOCKET(u)->exec_command); i++) {
|
||||
k = verify_executable(u, SOCKET(u)->exec_command[i], root);
|
||||
k = verify_executable(u, SOCKET(u)->exec_command[i]);
|
||||
if (k < 0 && r == 0)
|
||||
r = k;
|
||||
}
|
||||
@ -189,7 +189,7 @@ static int verify_documentation(Unit *u, bool check_man) {
|
||||
return r;
|
||||
}
|
||||
|
||||
static int verify_unit(Unit *u, bool check_man, const char *root) {
|
||||
static int verify_unit(Unit *u, bool check_man) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error err = SD_BUS_ERROR_NULL;
|
||||
int r, k;
|
||||
|
||||
@ -207,7 +207,7 @@ static int verify_unit(Unit *u, bool check_man, const char *root) {
|
||||
if (k < 0 && r == 0)
|
||||
r = k;
|
||||
|
||||
k = verify_executables(u, root);
|
||||
k = verify_executables(u);
|
||||
if (k < 0 && r == 0)
|
||||
r = k;
|
||||
|
||||
@ -218,7 +218,7 @@ static int verify_unit(Unit *u, bool check_man, const char *root) {
|
||||
return r;
|
||||
}
|
||||
|
||||
int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run_generators, const char *root) {
|
||||
int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run_generators) {
|
||||
const ManagerTestRunFlags flags =
|
||||
MANAGER_TEST_RUN_MINIMAL |
|
||||
MANAGER_TEST_RUN_ENV_GENERATORS |
|
||||
@ -246,7 +246,7 @@ int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run
|
||||
|
||||
log_debug("Starting manager...");
|
||||
|
||||
r = manager_startup(m, /* serialization= */ NULL, /* fds= */ NULL, root);
|
||||
r = manager_startup(m, NULL, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -278,7 +278,7 @@ int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
k = verify_unit(units[i], check_man, root);
|
||||
k = verify_unit(units[i], check_man);
|
||||
if (k < 0 && r == 0)
|
||||
r = k;
|
||||
}
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
#include "execute.h"
|
||||
#include "path-lookup.h"
|
||||
|
||||
int verify_executable(Unit *u, const ExecCommand *exec, const char *root);
|
||||
int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run_generators, const char *root);
|
||||
int verify_executable(Unit *u, const ExecCommand *exec);
|
||||
int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run_generators);
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include "locale-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "mount-util.h"
|
||||
#include "nulstr-util.h"
|
||||
#include "pager.h"
|
||||
#include "parse-argument.h"
|
||||
@ -87,15 +86,12 @@ static const char *arg_host = NULL;
|
||||
static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
|
||||
static bool arg_man = true;
|
||||
static bool arg_generators = false;
|
||||
static char *arg_root = NULL;
|
||||
static char *arg_image = NULL;
|
||||
static const char *arg_root = NULL;
|
||||
static unsigned arg_iterations = 1;
|
||||
static usec_t arg_base_time = USEC_INFINITY;
|
||||
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_dot_from_patterns, strv_freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_dot_to_patterns, strv_freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
|
||||
|
||||
typedef struct BootTimes {
|
||||
usec_t firmware_time;
|
||||
@ -2145,7 +2141,7 @@ static int do_condition(int argc, char *argv[], void *userdata) {
|
||||
}
|
||||
|
||||
static int do_verify(int argc, char *argv[], void *userdata) {
|
||||
return verify_units(strv_skip(argv, 1), arg_scope, arg_man, arg_generators, arg_root);
|
||||
return verify_units(strv_skip(argv, 1), arg_scope, arg_man, arg_generators);
|
||||
}
|
||||
|
||||
static int do_security(int argc, char *argv[], void *userdata) {
|
||||
@ -2235,7 +2231,6 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
ARG_ORDER,
|
||||
ARG_REQUIRE,
|
||||
ARG_ROOT,
|
||||
ARG_IMAGE,
|
||||
ARG_SYSTEM,
|
||||
ARG_USER,
|
||||
ARG_GLOBAL,
|
||||
@ -2255,7 +2250,6 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{ "order", no_argument, NULL, ARG_ORDER },
|
||||
{ "require", no_argument, NULL, ARG_REQUIRE },
|
||||
{ "root", required_argument, NULL, ARG_ROOT },
|
||||
{ "image", required_argument, NULL, ARG_IMAGE },
|
||||
{ "system", no_argument, NULL, ARG_SYSTEM },
|
||||
{ "user", no_argument, NULL, ARG_USER },
|
||||
{ "global", no_argument, NULL, ARG_GLOBAL },
|
||||
@ -2287,15 +2281,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_ROOT:
|
||||
r = parse_path_argument(optarg, /* suppress_root= */ true, &arg_root);
|
||||
if (r < 0)
|
||||
return r;
|
||||
break;
|
||||
|
||||
case ARG_IMAGE:
|
||||
r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_image);
|
||||
if (r < 0)
|
||||
return r;
|
||||
arg_root = optarg;
|
||||
break;
|
||||
|
||||
case ARG_SYSTEM:
|
||||
@ -2392,21 +2378,14 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Option --user is not supported for cat-config right now.");
|
||||
|
||||
if ((arg_root || arg_image) && !STRPTR_IN_SET(argv[optind], "cat-config", "verify"))
|
||||
if (arg_root && !streq_ptr(argv[optind], "cat-config"))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Options --root= and --image= are only supported for cat-config and verify right now.");
|
||||
|
||||
/* Having both an image and a root is not supported by the code */
|
||||
if (arg_root && arg_image)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Please specify either --root= or --image=, the combination of both is not supported.");
|
||||
"Option --root is only supported for cat-config right now.");
|
||||
|
||||
return 1; /* work to do */
|
||||
}
|
||||
|
||||
static int run(int argc, char *argv[]) {
|
||||
_cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL;
|
||||
_cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL;
|
||||
_cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL;
|
||||
|
||||
static const Verb verbs[] = {
|
||||
{ "help", VERB_ANY, VERB_ANY, 0, help },
|
||||
@ -2450,26 +2429,6 @@ static int run(int argc, char *argv[]) {
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
/* Open up and mount the image */
|
||||
if (arg_image) {
|
||||
assert(!arg_root);
|
||||
|
||||
r = mount_image_privately_interactively(
|
||||
arg_image,
|
||||
DISSECT_IMAGE_GENERIC_ROOT |
|
||||
DISSECT_IMAGE_RELAX_VAR_CHECK |
|
||||
DISSECT_IMAGE_READ_ONLY,
|
||||
&unlink_dir,
|
||||
&loop_device,
|
||||
&decrypted_image);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
arg_root = strdup(unlink_dir);
|
||||
if (!arg_root)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
return dispatch_verb(argc, argv, verbs, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
|
||||
static void test_verify_nonexistent(void) {
|
||||
/* Negative cases */
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/non/existent"}, NULL) == 0);
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/non/existent"}, NULL) < 0);
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/non/existent"}) == 0);
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/non/existent"}) < 0);
|
||||
|
||||
/* Ordinary cases */
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/bin/echo"}, NULL) == 0);
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/bin/echo"}, NULL) == 0);
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/bin/echo"}) == 0);
|
||||
assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/bin/echo"}) == 0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
@ -639,7 +639,7 @@ static int check_x_access(const char *path, int *ret_fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find_executable_full(const char *name, const char *root, bool use_path_envvar, char **ret_filename, int *ret_fd) {
|
||||
int find_executable_full(const char *name, bool use_path_envvar, char **ret_filename, int *ret_fd) {
|
||||
int last_error, r;
|
||||
const char *p = NULL;
|
||||
|
||||
@ -647,25 +647,6 @@ int find_executable_full(const char *name, const char *root, bool use_path_envva
|
||||
|
||||
if (is_path(name)) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
_cleanup_free_ char *path_name = NULL;
|
||||
|
||||
/* Function chase_symlinks() is invoked only when root is not NULL,
|
||||
* as using it regardless of root value would alter the behavior
|
||||
* of existing callers for example: /bin/sleep would become
|
||||
* /usr/bin/sleep when find_executables is called. Hence, this function
|
||||
* should be invoked when needed to avoid unforeseen regression or other
|
||||
* complicated changes. */
|
||||
if (root) {
|
||||
r = chase_symlinks(name,
|
||||
root,
|
||||
CHASE_PREFIX_ROOT,
|
||||
&path_name,
|
||||
/* ret_fd= */ NULL); /* prefix root to name in case full paths are not specified */
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
name = path_name;
|
||||
}
|
||||
|
||||
r = check_x_access(name, ret_fd ? &fd : NULL);
|
||||
if (r < 0)
|
||||
@ -709,23 +690,6 @@ int find_executable_full(const char *name, const char *root, bool use_path_envva
|
||||
if (!path_extend(&element, name))
|
||||
return -ENOMEM;
|
||||
|
||||
if (root) {
|
||||
char *path_name;
|
||||
|
||||
r = chase_symlinks(element,
|
||||
root,
|
||||
CHASE_PREFIX_ROOT,
|
||||
&path_name,
|
||||
/* ret_fd= */ NULL);
|
||||
if (r < 0) {
|
||||
if (r != -EACCES)
|
||||
last_error = r;
|
||||
continue;
|
||||
}
|
||||
|
||||
free_and_replace(element, path_name);
|
||||
}
|
||||
|
||||
r = check_x_access(element, ret_fd ? &fd : NULL);
|
||||
if (r < 0) {
|
||||
/* PATH entries which we don't have access to are ignored, as per tradition. */
|
||||
|
||||
@ -99,9 +99,9 @@ int path_strv_make_absolute_cwd(char **l);
|
||||
char** path_strv_resolve(char **l, const char *root);
|
||||
char** path_strv_resolve_uniq(char **l, const char *root);
|
||||
|
||||
int find_executable_full(const char *name, const char *root, bool use_path_envvar, char **ret_filename, int *ret_fd);
|
||||
int find_executable_full(const char *name, bool use_path_envvar, char **ret_filename, int *ret_fd);
|
||||
static inline int find_executable(const char *name, char **ret_filename) {
|
||||
return find_executable_full(name, /* root= */ NULL, true, ret_filename, NULL);
|
||||
return find_executable_full(name, true, ret_filename, NULL);
|
||||
}
|
||||
|
||||
bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
|
||||
|
||||
@ -4351,7 +4351,7 @@ static int exec_child(
|
||||
|
||||
_cleanup_free_ char *executable = NULL;
|
||||
_cleanup_close_ int executable_fd = -1;
|
||||
r = find_executable_full(command->path, /* root= */ NULL, false, &executable, &executable_fd);
|
||||
r = find_executable_full(command->path, false, &executable, &executable_fd);
|
||||
if (r < 0) {
|
||||
if (r != -ENOMEM && (command->flags & EXEC_COMMAND_IGNORE_FAILURE)) {
|
||||
log_unit_struct_errno(unit, LOG_INFO, r,
|
||||
|
||||
@ -2908,7 +2908,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
before_startup = now(CLOCK_MONOTONIC);
|
||||
|
||||
r = manager_startup(m, arg_serialization, fds, /* root= */ NULL);
|
||||
r = manager_startup(m, arg_serialization, fds);
|
||||
if (r < 0) {
|
||||
error_message = "Failed to start up manager";
|
||||
goto finish;
|
||||
|
||||
@ -1727,7 +1727,7 @@ void manager_reloading_stopp(Manager **m) {
|
||||
}
|
||||
}
|
||||
|
||||
int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *root) {
|
||||
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
@ -1736,7 +1736,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *roo
|
||||
* but we should not touch the real generator directories. */
|
||||
r = lookup_paths_init(&m->lookup_paths, m->unit_file_scope,
|
||||
MANAGER_IS_TEST_RUN(m) ? LOOKUP_PATHS_TEMPORARY_GENERATED : 0,
|
||||
root);
|
||||
NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to initialize path lookup table: %m");
|
||||
|
||||
|
||||
@ -470,7 +470,7 @@ int manager_new(UnitFileScope scope, ManagerTestRunFlags test_run_flags, Manager
|
||||
Manager* manager_free(Manager *m);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
|
||||
|
||||
int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *root);
|
||||
int manager_startup(Manager *m, FILE *serialization, FDSet *fds);
|
||||
|
||||
Job *manager_get_job(Manager *m, uint32_t id);
|
||||
Unit *manager_get_unit(Manager *m, const char *name);
|
||||
|
||||
@ -215,14 +215,13 @@ int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line
|
||||
}
|
||||
|
||||
int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
|
||||
_cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
struct utmpx lookup = {
|
||||
.ut_type = INIT_PROCESS /* looks for DEAD_PROCESS, LOGIN_PROCESS, USER_PROCESS, too */
|
||||
}, store, store_wtmp, *found;
|
||||
|
||||
assert(id);
|
||||
|
||||
utmpx = utxent_start();
|
||||
setutxent();
|
||||
|
||||
/* Copy the whole string if it fits, or just the suffix without the terminating NUL. */
|
||||
copy_suffix(store.ut_id, sizeof(store.ut_id), id);
|
||||
@ -340,7 +339,6 @@ int utmp_wall(
|
||||
bool (*match_tty)(const char *tty, void *userdata),
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
_cleanup_free_ char *text = NULL, *hn = NULL, *un = NULL, *stdin_tty = NULL;
|
||||
struct utmpx *u;
|
||||
int r;
|
||||
@ -369,7 +367,7 @@ int utmp_wall(
|
||||
message) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
utmpx = utxent_start();
|
||||
setutxent();
|
||||
|
||||
r = 0;
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ int main(int argc, char *argv[]) {
|
||||
/* The simple tests succeeded. Now let's try full unit-based use-case. */
|
||||
|
||||
assert_se(manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
assert_se(u = unit_new(m, sizeof(Service)));
|
||||
assert_se(unit_add_name(u, "foo.service") == 0);
|
||||
|
||||
@ -304,7 +304,7 @@ int main(int argc, char *argv[]) {
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
assert_se(manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
assert_se(test_bpf_cgroup_programs(m,
|
||||
"single_prog.service", single_prog, ELEMENTSOF(single_prog)) >= 0);
|
||||
|
||||
@ -60,7 +60,7 @@ static int test_cgroup_mask(void) {
|
||||
m->default_tasks_accounting = false;
|
||||
m->default_tasks_max = TASKS_MAX_UNSET;
|
||||
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
/* Load units and verify hierarchy. */
|
||||
assert_se(manager_load_startable_unit_or_warn(m, "parent.slice", NULL, &parent) >= 0);
|
||||
|
||||
@ -33,7 +33,7 @@ static int test_default_memory_low(void) {
|
||||
}
|
||||
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
/* dml.slice has DefaultMemoryLow=50. Beyond that, individual subhierarchies look like this:
|
||||
*
|
||||
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[]) {
|
||||
if (manager_errno_skip_test(r))
|
||||
return log_tests_skipped_errno(r, "manager_new");
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
printf("Load1:\n");
|
||||
assert_se(manager_load_startable_unit_or_warn(m, "a.service", NULL, &a) >= 0);
|
||||
|
||||
@ -844,7 +844,7 @@ static int run_tests(UnitFileScope scope, const test_entry tests[], char **patte
|
||||
if (manager_errno_skip_test(r))
|
||||
return log_tests_skipped_errno(r, "manager_new");
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
for (const test_entry *test = tests; test->f; test++)
|
||||
if (strv_fnmatch_or_empty(patterns, test->name, FNM_NOESCAPE))
|
||||
|
||||
@ -104,7 +104,7 @@ static void test_config_parse_exec(void) {
|
||||
}
|
||||
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
assert_se(u = unit_new(m, sizeof(Service)));
|
||||
|
||||
@ -448,7 +448,7 @@ static void test_config_parse_log_extra_fields(void) {
|
||||
}
|
||||
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
assert_se(u = unit_new(m, sizeof(Service)));
|
||||
|
||||
|
||||
@ -204,12 +204,12 @@ static void test_find_executable_full(void) {
|
||||
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se(find_executable_full("sh", NULL, true, &p, NULL) == 0);
|
||||
assert_se(find_executable_full("sh", true, &p, NULL) == 0);
|
||||
puts(p);
|
||||
assert_se(streq(basename(p), "sh"));
|
||||
free(p);
|
||||
|
||||
assert_se(find_executable_full("sh", NULL, false, &p, NULL) == 0);
|
||||
assert_se(find_executable_full("sh", false, &p, NULL) == 0);
|
||||
puts(p);
|
||||
assert_se(streq(basename(p), "sh"));
|
||||
free(p);
|
||||
@ -221,12 +221,12 @@ static void test_find_executable_full(void) {
|
||||
|
||||
assert_se(unsetenv("PATH") == 0);
|
||||
|
||||
assert_se(find_executable_full("sh", NULL, true, &p, NULL) == 0);
|
||||
assert_se(find_executable_full("sh", true, &p, NULL) == 0);
|
||||
puts(p);
|
||||
assert_se(streq(basename(p), "sh"));
|
||||
free(p);
|
||||
|
||||
assert_se(find_executable_full("sh", NULL, false, &p, NULL) == 0);
|
||||
assert_se(find_executable_full("sh", false, &p, NULL) == 0);
|
||||
puts(p);
|
||||
assert_se(streq(basename(p), "sh"));
|
||||
free(p);
|
||||
@ -277,7 +277,7 @@ static void test_find_executable_exec_one(const char *path) {
|
||||
pid_t pid;
|
||||
int r;
|
||||
|
||||
r = find_executable_full(path, NULL, false, &t, &fd);
|
||||
r = find_executable_full(path, false, &t, &fd);
|
||||
|
||||
log_info_errno(r, "%s: %s → %s: %d/%m", __func__, path, t ?: "-", fd);
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ static int setup_test(Manager **m) {
|
||||
if (manager_errno_skip_test(r))
|
||||
return log_tests_skipped_errno(r, "manager_new");
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(tmp, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(tmp, NULL, NULL) >= 0);
|
||||
|
||||
STRV_FOREACH(test_path, tests_path) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
@ -34,7 +34,7 @@ int main(int argc, char *argv[]) {
|
||||
if (manager_errno_skip_test(r))
|
||||
return log_tests_skipped_errno(r, "manager_new");
|
||||
assert_se(r >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
/* load idle ok */
|
||||
assert_se(manager_load_startable_unit_or_warn(m, "sched_idle_ok.service", NULL, &idle_ok) >= 0);
|
||||
|
||||
@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
assert_se(manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("2000"), STRV_MAKE("any")) >= 0);
|
||||
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("ipv6:2001-2002"), STRV_MAKE("any")) >= 0);
|
||||
|
||||
@ -27,7 +27,7 @@ int main(int argc, char *argv[]) {
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
assert_se(manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
|
||||
assert_se(manager_startup(m, NULL, NULL) >= 0);
|
||||
|
||||
assert_se(a = unit_new(m, sizeof(Service)));
|
||||
assert_se(unit_add_name(a, "a.service") >= 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user