tests: centralize check for slow tests
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user