mirror of
https://github.com/systemd/systemd
synced 2025-09-29 16:54:46 +02:00
Compare commits
15 Commits
37baf8db56
...
9a4fce2efc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9a4fce2efc | ||
![]() |
816f31d018 | ||
![]() |
4095cff07e | ||
![]() |
e3c368f63c | ||
![]() |
4c890ad3cc | ||
![]() |
e798ffef82 | ||
![]() |
fe96c0f86d | ||
![]() |
59b8cb3c45 | ||
![]() |
b3e4340664 | ||
![]() |
232add5c47 | ||
![]() |
8fa038085e | ||
![]() |
12d31e4ea5 | ||
![]() |
42f3b48c97 | ||
![]() |
1918406900 | ||
![]() |
4326586be2 |
@ -41,10 +41,10 @@ available functionality:
|
|||||||
symbols of `libsystemd.so` and `libudev.so` with the list of man pages. Symbols
|
symbols of `libsystemd.so` and `libudev.so` with the list of man pages. Symbols
|
||||||
lacking documentation are highlighted.
|
lacking documentation are highlighted.
|
||||||
|
|
||||||
7. Use `meson compile -C build hwdb-update` to automatically download and import the
|
7. Use `meson compile -C build update-hwdb` to automatically download and import the
|
||||||
PCI, USB and OUI databases into hwdb.
|
PCI, USB and OUI databases into hwdb.
|
||||||
|
|
||||||
8. Use `meson compile -C build man/update-man-rules` to update the meson rules for
|
8. Use `meson compile -C build update-man-rules` to update the meson rules for
|
||||||
building man pages automatically from the docbook XML files included in
|
building man pages automatically from the docbook XML files included in
|
||||||
`man/`.
|
`man/`.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ layout: default
|
|||||||
2. Update the contributors list in NEWS (`meson compile -C build git-contrib`)
|
2. Update the contributors list in NEWS (`meson compile -C build git-contrib`)
|
||||||
3. Update the time and place in NEWS
|
3. Update the time and place in NEWS
|
||||||
4. [RC1] Update version and library numbers in `meson.build`
|
4. [RC1] Update version and library numbers in `meson.build`
|
||||||
5. Check dbus docs with `meson compile -C build man/update-dbus-docs`
|
5. Check dbus docs with `meson compile -C build update-dbus-docs`
|
||||||
6. Tag the release: `version=vXXX-rcY && git tag -s "${version}" -m "systemd ${version}"`
|
6. Tag the release: `version=vXXX-rcY && git tag -s "${version}" -m "systemd ${version}"`
|
||||||
7. Do `meson compile -C build`
|
7. Do `meson compile -C build`
|
||||||
8. Make sure that the version string and package string match: `build/systemctl --version`
|
8. Make sure that the version string and package string match: `build/systemctl --version`
|
||||||
|
@ -66,9 +66,9 @@ endif
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
run_target(
|
run_target(
|
||||||
'hwdb-update',
|
'update-hwdb',
|
||||||
command : [hwdb_update_sh, meson.current_source_dir()])
|
command : [update_hwdb_sh, meson.current_source_dir()])
|
||||||
|
|
||||||
run_target(
|
run_target(
|
||||||
'autosuspend-update',
|
'update-hwdb-autosuspend',
|
||||||
command : [autosuspend_update_sh, project_source_root])
|
command : [update_hwdb_autosuspend_sh, project_source_root])
|
||||||
|
@ -6,7 +6,7 @@ if [ -z "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make sure the rules have been regenerated (in case man/update-man-rules was just run)
|
# make sure the rules have been regenerated (in case update-man-rules was just run)
|
||||||
ninja -C "@BUILD_ROOT@" version.h
|
ninja -C "@BUILD_ROOT@" version.h
|
||||||
|
|
||||||
target="man/$1.html"
|
target="man/$1.html"
|
||||||
|
@ -6,7 +6,7 @@ if [ -z "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make sure the rules have been regenerated (in case man/update-man-rules was just run)
|
# make sure the rules have been regenerated (in case update-man-rules was just run)
|
||||||
ninja -C "@BUILD_ROOT@" version.h
|
ninja -C "@BUILD_ROOT@" version.h
|
||||||
|
|
||||||
page="$(echo "$1" | sed 's/\./\\./')"
|
page="$(echo "$1" | sed 's/\./\\./')"
|
||||||
|
@ -198,36 +198,6 @@ run_target(
|
|||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
if dbus_docs.length() > 0
|
|
||||||
custom_target(
|
|
||||||
'update-dbus-docs',
|
|
||||||
output : 'update-dbus-docs',
|
|
||||||
command : [update_dbus_docs_py,
|
|
||||||
'--build-dir=@0@'.format(project_build_root),
|
|
||||||
'@INPUT@'],
|
|
||||||
input : dbus_docs)
|
|
||||||
|
|
||||||
if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
|
|
||||||
test('dbus-docs-fresh',
|
|
||||||
update_dbus_docs_py,
|
|
||||||
args : ['--build-dir=@0@'.format(project_build_root),
|
|
||||||
'--test'] + dbus_docs)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
custom_target(
|
|
||||||
'update-man-rules',
|
|
||||||
output : 'update-man-rules',
|
|
||||||
command : ['sh', '-c',
|
|
||||||
'cd @0@ && '.format(meson.build_root()) +
|
|
||||||
'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
|
|
||||||
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
|
|
||||||
depend_files : custom_entities_ent)
|
|
||||||
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input : 'man.in',
|
input : 'man.in',
|
||||||
output : 'man',
|
output : 'man',
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Do not edit. Generated by update-man-rules.py.
|
# Do not edit. Generated by update-man-rules.py.
|
||||||
# Update with:
|
# Update with:
|
||||||
# ninja -C build man/update-man-rules
|
# ninja -C build update-man-rules
|
||||||
manpages = [
|
manpages = [
|
||||||
['binfmt.d', '5', [], 'ENABLE_BINFMT'],
|
['binfmt.d', '5', [], 'ENABLE_BINFMT'],
|
||||||
['bootctl', '1', [], 'ENABLE_EFI'],
|
['bootctl', '1', [], 'ENABLE_EFI'],
|
||||||
|
32
meson.build
32
meson.build
@ -1589,8 +1589,8 @@ conf.set10('ENABLE_EFI', have)
|
|||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
autosuspend_update_sh = find_program('tools/autosuspend-update.sh')
|
update_hwdb_sh = find_program('tools/update-hwdb.sh')
|
||||||
hwdb_update_sh = find_program('tools/hwdb-update.sh')
|
update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
|
||||||
make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
|
make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
|
||||||
make_directive_index_py = find_program('tools/make-directive-index.py')
|
make_directive_index_py = find_program('tools/make-directive-index.py')
|
||||||
make_man_index_py = find_program('tools/make-man-index.py')
|
make_man_index_py = find_program('tools/make-man-index.py')
|
||||||
@ -3605,6 +3605,34 @@ run_target(
|
|||||||
depends : [man, libsystemd, libudev],
|
depends : [man, libsystemd, libudev],
|
||||||
command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
|
command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
if dbus_docs.length() > 0
|
||||||
|
custom_target(
|
||||||
|
'update-dbus-docs',
|
||||||
|
output : 'update-dbus-docs',
|
||||||
|
command : [update_dbus_docs_py,
|
||||||
|
'--build-dir=@0@'.format(project_build_root),
|
||||||
|
'@INPUT@'],
|
||||||
|
input : dbus_docs)
|
||||||
|
|
||||||
|
if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
|
||||||
|
test('dbus-docs-fresh',
|
||||||
|
update_dbus_docs_py,
|
||||||
|
args : ['--build-dir=@0@'.format(project_build_root),
|
||||||
|
'--test'] + dbus_docs)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
custom_target(
|
||||||
|
'update-man-rules',
|
||||||
|
output : 'update-man-rules',
|
||||||
|
command : ['sh', '-c',
|
||||||
|
'cd @0@ && '.format(meson.build_root()) +
|
||||||
|
'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
|
||||||
|
'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())],
|
||||||
|
depend_files : custom_entities_ent)
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
|
watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
|
||||||
|
|
||||||
|
@ -1131,8 +1131,8 @@ static const char *skip_slices(const char *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cg_path_get_unit(const char *path, char **ret) {
|
int cg_path_get_unit(const char *path, char **ret) {
|
||||||
|
_cleanup_free_ char *unit = NULL;
|
||||||
const char *e;
|
const char *e;
|
||||||
char *unit;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(path);
|
assert(path);
|
||||||
@ -1145,12 +1145,10 @@ int cg_path_get_unit(const char *path, char **ret) {
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* We skipped over the slices, don't accept any now */
|
/* We skipped over the slices, don't accept any now */
|
||||||
if (endswith(unit, ".slice")) {
|
if (endswith(unit, ".slice"))
|
||||||
free(unit);
|
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
|
||||||
|
|
||||||
*ret = unit;
|
*ret = TAKE_PTR(unit);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,11 +91,9 @@ void safe_close_pair(int p[static 2]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void close_many(const int fds[], size_t n_fd) {
|
void close_many(const int fds[], size_t n_fd) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(fds || n_fd <= 0);
|
assert(fds || n_fd <= 0);
|
||||||
|
|
||||||
for (i = 0; i < n_fd; i++)
|
for (size_t i = 0; i < n_fd; i++)
|
||||||
safe_close(fds[i]);
|
safe_close(fds[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +177,9 @@ int fd_cloexec(int fd, bool cloexec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) {
|
_pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(n_fdset == 0 || fdset);
|
assert(n_fdset == 0 || fdset);
|
||||||
|
|
||||||
for (i = 0; i < n_fdset; i++)
|
for (size_t i = 0; i < n_fdset; i++)
|
||||||
if (fdset[i] == fd)
|
if (fdset[i] == fd)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) {
|
|||||||
{ "K", UINT64_C(1000) },
|
{ "K", UINT64_C(1000) },
|
||||||
};
|
};
|
||||||
const suffix_table *table;
|
const suffix_table *table;
|
||||||
size_t n, i;
|
size_t n;
|
||||||
|
|
||||||
assert_cc(ELEMENTSOF(table_iec) == ELEMENTSOF(table_si));
|
assert_cc(ELEMENTSOF(table_iec) == ELEMENTSOF(table_si));
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) {
|
|||||||
table = flag & FORMAT_BYTES_USE_IEC ? table_iec : table_si;
|
table = flag & FORMAT_BYTES_USE_IEC ? table_iec : table_si;
|
||||||
n = ELEMENTSOF(table_iec);
|
n = ELEMENTSOF(table_iec);
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (size_t i = 0; i < n; i++)
|
||||||
if (t >= table[i].factor) {
|
if (t >= table[i].factor) {
|
||||||
if (flag & FORMAT_BYTES_BELOW_POINT) {
|
if (flag & FORMAT_BYTES_BELOW_POINT) {
|
||||||
snprintf(buf, l,
|
snprintf(buf, l,
|
||||||
|
@ -319,16 +319,14 @@ int iovw_put_string_field_free(struct iovec_wrapper *iovw, const char *field, ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new) {
|
void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new) {
|
||||||
size_t i;
|
for (size_t i = 0; i < iovw->count; i++)
|
||||||
|
|
||||||
for (i = 0; i < iovw->count; i++)
|
|
||||||
iovw->iovec[i].iov_base = (char *)iovw->iovec[i].iov_base - old + new;
|
iovw->iovec[i].iov_base = (char *)iovw->iovec[i].iov_base - old + new;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t iovw_size(struct iovec_wrapper *iovw) {
|
size_t iovw_size(struct iovec_wrapper *iovw) {
|
||||||
size_t n = 0, i;
|
size_t n = 0;
|
||||||
|
|
||||||
for (i = 0; i < iovw->count; i++)
|
for (size_t i = 0; i < iovw->count; i++)
|
||||||
n += iovw->iovec[i].iov_len;
|
n += iovw->iovec[i].iov_len;
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
@ -593,14 +593,13 @@ int safe_atod(const char *s, double *ret_d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int parse_fractional_part_u(const char **p, size_t digits, unsigned *res) {
|
int parse_fractional_part_u(const char **p, size_t digits, unsigned *res) {
|
||||||
size_t i;
|
|
||||||
unsigned val = 0;
|
unsigned val = 0;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
s = *p;
|
s = *p;
|
||||||
|
|
||||||
/* accept any number of digits, strtoull is limited to 19 */
|
/* accept any number of digits, strtoull is limited to 19 */
|
||||||
for (i=0; i < digits; i++,s++) {
|
for (size_t i = 0; i < digits; i++,s++) {
|
||||||
if (*s < '0' || *s > '9') {
|
if (*s < '0' || *s > '9') {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -50,13 +50,13 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setrlimit_closest_all(const struct rlimit *const *rlim, int *which_failed) {
|
int setrlimit_closest_all(const struct rlimit *const *rlim, int *which_failed) {
|
||||||
int i, r;
|
int r;
|
||||||
|
|
||||||
assert(rlim);
|
assert(rlim);
|
||||||
|
|
||||||
/* On failure returns the limit's index that failed in *which_failed, but only if non-NULL */
|
/* On failure returns the limit's index that failed in *which_failed, but only if non-NULL */
|
||||||
|
|
||||||
for (i = 0; i < _RLIMIT_MAX; i++) {
|
for (int i = 0; i < _RLIMIT_MAX; i++) {
|
||||||
if (!rlim[i])
|
if (!rlim[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -23,12 +23,10 @@ static void* volatile sigbus_queue[SIGBUS_QUEUE_MAX];
|
|||||||
static volatile sig_atomic_t n_sigbus_queue = 0;
|
static volatile sig_atomic_t n_sigbus_queue = 0;
|
||||||
|
|
||||||
static void sigbus_push(void *addr) {
|
static void sigbus_push(void *addr) {
|
||||||
unsigned u;
|
|
||||||
|
|
||||||
assert(addr);
|
assert(addr);
|
||||||
|
|
||||||
/* Find a free place, increase the number of entries and leave, if we can */
|
/* Find a free place, increase the number of entries and leave, if we can */
|
||||||
for (u = 0; u < SIGBUS_QUEUE_MAX; u++)
|
for (size_t u = 0; u < SIGBUS_QUEUE_MAX; u++)
|
||||||
if (__sync_bool_compare_and_swap(&sigbus_queue[u], NULL, addr)) {
|
if (__sync_bool_compare_and_swap(&sigbus_queue[u], NULL, addr)) {
|
||||||
__sync_fetch_and_add(&n_sigbus_queue, 1);
|
__sync_fetch_and_add(&n_sigbus_queue, 1);
|
||||||
return;
|
return;
|
||||||
|
@ -15,9 +15,9 @@ int reset_all_signal_handlers(void) {
|
|||||||
.sa_handler = SIG_DFL,
|
.sa_handler = SIG_DFL,
|
||||||
.sa_flags = SA_RESTART,
|
.sa_flags = SA_RESTART,
|
||||||
};
|
};
|
||||||
int sig, r = 0;
|
int r = 0;
|
||||||
|
|
||||||
for (sig = 1; sig < _NSIG; sig++) {
|
for (int sig = 1; sig < _NSIG; sig++) {
|
||||||
|
|
||||||
/* These two cannot be caught... */
|
/* These two cannot be caught... */
|
||||||
if (IN_SET(sig, SIGKILL, SIGSTOP))
|
if (IN_SET(sig, SIGKILL, SIGSTOP))
|
||||||
|
@ -862,9 +862,8 @@ char *strextend_with_separator_internal(char **x, const char *separator, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *strrep(const char *s, unsigned n) {
|
char *strrep(const char *s, unsigned n) {
|
||||||
size_t l;
|
|
||||||
char *r, *p;
|
char *r, *p;
|
||||||
unsigned i;
|
size_t l;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
@ -873,7 +872,7 @@ char *strrep(const char *s, unsigned n) {
|
|||||||
if (!r)
|
if (!r)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (unsigned i = 0; i < n; i++)
|
||||||
p = stpcpy(p, s);
|
p = stpcpy(p, s);
|
||||||
|
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
@ -493,7 +493,6 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
|
|||||||
{ "us", 1 },
|
{ "us", 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t i;
|
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
bool something = false;
|
bool something = false;
|
||||||
|
|
||||||
@ -514,7 +513,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
|
|||||||
|
|
||||||
/* The result of this function can be parsed with parse_sec */
|
/* The result of this function can be parsed with parse_sec */
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(table); i++) {
|
for (size_t i = 0; i < ELEMENTSOF(table); i++) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
size_t n;
|
size_t n;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
@ -962,9 +961,8 @@ static const char* extract_multiplier(const char *p, usec_t *multiplier) {
|
|||||||
{ "us", 1ULL },
|
{ "us", 1ULL },
|
||||||
{ "µs", 1ULL },
|
{ "µs", 1ULL },
|
||||||
};
|
};
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(table); i++) {
|
for (size_t i = 0; i < ELEMENTSOF(table); i++) {
|
||||||
char *e;
|
char *e;
|
||||||
|
|
||||||
e = startswith(p, table[i].suffix);
|
e = startswith(p, table[i].suffix);
|
||||||
|
@ -132,7 +132,6 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
|
|||||||
const char *fn;
|
const char *fn;
|
||||||
char *t, *x;
|
char *t, *x;
|
||||||
uint64_t u;
|
uint64_t u;
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
|
|||||||
x = stpcpy(stpcpy(stpcpy(mempcpy(t, p, fn - p), ".#"), extra), fn);
|
x = stpcpy(stpcpy(stpcpy(mempcpy(t, p, fn - p), ".#"), extra), fn);
|
||||||
|
|
||||||
u = random_u64();
|
u = random_u64();
|
||||||
for (i = 0; i < 16; i++) {
|
for (unsigned i = 0; i < 16; i++) {
|
||||||
*(x++) = hexchar(u & 0xF);
|
*(x++) = hexchar(u & 0xF);
|
||||||
u >>= 4;
|
u >>= 4;
|
||||||
}
|
}
|
||||||
@ -176,7 +175,6 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
|
|||||||
int tempfn_random_child(const char *p, const char *extra, char **ret) {
|
int tempfn_random_child(const char *p, const char *extra, char **ret) {
|
||||||
char *t, *x;
|
char *t, *x;
|
||||||
uint64_t u;
|
uint64_t u;
|
||||||
unsigned i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
@ -205,7 +203,7 @@ int tempfn_random_child(const char *p, const char *extra, char **ret) {
|
|||||||
x = stpcpy(stpcpy(stpcpy(t, p), "/.#"), extra);
|
x = stpcpy(stpcpy(stpcpy(t, p), "/.#"), extra);
|
||||||
|
|
||||||
u = random_u64();
|
u = random_u64();
|
||||||
for (i = 0; i < 16; i++) {
|
for (unsigned i = 0; i < 16; i++) {
|
||||||
*(x++) = hexchar(u & 0xF);
|
*(x++) = hexchar(u & 0xF);
|
||||||
u >>= 4;
|
u >>= 4;
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,6 @@ static const char * const rlmap_initrd[] = {
|
|||||||
|
|
||||||
const char* runlevel_to_target(const char *word) {
|
const char* runlevel_to_target(const char *word) {
|
||||||
const char * const *rlmap_ptr;
|
const char * const *rlmap_ptr;
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (!word)
|
if (!word)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -593,7 +592,7 @@ const char* runlevel_to_target(const char *word) {
|
|||||||
|
|
||||||
rlmap_ptr = in_initrd() ? rlmap_initrd : rlmap;
|
rlmap_ptr = in_initrd() ? rlmap_initrd : rlmap;
|
||||||
|
|
||||||
for (i = 0; rlmap_ptr[i]; i += 2)
|
for (size_t i = 0; rlmap_ptr[i]; i += 2)
|
||||||
if (streq(word, rlmap_ptr[i]))
|
if (streq(word, rlmap_ptr[i]))
|
||||||
return rlmap_ptr[i+1];
|
return rlmap_ptr[i+1];
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ static size_t utf8_encoded_expected_len(uint8_t c) {
|
|||||||
/* decode one unicode char */
|
/* decode one unicode char */
|
||||||
int utf8_encoded_to_unichar(const char *str, char32_t *ret_unichar) {
|
int utf8_encoded_to_unichar(const char *str, char32_t *ret_unichar) {
|
||||||
char32_t unichar;
|
char32_t unichar;
|
||||||
size_t len, i;
|
size_t len;
|
||||||
|
|
||||||
assert(str);
|
assert(str);
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ int utf8_encoded_to_unichar(const char *str, char32_t *ret_unichar) {
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < len; i++) {
|
for (size_t i = 1; i < len; i++) {
|
||||||
if (((char32_t)str[i] & 0xc0) != 0x80)
|
if (((char32_t)str[i] & 0xc0) != 0x80)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -302,14 +302,12 @@ char *ascii_is_valid(const char *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *ascii_is_valid_n(const char *str, size_t len) {
|
char *ascii_is_valid_n(const char *str, size_t len) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* Very similar to ascii_is_valid(), but checks exactly len
|
/* Very similar to ascii_is_valid(), but checks exactly len
|
||||||
* bytes and rejects any NULs in that range. */
|
* bytes and rejects any NULs in that range. */
|
||||||
|
|
||||||
assert(str);
|
assert(str);
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (size_t i = 0; i < len; i++)
|
||||||
if ((unsigned char) str[i] >= 128 || str[i] == 0)
|
if ((unsigned char) str[i] >= 128 || str[i] == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -436,7 +434,6 @@ size_t utf16_encode_unichar(char16_t *out, char32_t c) {
|
|||||||
|
|
||||||
char16_t *utf8_to_utf16(const char *s, size_t length) {
|
char16_t *utf8_to_utf16(const char *s, size_t length) {
|
||||||
char16_t *n, *p;
|
char16_t *n, *p;
|
||||||
size_t i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
@ -447,7 +444,7 @@ char16_t *utf8_to_utf16(const char *s, size_t length) {
|
|||||||
|
|
||||||
p = n;
|
p = n;
|
||||||
|
|
||||||
for (i = 0; i < length;) {
|
for (size_t i = 0; i < length;) {
|
||||||
char32_t unichar;
|
char32_t unichar;
|
||||||
size_t e;
|
size_t e;
|
||||||
|
|
||||||
@ -505,7 +502,7 @@ static int utf8_unichar_to_encoded_len(char32_t unichar) {
|
|||||||
/* validate one encoded unicode char and return its length */
|
/* validate one encoded unicode char and return its length */
|
||||||
int utf8_encoded_valid_unichar(const char *str, size_t length /* bytes */) {
|
int utf8_encoded_valid_unichar(const char *str, size_t length /* bytes */) {
|
||||||
char32_t unichar;
|
char32_t unichar;
|
||||||
size_t len, i;
|
size_t len;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(str);
|
assert(str);
|
||||||
@ -526,7 +523,7 @@ int utf8_encoded_valid_unichar(const char *str, size_t length /* bytes */) {
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* check if expected encoded chars are available */
|
/* check if expected encoded chars are available */
|
||||||
for (i = 0; i < len; i++)
|
for (size_t i = 0; i < len; i++)
|
||||||
if ((str[i] & 0x80) != 0x80)
|
if ((str[i] & 0x80) != 0x80)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -159,10 +159,9 @@ static int detect_vm_dmi(void) {
|
|||||||
/* https://wiki.freebsd.org/bhyve */
|
/* https://wiki.freebsd.org/bhyve */
|
||||||
{ "BHYVE", VIRTUALIZATION_BHYVE },
|
{ "BHYVE", VIRTUALIZATION_BHYVE },
|
||||||
};
|
};
|
||||||
unsigned i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(dmi_vendors); i++) {
|
for (size_t i = 0; i < ELEMENTSOF(dmi_vendors); i++) {
|
||||||
_cleanup_free_ char *s = NULL;
|
_cleanup_free_ char *s = NULL;
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ static int property_get_cgroup_mask(
|
|||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
|
||||||
CGroupMask *mask = userdata;
|
CGroupMask *mask = userdata;
|
||||||
CGroupController ctrl;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(bus);
|
assert(bus);
|
||||||
@ -42,7 +41,7 @@ static int property_get_cgroup_mask(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
for (ctrl = 0; ctrl < _CGROUP_CONTROLLER_MAX; ctrl++) {
|
for (CGroupController ctrl = 0; ctrl < _CGROUP_CONTROLLER_MAX; ctrl++) {
|
||||||
if ((*mask & CGROUP_CONTROLLER_TO_MASK(ctrl)) == 0)
|
if ((*mask & CGROUP_CONTROLLER_TO_MASK(ctrl)) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -698,7 +698,6 @@ static int property_get_bind_paths(
|
|||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
|
||||||
ExecContext *c = userdata;
|
ExecContext *c = userdata;
|
||||||
unsigned i;
|
|
||||||
bool ro;
|
bool ro;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -713,7 +712,7 @@ static int property_get_bind_paths(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
for (i = 0; i < c->n_bind_mounts; i++) {
|
for (size_t i = 0; i < c->n_bind_mounts; i++) {
|
||||||
|
|
||||||
if (ro != c->bind_mounts[i].read_only)
|
if (ro != c->bind_mounts[i].read_only)
|
||||||
continue;
|
continue;
|
||||||
@ -741,7 +740,6 @@ static int property_get_temporary_filesystems(
|
|||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
|
||||||
ExecContext *c = userdata;
|
ExecContext *c = userdata;
|
||||||
unsigned i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(bus);
|
assert(bus);
|
||||||
@ -753,7 +751,7 @@ static int property_get_temporary_filesystems(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
for (i = 0; i < c->n_temporary_filesystems; i++) {
|
for (unsigned i = 0; i < c->n_temporary_filesystems; i++) {
|
||||||
TemporaryFileSystem *t = c->temporary_filesystems + i;
|
TemporaryFileSystem *t = c->temporary_filesystems + i;
|
||||||
|
|
||||||
r = sd_bus_message_append(
|
r = sd_bus_message_append(
|
||||||
@ -777,7 +775,6 @@ static int property_get_log_extra_fields(
|
|||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
|
||||||
ExecContext *c = userdata;
|
ExecContext *c = userdata;
|
||||||
size_t i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(bus);
|
assert(bus);
|
||||||
@ -789,7 +786,7 @@ static int property_get_log_extra_fields(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
for (i = 0; i < c->n_log_extra_fields; i++) {
|
for (size_t i = 0; i < c->n_log_extra_fields; i++) {
|
||||||
r = sd_bus_message_append_array(reply, 'y', c->log_extra_fields[i].iov_base, c->log_extra_fields[i].iov_len);
|
r = sd_bus_message_append_array(reply, 'y', c->log_extra_fields[i].iov_base, c->log_extra_fields[i].iov_len);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -71,7 +71,7 @@ int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_
|
|||||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||||
_cleanup_free_ Job **list = NULL;
|
_cleanup_free_ Job **list = NULL;
|
||||||
Job *j = userdata;
|
Job *j = userdata;
|
||||||
int r, i, n;
|
int r, n;
|
||||||
|
|
||||||
if (strstr(sd_bus_message_get_member(message), "After"))
|
if (strstr(sd_bus_message_get_member(message), "After"))
|
||||||
n = job_get_after(j, &list);
|
n = job_get_after(j, &list);
|
||||||
@ -88,7 +88,7 @@ int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
for (i = 0; i < n; i ++) {
|
for (int i = 0; i < n; i ++) {
|
||||||
_cleanup_free_ char *unit_path = NULL, *job_path = NULL;
|
_cleanup_free_ char *unit_path = NULL, *job_path = NULL;
|
||||||
|
|
||||||
job_path = job_dbus_path(list[i]);
|
job_path = job_dbus_path(list[i]);
|
||||||
|
@ -1951,10 +1951,9 @@ static int install_error(
|
|||||||
UnitFileChange *changes,
|
UnitFileChange *changes,
|
||||||
size_t n_changes) {
|
size_t n_changes) {
|
||||||
|
|
||||||
size_t i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
for (i = 0; i < n_changes; i++)
|
for (size_t i = 0; i < n_changes; i++)
|
||||||
|
|
||||||
switch(changes[i].type) {
|
switch(changes[i].type) {
|
||||||
|
|
||||||
@ -2021,7 +2020,6 @@ static int reply_unit_file_changes_and_free(
|
|||||||
|
|
||||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||||
bool bad = false, good = false;
|
bool bad = false, good = false;
|
||||||
size_t i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (unit_file_changes_have_modification(changes, n_changes)) {
|
if (unit_file_changes_have_modification(changes, n_changes)) {
|
||||||
@ -2044,7 +2042,7 @@ static int reply_unit_file_changes_and_free(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
for (i = 0; i < n_changes; i++) {
|
for (size_t i = 0; i < n_changes; i++) {
|
||||||
|
|
||||||
if (changes[i].type < 0) {
|
if (changes[i].type < 0) {
|
||||||
bad = true;
|
bad = true;
|
||||||
|
@ -193,11 +193,10 @@ static const struct {
|
|||||||
|
|
||||||
static int device_found_to_string_many(DeviceFound flags, char **ret) {
|
static int device_found_to_string_many(DeviceFound flags, char **ret) {
|
||||||
_cleanup_free_ char *s = NULL;
|
_cleanup_free_ char *s = NULL;
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(device_found_map); i++) {
|
for (size_t i = 0; i < ELEMENTSOF(device_found_map); i++) {
|
||||||
if (!FLAGS_SET(flags, device_found_map[i].flag))
|
if (!FLAGS_SET(flags, device_found_map[i].flag))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -4911,9 +4911,7 @@ static void exec_command_done(ExecCommand *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void exec_command_done_array(ExecCommand *c, size_t n) {
|
void exec_command_done_array(ExecCommand *c, size_t n) {
|
||||||
size_t i;
|
for (size_t i = 0; i < n; i++)
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
exec_command_done(c+i);
|
exec_command_done(c+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,11 +312,9 @@ static int append_empty_dir_mounts(MountEntry **p, char **strv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int append_bind_mounts(MountEntry **p, const BindMount *binds, size_t n) {
|
static int append_bind_mounts(MountEntry **p, const BindMount *binds, size_t n) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
const BindMount *b = binds + i;
|
const BindMount *b = binds + i;
|
||||||
|
|
||||||
*((*p)++) = (MountEntry) {
|
*((*p)++) = (MountEntry) {
|
||||||
@ -390,14 +388,12 @@ static int append_tmpfs_mounts(MountEntry **p, const TemporaryFileSystem *tmpfs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int append_static_mounts(MountEntry **p, const MountEntry *mounts, size_t n, bool ignore_protect) {
|
static int append_static_mounts(MountEntry **p, const MountEntry *mounts, size_t n, bool ignore_protect) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
assert(mounts);
|
assert(mounts);
|
||||||
|
|
||||||
/* Adds a list of static pre-defined entries */
|
/* Adds a list of static pre-defined entries */
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (size_t i = 0; i < n; i++)
|
||||||
*((*p)++) = (MountEntry) {
|
*((*p)++) = (MountEntry) {
|
||||||
.path_const = mount_entry_path(mounts+i),
|
.path_const = mount_entry_path(mounts+i),
|
||||||
.mode = mounts[i].mode,
|
.mode = mounts[i].mode,
|
||||||
@ -464,11 +460,11 @@ static int mount_path_compare(const MountEntry *a, const MountEntry *b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int prefix_where_needed(MountEntry *m, size_t n, const char *root_directory) {
|
static int prefix_where_needed(MountEntry *m, size_t n, const char *root_directory) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* Prefixes all paths in the bind mount table with the root directory if the entry needs that. */
|
/* Prefixes all paths in the bind mount table with the root directory if the entry needs that. */
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
assert(m || n == 0);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < n; i++) {
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (m[i].has_prefix)
|
if (m[i].has_prefix)
|
||||||
@ -1913,11 +1909,9 @@ finish:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bind_mount_free_many(BindMount *b, size_t n) {
|
void bind_mount_free_many(BindMount *b, size_t n) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(b || n == 0);
|
assert(b || n == 0);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
free(b[i].source);
|
free(b[i].source);
|
||||||
free(b[i].destination);
|
free(b[i].destination);
|
||||||
}
|
}
|
||||||
@ -1960,12 +1954,10 @@ int bind_mount_add(BindMount **b, size_t *n, const BindMount *item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MountImage* mount_image_free_many(MountImage *m, size_t *n) {
|
MountImage* mount_image_free_many(MountImage *m, size_t *n) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(n);
|
assert(n);
|
||||||
assert(m || *n == 0);
|
assert(m || *n == 0);
|
||||||
|
|
||||||
for (i = 0; i < *n; i++) {
|
for (size_t i = 0; i < *n; i++) {
|
||||||
free(m[i].source);
|
free(m[i].source);
|
||||||
free(m[i].destination);
|
free(m[i].destination);
|
||||||
mount_options_free_all(m[i].mount_options);
|
mount_options_free_all(m[i].mount_options);
|
||||||
@ -2028,11 +2020,9 @@ int mount_image_add(MountImage **m, size_t *n, const MountImage *item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void temporary_filesystem_free_many(TemporaryFileSystem *t, size_t n) {
|
void temporary_filesystem_free_many(TemporaryFileSystem *t, size_t n) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(t || n == 0);
|
assert(t || n == 0);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
free(t[i].path);
|
free(t[i].path);
|
||||||
free(t[i].options);
|
free(t[i].options);
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1319,7 @@ static int usbffs_select_ep(const struct dirent *d) {
|
|||||||
|
|
||||||
static int usbffs_dispatch_eps(SocketPort *p) {
|
static int usbffs_dispatch_eps(SocketPort *p) {
|
||||||
_cleanup_free_ struct dirent **ent = NULL;
|
_cleanup_free_ struct dirent **ent = NULL;
|
||||||
size_t n, k, i;
|
size_t n, k;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = scandir(p->path, &ent, usbffs_select_ep, alphasort);
|
r = scandir(p->path, &ent, usbffs_select_ep, alphasort);
|
||||||
@ -1336,7 +1336,7 @@ static int usbffs_dispatch_eps(SocketPort *p) {
|
|||||||
p->n_auxiliary_fds = n;
|
p->n_auxiliary_fds = n;
|
||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
for (i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
_cleanup_free_ char *ep = NULL;
|
_cleanup_free_ char *ep = NULL;
|
||||||
|
|
||||||
ep = path_make_absolute(ent[i]->d_name, p->path);
|
ep = path_make_absolute(ent[i]->d_name, p->path);
|
||||||
@ -1363,7 +1363,7 @@ fail:
|
|||||||
p->n_auxiliary_fds = 0;
|
p->n_auxiliary_fds = 0;
|
||||||
|
|
||||||
clear:
|
clear:
|
||||||
for (i = 0; i < n; ++i)
|
for (size_t i = 0; i < n; ++i)
|
||||||
free(ent[i]);
|
free(ent[i]);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -1183,15 +1183,13 @@ static int swap_dispatch_timer(sd_event_source *source, usec_t usec, void *userd
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int swap_load_proc_swaps(Manager *m, bool set_flags) {
|
static int swap_load_proc_swaps(Manager *m, bool set_flags) {
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
rewind(m->proc_swaps);
|
rewind(m->proc_swaps);
|
||||||
|
|
||||||
(void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n");
|
(void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n");
|
||||||
|
|
||||||
for (i = 1;; i++) {
|
for (unsigned i = 1;; i++) {
|
||||||
_cleanup_free_ char *dev = NULL, *d = NULL;
|
_cleanup_free_ char *dev = NULL, *d = NULL;
|
||||||
int prio = 0, k;
|
int prio = 0, k;
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ static int target_add_default_dependencies(Target *t) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
unsigned k;
|
|
||||||
|
|
||||||
assert(t);
|
assert(t);
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ static int target_add_default_dependencies(Target *t) {
|
|||||||
/* Imply ordering for requirement dependencies on target units. Note that when the user created a contradicting
|
/* Imply ordering for requirement dependencies on target units. Note that when the user created a contradicting
|
||||||
* ordering manually we won't add anything in here to make sure we don't create a loop. */
|
* ordering manually we won't add anything in here to make sure we don't create a loop. */
|
||||||
|
|
||||||
for (k = 0; k < ELEMENTSOF(deps); k++) {
|
for (size_t k = 0; k < ELEMENTSOF(deps); k++) {
|
||||||
Unit *other;
|
Unit *other;
|
||||||
void *v;
|
void *v;
|
||||||
|
|
||||||
|
@ -210,14 +210,13 @@ static int fix_xattr(int fd, const Context *context) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|
||||||
/* Attach some metadata to coredumps via extended
|
/* Attach some metadata to coredumps via extended
|
||||||
* attributes. Just because we can. */
|
* attributes. Just because we can. */
|
||||||
|
|
||||||
for (i = 0; i < _META_MAX; i++) {
|
for (unsigned i = 0; i < _META_MAX; i++) {
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (isempty(context->meta[i]) || !xattrs[i])
|
if (isempty(context->meta[i]) || !xattrs[i])
|
||||||
@ -808,7 +807,7 @@ log:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int save_context(Context *context, const struct iovec_wrapper *iovw) {
|
static int save_context(Context *context, const struct iovec_wrapper *iovw) {
|
||||||
unsigned n, i, count = 0;
|
unsigned count = 0;
|
||||||
const char *unit;
|
const char *unit;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -818,10 +817,10 @@ static int save_context(Context *context, const struct iovec_wrapper *iovw) {
|
|||||||
|
|
||||||
/* The context does not allocate any memory on its own */
|
/* The context does not allocate any memory on its own */
|
||||||
|
|
||||||
for (n = 0; n < iovw->count; n++) {
|
for (size_t n = 0; n < iovw->count; n++) {
|
||||||
struct iovec *iovec = iovw->iovec + n;
|
struct iovec *iovec = iovw->iovec + n;
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(meta_field_names); i++) {
|
for (size_t i = 0; i < ELEMENTSOF(meta_field_names); i++) {
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
/* Note that these strings are NUL terminated, because we made sure that a
|
/* Note that these strings are NUL terminated, because we made sure that a
|
||||||
@ -858,7 +857,7 @@ static int process_socket(int fd) {
|
|||||||
Context context = {};
|
Context context = {};
|
||||||
struct iovec_wrapper iovw = {};
|
struct iovec_wrapper iovw = {};
|
||||||
struct iovec iovec;
|
struct iovec iovec;
|
||||||
int i, r;
|
int r;
|
||||||
|
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|
||||||
@ -936,7 +935,7 @@ static int process_socket(int fd) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
/* Make sure we received at least all fields we need. */
|
/* Make sure we received at least all fields we need. */
|
||||||
for (i = 0; i < _META_MANDATORY_MAX; i++)
|
for (int i = 0; i < _META_MANDATORY_MAX; i++)
|
||||||
if (!context.meta[i]) {
|
if (!context.meta[i]) {
|
||||||
r = log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
r = log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||||
"A mandatory argument (%i) has not been sent, aborting.",
|
"A mandatory argument (%i) has not been sent, aborting.",
|
||||||
@ -958,7 +957,6 @@ static int send_iovec(const struct iovec_wrapper *iovw, int input_fd) {
|
|||||||
.un.sun_path = "/run/systemd/coredump",
|
.un.sun_path = "/run/systemd/coredump",
|
||||||
};
|
};
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
size_t i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(iovw);
|
assert(iovw);
|
||||||
@ -971,7 +969,7 @@ static int send_iovec(const struct iovec_wrapper *iovw, int input_fd) {
|
|||||||
if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0)
|
if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0)
|
||||||
return log_error_errno(errno, "Failed to connect to coredump service: %m");
|
return log_error_errno(errno, "Failed to connect to coredump service: %m");
|
||||||
|
|
||||||
for (i = 0; i < iovw->count; i++) {
|
for (size_t i = 0; i < iovw->count; i++) {
|
||||||
struct msghdr mh = {
|
struct msghdr mh = {
|
||||||
.msg_iov = iovw->iovec + i,
|
.msg_iov = iovw->iovec + i,
|
||||||
.msg_iovlen = 1,
|
.msg_iovlen = 1,
|
||||||
@ -1022,7 +1020,7 @@ static int gather_pid_metadata_from_argv(
|
|||||||
int argc, char **argv) {
|
int argc, char **argv) {
|
||||||
|
|
||||||
_cleanup_free_ char *free_timestamp = NULL;
|
_cleanup_free_ char *free_timestamp = NULL;
|
||||||
int i, r, signo;
|
int r, signo;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
/* We gather all metadata that were passed via argv[] into an array of iovecs that
|
/* We gather all metadata that were passed via argv[] into an array of iovecs that
|
||||||
@ -1033,7 +1031,7 @@ static int gather_pid_metadata_from_argv(
|
|||||||
"Not enough arguments passed by the kernel (%i, expected %i).",
|
"Not enough arguments passed by the kernel (%i, expected %i).",
|
||||||
argc, _META_ARGV_MAX);
|
argc, _META_ARGV_MAX);
|
||||||
|
|
||||||
for (i = 0; i < _META_ARGV_MAX; i++) {
|
for (int i = 0; i < _META_ARGV_MAX; i++) {
|
||||||
|
|
||||||
t = argv[i];
|
t = argv[i];
|
||||||
|
|
||||||
@ -1224,7 +1222,6 @@ static int process_backtrace(int argc, char *argv[]) {
|
|||||||
Context context = {};
|
Context context = {};
|
||||||
struct iovec_wrapper *iovw;
|
struct iovec_wrapper *iovw;
|
||||||
char *message;
|
char *message;
|
||||||
size_t i;
|
|
||||||
int r;
|
int r;
|
||||||
_cleanup_(journal_importer_cleanup) JournalImporter importer = JOURNAL_IMPORTER_INIT(STDIN_FILENO);
|
_cleanup_(journal_importer_cleanup) JournalImporter importer = JOURNAL_IMPORTER_INIT(STDIN_FILENO);
|
||||||
|
|
||||||
@ -1274,7 +1271,7 @@ static int process_backtrace(int argc, char *argv[]) {
|
|||||||
/* The imported iovecs are not supposed to be freed by us so let's store
|
/* The imported iovecs are not supposed to be freed by us so let's store
|
||||||
* them at the end of the array so we can skip them while freeing the
|
* them at the end of the array so we can skip them while freeing the
|
||||||
* rest. */
|
* rest. */
|
||||||
for (i = 0; i < importer.iovw.count; i++) {
|
for (size_t i = 0; i < importer.iovw.count; i++) {
|
||||||
struct iovec *iovec = importer.iovw.iovec + i;
|
struct iovec *iovec = importer.iovw.iovec + i;
|
||||||
|
|
||||||
iovw_put(iovw, iovec->iov_base, iovec->iov_len);
|
iovw_put(iovw, iovec->iov_base, iovec->iov_len);
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
#define MIN_NUMBER_OF_RUNS 4
|
#define MIN_NUMBER_OF_RUNS 4
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int i, r;
|
int r;
|
||||||
size_t size;
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
test_setup_logging(LOG_DEBUG);
|
test_setup_logging(LOG_DEBUG);
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
_cleanup_free_ char *buf = NULL;
|
_cleanup_free_ char *buf = NULL;
|
||||||
|
size_t size;
|
||||||
|
char *name;
|
||||||
|
|
||||||
name = argv[i];
|
name = argv[i];
|
||||||
r = read_full_file(name, &buf, &size);
|
r = read_full_file(name, &buf, &size);
|
||||||
|
@ -1057,13 +1057,12 @@ int sd_dhcp_server_start(sd_dhcp_server *server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp_server_forcerenew(sd_dhcp_server *server) {
|
int sd_dhcp_server_forcerenew(sd_dhcp_server *server) {
|
||||||
unsigned i;
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert_return(server, -EINVAL);
|
assert_return(server, -EINVAL);
|
||||||
assert(server->bound_leases);
|
assert(server->bound_leases);
|
||||||
|
|
||||||
for (i = 0; i < server->pool_size; i++) {
|
for (uint32_t i = 0; i < server->pool_size; i++) {
|
||||||
DHCPLease *lease = server->bound_leases[i];
|
DHCPLease *lease = server->bound_leases[i];
|
||||||
|
|
||||||
if (!lease || lease == &server->invalid_lease)
|
if (!lease || lease == &server->invalid_lease)
|
||||||
|
@ -40,10 +40,8 @@ void close_and_munmap(int fd, void *address, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bus_flush_memfd(sd_bus *b) {
|
void bus_flush_memfd(sd_bus *b) {
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
assert(b);
|
assert(b);
|
||||||
|
|
||||||
for (i = 0; i < b->n_memfd_cache; i++)
|
for (unsigned i = 0; i < b->n_memfd_cache; i++)
|
||||||
close_and_munmap(b->memfd_cache[i].fd, b->memfd_cache[i].address, b->memfd_cache[i].mapped);
|
close_and_munmap(b->memfd_cache[i].fd, b->memfd_cache[i].address, b->memfd_cache[i].mapped);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ static void unsetenv_all(bool unset_environment) {
|
|||||||
|
|
||||||
_public_ int sd_listen_fds(int unset_environment) {
|
_public_ int sd_listen_fds(int unset_environment) {
|
||||||
const char *e;
|
const char *e;
|
||||||
int n, r, fd;
|
int n, r;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
e = getenv("LISTEN_PID");
|
e = getenv("LISTEN_PID");
|
||||||
@ -75,7 +75,7 @@ _public_ int sd_listen_fds(int unset_environment) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) {
|
for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) {
|
||||||
r = fd_cloexec(fd, true);
|
r = fd_cloexec(fd, true);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -63,11 +63,9 @@ _public_ int sd_device_enumerator_new(sd_device_enumerator **ret) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sd_device_enumerator *device_enumerator_free(sd_device_enumerator *enumerator) {
|
static sd_device_enumerator *device_enumerator_free(sd_device_enumerator *enumerator) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(enumerator);
|
assert(enumerator);
|
||||||
|
|
||||||
for (i = 0; i < enumerator->n_devices; i++)
|
for (size_t i = 0; i < enumerator->n_devices; i++)
|
||||||
sd_device_unref(enumerator->devices[i]);
|
sd_device_unref(enumerator->devices[i]);
|
||||||
|
|
||||||
free(enumerator->devices);
|
free(enumerator->devices);
|
||||||
@ -784,7 +782,6 @@ static void device_enumerator_dedup_devices(sd_device_enumerator *enumerator) {
|
|||||||
|
|
||||||
int device_enumerator_scan_devices(sd_device_enumerator *enumerator) {
|
int device_enumerator_scan_devices(sd_device_enumerator *enumerator) {
|
||||||
int r = 0, k;
|
int r = 0, k;
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(enumerator);
|
assert(enumerator);
|
||||||
|
|
||||||
@ -792,7 +789,7 @@ int device_enumerator_scan_devices(sd_device_enumerator *enumerator) {
|
|||||||
enumerator->type == DEVICE_ENUMERATION_TYPE_DEVICES)
|
enumerator->type == DEVICE_ENUMERATION_TYPE_DEVICES)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < enumerator->n_devices; i++)
|
for (size_t i = 0; i < enumerator->n_devices; i++)
|
||||||
sd_device_unref(enumerator->devices[i]);
|
sd_device_unref(enumerator->devices[i]);
|
||||||
|
|
||||||
enumerator->n_devices = 0;
|
enumerator->n_devices = 0;
|
||||||
@ -851,7 +848,6 @@ _public_ sd_device *sd_device_enumerator_get_device_next(sd_device_enumerator *e
|
|||||||
int device_enumerator_scan_subsystems(sd_device_enumerator *enumerator) {
|
int device_enumerator_scan_subsystems(sd_device_enumerator *enumerator) {
|
||||||
const char *subsysdir;
|
const char *subsysdir;
|
||||||
int r = 0, k;
|
int r = 0, k;
|
||||||
size_t i;
|
|
||||||
|
|
||||||
assert(enumerator);
|
assert(enumerator);
|
||||||
|
|
||||||
@ -859,7 +855,7 @@ int device_enumerator_scan_subsystems(sd_device_enumerator *enumerator) {
|
|||||||
enumerator->type == DEVICE_ENUMERATION_TYPE_SUBSYSTEMS)
|
enumerator->type == DEVICE_ENUMERATION_TYPE_SUBSYSTEMS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < enumerator->n_devices; i++)
|
for (size_t i = 0; i < enumerator->n_devices; i++)
|
||||||
sd_device_unref(enumerator->devices[i]);
|
sd_device_unref(enumerator->devices[i]);
|
||||||
|
|
||||||
enumerator->n_devices = 0;
|
enumerator->n_devices = 0;
|
||||||
|
@ -8,7 +8,7 @@ $ sudo test/run-integration-tests.sh
|
|||||||
ninja: Entering directory `/home/zbyszek/src/systemd/build'
|
ninja: Entering directory `/home/zbyszek/src/systemd/build'
|
||||||
ninja: no work to do.
|
ninja: no work to do.
|
||||||
--x-- Running TEST-01-BASIC --x--
|
--x-- Running TEST-01-BASIC --x--
|
||||||
+ make -C TEST-01-BASIC BUILD_DIR=/home/zbyszek/src/systemd/build clean setup run
|
+ make -C TEST-01-BASIC clean setup run
|
||||||
make: Entering directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
|
make: Entering directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
|
||||||
TEST-01-BASIC CLEANUP: Basic systemd setup
|
TEST-01-BASIC CLEANUP: Basic systemd setup
|
||||||
TEST-01-BASIC SETUP: Basic systemd setup
|
TEST-01-BASIC SETUP: Basic systemd setup
|
||||||
@ -17,7 +17,7 @@ TEST-01-BASIC RUN: Basic systemd setup [OK]
|
|||||||
make: Leaving directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
|
make: Leaving directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
|
||||||
--x-- Result of TEST-01-BASIC: 0 --x--
|
--x-- Result of TEST-01-BASIC: 0 --x--
|
||||||
--x-- Running TEST-02-CRYPTSETUP --x--
|
--x-- Running TEST-02-CRYPTSETUP --x--
|
||||||
+ make -C TEST-02-CRYPTSETUP BUILD_DIR=/home/zbyszek/src/systemd/build clean setup run
|
+ make -C TEST-02-CRYPTSETUP clean setup run
|
||||||
|
|
||||||
If one of the tests fails, then $subdir/test.log contains the log file of
|
If one of the tests fails, then $subdir/test.log contains the log file of
|
||||||
the test.
|
the test.
|
||||||
@ -41,6 +41,14 @@ $ sudo make -C test/TEST-01-BASIC BUILD_DIR=../../some-other-build/ ...
|
|||||||
Note that in the second case, the path is relative to the test case directory.
|
Note that in the second case, the path is relative to the test case directory.
|
||||||
An absolute path may also be used in both cases.
|
An absolute path may also be used in both cases.
|
||||||
|
|
||||||
|
Testing installed binaries instead of built
|
||||||
|
===========================================
|
||||||
|
|
||||||
|
To run the extended testsuite using the systemd installed on the system instead
|
||||||
|
of the systemd from a build, use the NO_BUILD=1:
|
||||||
|
|
||||||
|
$ sudo NO_BUILD=1 test/run-integration-tests
|
||||||
|
|
||||||
Configuration variables
|
Configuration variables
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
|
|
||||||
|
|
||||||
all setup run clean clean-again:
|
all setup run clean clean-again:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@TEST_BASE_DIR=../ ./test.sh --$@
|
||||||
|
|
||||||
.PHONY: all setup run clean clean-again
|
.PHONY: all setup run clean clean-again
|
||||||
|
@ -9,8 +9,9 @@ TEST_REQUIRE_INSTALL_TESTS=0
|
|||||||
|
|
||||||
test_append_files() {
|
test_append_files() {
|
||||||
# install tests manually so the test is functional even when -Dinstall-tests=false
|
# install tests manually so the test is functional even when -Dinstall-tests=false
|
||||||
mkdir -p $1/usr/lib/systemd/tests/testdata/units/
|
local dst="$1/usr/lib/systemd/tests/testdata/units/"
|
||||||
cp -v $(dirname $0)/../units/{testsuite-01,end}.service $1/usr/lib/systemd/tests/testdata/units/
|
mkdir -p "$dst"
|
||||||
|
cp -v $TEST_UNITS_DIR/{testsuite-01,end}.service $TEST_UNITS_DIR/testsuite.target "$dst"
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test "$@" 01
|
do_test "$@" 01
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
|
|
||||||
|
|
||||||
all setup run clean clean-again:
|
all setup run clean clean-again:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@TEST_BASE_DIR=../ ./test.sh --$@
|
||||||
|
|
||||||
# finish option is used to run checks that can only be run outside of
|
# finish option is used to run checks that can only be run outside of
|
||||||
# the test execution. Example case, honor first shutdown, proof is obtained
|
# the test execution. Example case, honor first shutdown, proof is obtained
|
||||||
@ -11,6 +9,6 @@ all setup run clean clean-again:
|
|||||||
# the test will loop and will be terminated via a command timeout.
|
# the test will loop and will be terminated via a command timeout.
|
||||||
# This just provides concrete confirmation.
|
# This just provides concrete confirmation.
|
||||||
finish:
|
finish:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./fini.sh --$@
|
@TEST_BASE_DIR=../ ./fini.sh --$@
|
||||||
|
|
||||||
.PHONY: all setup run clean clean-again finish
|
.PHONY: all setup run clean clean-again finish
|
||||||
|
@ -1,14 +1,46 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
|
if [ "$NO_BUILD" ]; then
|
||||||
|
BUILD_DIR=""
|
||||||
|
elif BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"; then
|
||||||
|
ninja -C "$BUILD_DIR"
|
||||||
|
else
|
||||||
|
echo "No build found, please set BUILD_DIR or NO_BUILD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
args="$@"
|
args="$*"
|
||||||
else
|
else
|
||||||
args="setup run clean-again"
|
args="setup run clean-again"
|
||||||
fi
|
fi
|
||||||
args_no_clean=$(sed -r 's/\bclean.*\b//g' <<<$args)
|
|
||||||
do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? )
|
VALID_TARGETS="all setup run clean clean-again"
|
||||||
|
|
||||||
|
is_valid_target() {
|
||||||
|
for target in $VALID_TARGETS; do
|
||||||
|
[ "$1" = "$target" ] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# reject invalid make targets in $args
|
||||||
|
for arg in $args; do
|
||||||
|
if ! is_valid_target "$arg"; then
|
||||||
|
echo "Invalid target: $arg" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
CLEAN=0
|
||||||
|
CLEANAGAIN=0
|
||||||
|
|
||||||
|
# separate 'clean' and 'clean-again' operations
|
||||||
|
[[ "$args" =~ "clean-again" ]] && CLEANAGAIN=1
|
||||||
|
args=${args/clean-again}
|
||||||
|
[[ "$args" =~ "clean" ]] && CLEAN=1
|
||||||
|
args=${args/clean}
|
||||||
|
|
||||||
declare -A results
|
declare -A results
|
||||||
declare -A times
|
declare -A times
|
||||||
@ -18,16 +50,6 @@ FAILURES=0
|
|||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# Let's always do the cleaning operation first, because it destroys the image
|
|
||||||
# cache.
|
|
||||||
if [ $do_clean = 1 ]; then
|
|
||||||
for TEST in TEST-??-* ; do
|
|
||||||
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -n "$args_no_clean" ] || exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
pass_deny_list() {
|
pass_deny_list() {
|
||||||
for marker in $DENY_LIST_MARKERS $BLACKLIST_MARKERS; do
|
for marker in $DENY_LIST_MARKERS $BLACKLIST_MARKERS; do
|
||||||
if [ -f "$1/$marker" ]; then
|
if [ -f "$1/$marker" ]; then
|
||||||
@ -38,28 +60,40 @@ pass_deny_list() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
for TEST in TEST-??-* ; do
|
# Let's always do the cleaning operation first, because it destroys the image
|
||||||
COUNT=$(($COUNT+1))
|
# cache.
|
||||||
|
if [ $CLEAN = 1 ]; then
|
||||||
|
for TEST in TEST-??-* ; do
|
||||||
|
( set -x ; make -C "$TEST" clean )
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
pass_deny_list $TEST || continue
|
# Run actual tests (if requested)
|
||||||
start=$(date +%s)
|
if [[ $args =~ [a-z] ]]; then
|
||||||
|
for TEST in TEST-??-* ; do
|
||||||
|
COUNT=$(($COUNT+1))
|
||||||
|
|
||||||
echo -e "\n--x-- Running $TEST --x--"
|
pass_deny_list $TEST || continue
|
||||||
set +e
|
start=$(date +%s)
|
||||||
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args_no_clean )
|
|
||||||
RESULT=$?
|
|
||||||
set -e
|
|
||||||
echo "--x-- Result of $TEST: $RESULT --x--"
|
|
||||||
|
|
||||||
results["$TEST"]="$RESULT"
|
echo -e "\n--x-- Running $TEST --x--"
|
||||||
times["$TEST"]=$(( $(date +%s) - $start ))
|
set +e
|
||||||
|
( set -x ; make -C "$TEST" $args )
|
||||||
|
RESULT=$?
|
||||||
|
set -e
|
||||||
|
echo "--x-- Result of $TEST: $RESULT --x--"
|
||||||
|
|
||||||
[ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
|
results["$TEST"]="$RESULT"
|
||||||
done
|
times["$TEST"]=$(( $(date +%s) - $start ))
|
||||||
|
|
||||||
if [ $FAILURES -eq 0 -a $do_clean = 1 ]; then
|
[ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run clean-again, if requested, and if no tests failed
|
||||||
|
if [ $FAILURES -eq 0 -a $CLEANAGAIN = 1 ]; then
|
||||||
for TEST in ${!results[@]}; do
|
for TEST in ${!results[@]}; do
|
||||||
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean-again )
|
( set -x ; make -C "$TEST" clean-again )
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -43,6 +43,22 @@ if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
|
|||||||
ROOTLIBDIR=/usr/lib/systemd
|
ROOTLIBDIR=/usr/lib/systemd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The calling test.sh scripts have TEST_BASE_DIR set via their Makefile, but we don't need them to provide it
|
||||||
|
TEST_BASE_DIR=${TEST_BASE_DIR:-$(realpath $(dirname "$BASH_SOURCE"))}
|
||||||
|
TEST_UNITS_DIR="$TEST_BASE_DIR/units"
|
||||||
|
SOURCE_DIR=$(realpath "$TEST_BASE_DIR/..")
|
||||||
|
TOOLS_DIR="$SOURCE_DIR/tools"
|
||||||
|
|
||||||
|
# note that find-build-dir.sh will return $BUILD_DIR if provided, else it will try to find it
|
||||||
|
if ! BUILD_DIR=$($TOOLS_DIR/find-build-dir.sh); then
|
||||||
|
if [ "$NO_BUILD" ]; then
|
||||||
|
BUILD_DIR=$SOURCE_DIR
|
||||||
|
else
|
||||||
|
echo "ERROR: no build found, please set BUILD_DIR or use NO_BUILD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
PATH_TO_INIT=$ROOTLIBDIR/systemd
|
PATH_TO_INIT=$ROOTLIBDIR/systemd
|
||||||
[ "$SYSTEMD_JOURNALD" ] || SYSTEMD_JOURNALD=$(which -a $BUILD_DIR/systemd-journald $ROOTLIBDIR/systemd-journald 2>/dev/null | grep '^/' -m1)
|
[ "$SYSTEMD_JOURNALD" ] || SYSTEMD_JOURNALD=$(which -a $BUILD_DIR/systemd-journald $ROOTLIBDIR/systemd-journald 2>/dev/null | grep '^/' -m1)
|
||||||
[ "$SYSTEMD_JOURNAL_REMOTE" ] || SYSTEMD_JOURNAL_REMOTE=$(which -a $BUILD_DIR/systemd-journal-remote $ROOTLIBDIR/systemd-journal-remote 2>/dev/null | grep '^/' -m1)
|
[ "$SYSTEMD_JOURNAL_REMOTE" ] || SYSTEMD_JOURNAL_REMOTE=$(which -a $BUILD_DIR/systemd-journal-remote $ROOTLIBDIR/systemd-journal-remote 2>/dev/null | grep '^/' -m1)
|
||||||
@ -50,6 +66,17 @@ PATH_TO_INIT=$ROOTLIBDIR/systemd
|
|||||||
[ "$SYSTEMD_NSPAWN" ] || SYSTEMD_NSPAWN=$(which -a $BUILD_DIR/systemd-nspawn systemd-nspawn 2>/dev/null | grep '^/' -m1)
|
[ "$SYSTEMD_NSPAWN" ] || SYSTEMD_NSPAWN=$(which -a $BUILD_DIR/systemd-nspawn systemd-nspawn 2>/dev/null | grep '^/' -m1)
|
||||||
[ "$JOURNALCTL" ] || JOURNALCTL=$(which -a $BUILD_DIR/journalctl journalctl 2>/dev/null | grep '^/' -m1)
|
[ "$JOURNALCTL" ] || JOURNALCTL=$(which -a $BUILD_DIR/journalctl journalctl 2>/dev/null | grep '^/' -m1)
|
||||||
|
|
||||||
|
TESTFILE=${BASH_SOURCE[1]}
|
||||||
|
if [ -z "$TESTFILE" ]; then
|
||||||
|
echo "ERROR: test-functions must be sourced from one of the TEST-*/test.sh scripts" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
TESTNAME=$(basename $(dirname $(realpath $TESTFILE)))
|
||||||
|
STATEDIR="$BUILD_DIR/test/$TESTNAME"
|
||||||
|
STATEFILE="$STATEDIR/.testdir"
|
||||||
|
IMAGESTATEDIR="$STATEDIR/.."
|
||||||
|
TESTLOG="$STATEDIR/test.log"
|
||||||
|
|
||||||
BASICTOOLS=(
|
BASICTOOLS=(
|
||||||
awk
|
awk
|
||||||
basename
|
basename
|
||||||
@ -148,11 +175,6 @@ DEBUGTOOLS=(
|
|||||||
vi
|
vi
|
||||||
)
|
)
|
||||||
|
|
||||||
STATEDIR="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))"
|
|
||||||
STATEFILE="$STATEDIR/.testdir"
|
|
||||||
IMAGESTATEDIR="$STATEDIR/.."
|
|
||||||
TESTLOG="$STATEDIR/test.log"
|
|
||||||
|
|
||||||
is_built_with_asan() {
|
is_built_with_asan() {
|
||||||
if ! type -P objdump >/dev/null; then
|
if ! type -P objdump >/dev/null; then
|
||||||
ddebug "Failed to find objdump. Assuming systemd hasn't been built with ASAN."
|
ddebug "Failed to find objdump. Assuming systemd hasn't been built with ASAN."
|
||||||
@ -663,7 +685,7 @@ install_dmevent() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_systemd() {
|
install_compiled_systemd() {
|
||||||
ddebug "Install compiled systemd"
|
ddebug "Install compiled systemd"
|
||||||
|
|
||||||
local _ninja_bin=$(type -P ninja || type -P ninja-build)
|
local _ninja_bin=$(type -P ninja || type -P ninja-build)
|
||||||
@ -672,6 +694,42 @@ install_systemd() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
(set -x; DESTDIR=$initdir "$_ninja_bin" -C $BUILD_DIR install)
|
(set -x; DESTDIR=$initdir "$_ninja_bin" -C $BUILD_DIR install)
|
||||||
|
}
|
||||||
|
|
||||||
|
install_debian_systemd() {
|
||||||
|
ddebug "Install debian systemd"
|
||||||
|
|
||||||
|
local _systemd_pkgs=$(apt-cache showsrc systemd | grep -m 1 -E '^Binary:' | cut -d ':' -f 2 | tr -d ,)
|
||||||
|
local _files=""
|
||||||
|
for deb in $_systemd_pkgs; do
|
||||||
|
_files=$(dpkg-query -L $deb 2>/dev/null) || continue
|
||||||
|
ddebug "Install debian files from package $deb"
|
||||||
|
for file in $_files; do
|
||||||
|
[ -e "$file" ] || continue
|
||||||
|
[ -d "$file" ] && continue
|
||||||
|
inst $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
install_distro_systemd() {
|
||||||
|
ddebug "Install distro systemd"
|
||||||
|
|
||||||
|
if [ "$LOOKS_LIKE_DEBIAN" ]; then
|
||||||
|
install_debian_systemd
|
||||||
|
else
|
||||||
|
dfatal "NO_BUILD not supported for this distro"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_systemd() {
|
||||||
|
if [ "$NO_BUILD" ]; then
|
||||||
|
install_distro_systemd
|
||||||
|
else
|
||||||
|
install_compiled_systemd
|
||||||
|
fi
|
||||||
|
|
||||||
# remove unneeded documentation
|
# remove unneeded documentation
|
||||||
rm -fr $initdir/usr/share/{man,doc}
|
rm -fr $initdir/usr/share/{man,doc}
|
||||||
|
|
||||||
|
@ -322,4 +322,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
if opts.test and outdated:
|
if opts.test and outdated:
|
||||||
exit(f'Outdated pages: {", ".join(outdated)}\n'
|
exit(f'Outdated pages: {", ".join(outdated)}\n'
|
||||||
f'Hint: ninja -C {opts.build_dir} man/update-dbus-docs')
|
f'Hint: ninja -C {opts.build_dir} update-dbus-docs')
|
||||||
|
@ -51,7 +51,7 @@ MESON_HEADER = '''\
|
|||||||
|
|
||||||
# Do not edit. Generated by update-man-rules.py.
|
# Do not edit. Generated by update-man-rules.py.
|
||||||
# Update with:
|
# Update with:
|
||||||
# ninja -C build man/update-man-rules
|
# ninja -C build update-man-rules
|
||||||
manpages = ['''
|
manpages = ['''
|
||||||
|
|
||||||
MESON_FOOTER = '''\
|
MESON_FOOTER = '''\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user