compositor: add --no-config command line option
Useful for unit tests. If Weston finds a weston.ini during unit tests, it will load it and all the modules it asks for. We need a way to prevent loading arbitrary modules from the command line. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Kristian Høgsberg
parent
24713f679b
commit
588bee10de
@@ -130,6 +130,12 @@ suite. The file is searched for in
|
|||||||
.IR "__weston_modules_dir__" ,
|
.IR "__weston_modules_dir__" ,
|
||||||
or you can pass an absolute path.
|
or you can pass an absolute path.
|
||||||
.TP
|
.TP
|
||||||
|
.BR \-\-no-config
|
||||||
|
Do not read
|
||||||
|
.I weston.ini
|
||||||
|
for the compositor. Avoids e.g. loading compositor modules via the
|
||||||
|
configuration file, which is useful for unit tests.
|
||||||
|
.TP
|
||||||
\fB\-\^S\fR\fIname\fR, \fB\-\-socket\fR=\fIname\fR
|
\fB\-\^S\fR\fIname\fR, \fB\-\-socket\fR=\fIname\fR
|
||||||
Weston will listen in the Wayland socket called
|
Weston will listen in the Wayland socket called
|
||||||
.IR name .
|
.IR name .
|
||||||
|
|||||||
+5
-1
@@ -4042,6 +4042,7 @@ usage(int error_code)
|
|||||||
" -i, --idle-time=SECS\tIdle time in seconds\n"
|
" -i, --idle-time=SECS\tIdle time in seconds\n"
|
||||||
" --modules\t\tLoad the comma-separated list of modules\n"
|
" --modules\t\tLoad the comma-separated list of modules\n"
|
||||||
" --log==FILE\t\tLog to the given file\n"
|
" --log==FILE\t\tLog to the given file\n"
|
||||||
|
" --no-config\t\tDo not read weston.ini\n"
|
||||||
" -h, --help\t\tThis help message\n\n");
|
" -h, --help\t\tThis help message\n\n");
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -4152,7 +4153,8 @@ int main(int argc, char *argv[])
|
|||||||
int32_t help = 0;
|
int32_t help = 0;
|
||||||
char *socket_name = "wayland-0";
|
char *socket_name = "wayland-0";
|
||||||
int32_t version = 0;
|
int32_t version = 0;
|
||||||
struct weston_config *config;
|
int32_t noconfig = 0;
|
||||||
|
struct weston_config *config = NULL;
|
||||||
struct weston_config_section *section;
|
struct weston_config_section *section;
|
||||||
struct wl_client *primary_client;
|
struct wl_client *primary_client;
|
||||||
struct wl_listener primary_client_destroyed;
|
struct wl_listener primary_client_destroyed;
|
||||||
@@ -4166,6 +4168,7 @@ int main(int argc, char *argv[])
|
|||||||
{ WESTON_OPTION_STRING, "log", 0, &log },
|
{ WESTON_OPTION_STRING, "log", 0, &log },
|
||||||
{ WESTON_OPTION_BOOLEAN, "help", 'h', &help },
|
{ WESTON_OPTION_BOOLEAN, "help", 'h', &help },
|
||||||
{ WESTON_OPTION_BOOLEAN, "version", 0, &version },
|
{ WESTON_OPTION_BOOLEAN, "version", 0, &version },
|
||||||
|
{ WESTON_OPTION_BOOLEAN, "no-config", 0, &noconfig },
|
||||||
};
|
};
|
||||||
|
|
||||||
parse_options(core_options, ARRAY_LENGTH(core_options), &argc, argv);
|
parse_options(core_options, ARRAY_LENGTH(core_options), &argc, argv);
|
||||||
@@ -4204,6 +4207,7 @@ int main(int argc, char *argv[])
|
|||||||
signals[3] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler,
|
signals[3] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
if (noconfig == 0)
|
||||||
config = weston_config_parse("weston.ini");
|
config = weston_config_parse("weston.ini");
|
||||||
if (config != NULL) {
|
if (config != NULL) {
|
||||||
weston_log("Using config file '%s'\n",
|
weston_log("Using config file '%s'\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user