tests: centralize check for slow tests

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-09-13 12:07:27 +02:00
parent c633b0a642
commit 0cf29baac0
5 changed files with 28 additions and 23 deletions
+13
View File
@@ -7,6 +7,7 @@
#include <util.h>
#include "alloc-util.h"
#include "env-util.h"
#include "fileio.h"
#include "path-util.h"
#include "strv.h"
@@ -76,3 +77,15 @@ const char* get_catalog_dir(void) {
}
return env;
}
bool slow_tests_enabled(void) {
int r;
r = getenv_bool("SYSTEMD_SLOW_TESTS");
if (r >= 0)
return r;
if (r != -ENXIO)
log_warning_errno(r, "Cannot parse $SYSTEMD_SLOW_TESTS, ignoring.");
return SYSTEMD_SLOW_TESTS_DEFAULT;
}
+1
View File
@@ -4,3 +4,4 @@
char* setup_fake_runtime_dir(void);
const char* get_testdata_dir(void);
const char* get_catalog_dir(void);
bool slow_tests_enabled(void);