mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-27 03:21:32 +03:00
fuzz: allow logging to be configured, disable in fuzz-unit-file
fuzz-unit-file generated too much logs about invalid config lines. This just slows things down and fills the logs. If necessary, it's better to rerun the interesting cases with SYSTEMD_LOG_LEVEL=debug.
This commit is contained in:
parent
af7bce4165
commit
b872843c4d
@ -33,6 +33,9 @@ int main(int argc, char **argv) {
|
|||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
log_set_max_level(LOG_DEBUG);
|
log_set_max_level(LOG_DEBUG);
|
||||||
|
log_parse_environment();
|
||||||
|
log_open();
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
_cleanup_free_ char *buf = NULL;
|
_cleanup_free_ char *buf = NULL;
|
||||||
|
|
||||||
@ -47,5 +50,6 @@ int main(int argc, char **argv) {
|
|||||||
(void) LLVMFuzzerTestOneInput((uint8_t*)buf, size);
|
(void) LLVMFuzzerTestOneInput((uint8_t*)buf, size);
|
||||||
printf("ok\n");
|
printf("ok\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
if (!unit_vtable[t]->load)
|
if (!unit_vtable[t]->load)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* We don't want to fill the logs with messages about parse errors.
|
||||||
|
* Disable most logging if not running standalone */
|
||||||
|
if (!getenv("SYSTEMD_LOG_LEVEL"))
|
||||||
|
log_set_max_level(LOG_CRIT);
|
||||||
|
|
||||||
assert_se(manager_new(UNIT_FILE_SYSTEM, MANAGER_TEST_RUN_MINIMAL, &m) >= 0);
|
assert_se(manager_new(UNIT_FILE_SYSTEM, MANAGER_TEST_RUN_MINIMAL, &m) >= 0);
|
||||||
|
|
||||||
name = strjoina("a.", unit_type_to_string(t));
|
name = strjoina("a.", unit_type_to_string(t));
|
||||||
|
Loading…
Reference in New Issue
Block a user