Compare commits
21 Commits
175cf465e0
...
dbc82508b9
Author | SHA1 | Date |
---|---|---|
Luca Boccassi | dbc82508b9 | |
Ani Sinha | 4b356c90dc | |
Léane GRASSER | f28e16d14e | |
Yu Watanabe | 9e05e33871 | |
Lennart Poettering | 95116bdfd5 | |
Lennart Poettering | 2bd290ca02 | |
Yu Watanabe | 1e9fb1d456 | |
Yu Watanabe | 56c761f8c6 | |
Yu Watanabe | b76730f3fe | |
Yu Watanabe | 3dda236c5c | |
Zbigniew Jędrzejewski-Szmek | 5598454a3f | |
Yu Watanabe | 2994ca354b | |
Yu Watanabe | eb14b993bb | |
Luca Boccassi | b96f2d71f8 | |
Luca Boccassi | d47d93eb7c | |
Luca Boccassi | 395910cfda | |
Luca Boccassi | 3a7f1f3b14 | |
Luca Boccassi | 48b13aa7b2 | |
Luca Boccassi | ef0247684c | |
Luca Boccassi | cd65a11c8d | |
Luca Boccassi | 3d8b2bccd2 |
|
@ -25,6 +25,7 @@ ADDITIONAL_DEPS=(
|
|||
python3-pytest
|
||||
rpm
|
||||
zstd
|
||||
debootstrap
|
||||
)
|
||||
|
||||
function info() {
|
||||
|
@ -128,6 +129,18 @@ for phase in "${PHASES[@]}"; do
|
|||
(set +x; while :; do echo -ne "\n[WATCHDOG] $(date)\n"; sleep 30; done) &
|
||||
meson test --timeout-multiplier=3 -C build --print-errorlogs
|
||||
;;
|
||||
RUN_NOPROC)
|
||||
debootstrap testing testing
|
||||
chroot testing mkdir -p /tmp/repo/
|
||||
chroot testing sh -c "echo 'deb-src http://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing-src.list"
|
||||
chroot testing apt-get update
|
||||
chroot testing apt-get build-dep -y systemd
|
||||
mount --bind . testing/tmp/repo
|
||||
chroot testing sh -c 'cd /tmp/repo; meson -Dnobody-group=nogroup -Dslow-tests=true build'
|
||||
chroot testing sh -c 'cd /tmp/repo/build; ninja -v'
|
||||
chroot testing sh -c 'cd /tmp/repo/build; meson test --print-errorlogs'
|
||||
umount --lazy testing/tmp/repo
|
||||
;;
|
||||
CLEANUP)
|
||||
info "Cleanup phase"
|
||||
if [ ! -f /etc/machine-id ] && [ -w /etc/machine-id.bak ]; then
|
||||
|
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_RELEASE, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS]
|
||||
run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_RELEASE, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS, NOPROC]
|
||||
cryptolib: [auto]
|
||||
include:
|
||||
- run_phase: GCC
|
||||
|
|
4
po/fr.po
4
po/fr.po
|
@ -12,7 +12,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-06 14:42+0000\n"
|
||||
"PO-Revision-Date: 2024-11-20 19:13+0000\n"
|
||||
"PO-Revision-Date: 2024-11-23 10:38+0000\n"
|
||||
"Last-Translator: Léane GRASSER <leane.grasser@proton.me>\n"
|
||||
"Language-Team: French <https://translate.fedoraproject.org/projects/systemd/"
|
||||
"main/fr/>\n"
|
||||
|
@ -1258,7 +1258,7 @@ msgstr ""
|
|||
|
||||
#: src/sysupdate/org.freedesktop.sysupdate1.policy:75
|
||||
msgid "Manage optional features"
|
||||
msgstr "Gérer les fonctionnalités en option"
|
||||
msgstr "Gérer les fonctionnalités facultatives"
|
||||
|
||||
#: src/sysupdate/org.freedesktop.sysupdate1.policy:76
|
||||
msgid "Authentication is required to manage optional features"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define AUTOFS_MIN_PROTO_VERSION 3
|
||||
#define AUTOFS_MAX_PROTO_VERSION 5
|
||||
|
||||
#define AUTOFS_PROTO_SUBVERSION 5
|
||||
#define AUTOFS_PROTO_SUBVERSION 6
|
||||
|
||||
/*
|
||||
* The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
|
||||
|
|
|
@ -1121,6 +1121,9 @@ enum bpf_attach_type {
|
|||
|
||||
#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
|
||||
|
||||
/* Add BPF_LINK_TYPE(type, name) in bpf_types.h to keep bpf_link_type_strs[]
|
||||
* in sync with the definitions below.
|
||||
*/
|
||||
enum bpf_link_type {
|
||||
BPF_LINK_TYPE_UNSPEC = 0,
|
||||
BPF_LINK_TYPE_RAW_TRACEPOINT = 1,
|
||||
|
@ -2851,7 +2854,7 @@ union bpf_attr {
|
|||
* **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**,
|
||||
* **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
|
||||
* **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
|
||||
* **TCP_BPF_RTO_MIN**.
|
||||
* **TCP_BPF_RTO_MIN**, **TCP_BPF_SOCK_OPS_CB_FLAGS**.
|
||||
* * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
|
||||
* * **IPPROTO_IPV6**, which supports the following *optname*\ s:
|
||||
* **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
|
||||
|
@ -5519,11 +5522,12 @@ union bpf_attr {
|
|||
* **-EOPNOTSUPP** if the hash calculation failed or **-EINVAL** if
|
||||
* invalid arguments are passed.
|
||||
*
|
||||
* void *bpf_kptr_xchg(void *map_value, void *ptr)
|
||||
* void *bpf_kptr_xchg(void *dst, void *ptr)
|
||||
* Description
|
||||
* Exchange kptr at pointer *map_value* with *ptr*, and return the
|
||||
* old value. *ptr* can be NULL, otherwise it must be a referenced
|
||||
* pointer which will be released when this helper is called.
|
||||
* Exchange kptr at pointer *dst* with *ptr*, and return the old value.
|
||||
* *dst* can be map value or local kptr. *ptr* can be NULL, otherwise
|
||||
* it must be a referenced pointer which will be released when this helper
|
||||
* is called.
|
||||
* Return
|
||||
* The old value of kptr (which can be NULL). The returned pointer
|
||||
* if not NULL, is a reference which must be released using its
|
||||
|
@ -6046,11 +6050,6 @@ enum {
|
|||
BPF_F_MARK_ENFORCE = (1ULL << 6),
|
||||
};
|
||||
|
||||
/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
|
||||
enum {
|
||||
BPF_F_INGRESS = (1ULL << 0),
|
||||
};
|
||||
|
||||
/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
|
||||
enum {
|
||||
BPF_F_TUNINFO_IPV6 = (1ULL << 0),
|
||||
|
@ -6197,10 +6196,12 @@ enum {
|
|||
BPF_F_BPRM_SECUREEXEC = (1ULL << 0),
|
||||
};
|
||||
|
||||
/* Flags for bpf_redirect_map helper */
|
||||
/* Flags for bpf_redirect and bpf_redirect_map helpers */
|
||||
enum {
|
||||
BPF_F_BROADCAST = (1ULL << 3),
|
||||
BPF_F_EXCLUDE_INGRESS = (1ULL << 4),
|
||||
BPF_F_INGRESS = (1ULL << 0), /* used for skb path */
|
||||
BPF_F_BROADCAST = (1ULL << 3), /* used for XDP path */
|
||||
BPF_F_EXCLUDE_INGRESS = (1ULL << 4), /* used for XDP path */
|
||||
#define BPF_F_REDIRECT_FLAGS (BPF_F_INGRESS | BPF_F_BROADCAST | BPF_F_EXCLUDE_INGRESS)
|
||||
};
|
||||
|
||||
#define __bpf_md_ptr(type, name) \
|
||||
|
@ -7080,6 +7081,7 @@ enum {
|
|||
TCP_BPF_SYN = 1005, /* Copy the TCP header */
|
||||
TCP_BPF_SYN_IP = 1006, /* Copy the IP[46] and TCP header */
|
||||
TCP_BPF_SYN_MAC = 1007, /* Copy the MAC, IP[46], and TCP header */
|
||||
TCP_BPF_SOCK_OPS_CB_FLAGS = 1008, /* Get or Set TCP sock ops flags */
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -7512,4 +7514,13 @@ struct bpf_iter_num {
|
|||
__u64 __opaque[1];
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/*
|
||||
* Flags to control BPF kfunc behaviour.
|
||||
* - BPF_F_PAD_ZEROS: Pad destination buffer with zeros. (See the respective
|
||||
* helper documentation for details.)
|
||||
*/
|
||||
enum bpf_kfunc_flags {
|
||||
BPF_F_PAD_ZEROS = (1ULL << 0),
|
||||
};
|
||||
|
||||
#endif /* __LINUX_BPF_H__ */
|
||||
|
|
|
@ -28,6 +28,23 @@
|
|||
#define _BITUL(x) (_UL(1) << (x))
|
||||
#define _BITULL(x) (_ULL(1) << (x))
|
||||
|
||||
#if !defined(__ASSEMBLY__)
|
||||
/*
|
||||
* Missing __asm__ support
|
||||
*
|
||||
* __BIT128() would not work in the __asm__ code, as it shifts an
|
||||
* 'unsigned __init128' data type as direct representation of
|
||||
* 128 bit constants is not supported in the gcc compiler, as
|
||||
* they get silently truncated.
|
||||
*
|
||||
* TODO: Please revisit this implementation when gcc compiler
|
||||
* starts representing 128 bit constants directly like long
|
||||
* and unsigned long etc. Subsequently drop the comment for
|
||||
* GENMASK_U128() which would then start supporting __asm__ code.
|
||||
*/
|
||||
#define _BIT128(x) ((unsigned __int128)(1) << (x))
|
||||
#endif
|
||||
|
||||
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
|
||||
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
||||
|
||||
|
|
|
@ -2531,4 +2531,20 @@ struct ethtool_link_settings {
|
|||
* __u32 map_lp_advertising[link_mode_masks_nwords];
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* enum phy_upstream - Represents the upstream component a given PHY device
|
||||
* is connected to, as in what is on the other end of the MII bus. Most PHYs
|
||||
* will be attached to an Ethernet MAC controller, but in some cases, there's
|
||||
* an intermediate PHY used as a media-converter, which will driver another
|
||||
* MII interface as its output.
|
||||
* @PHY_UPSTREAM_MAC: Upstream component is a MAC (a switch port,
|
||||
* or ethernet controller)
|
||||
* @PHY_UPSTREAM_PHY: Upstream component is a PHY (likely a media converter)
|
||||
*/
|
||||
enum phy_upstream {
|
||||
PHY_UPSTREAM_MAC,
|
||||
PHY_UPSTREAM_PHY,
|
||||
};
|
||||
|
||||
#endif /* _LINUX_ETHTOOL_H */
|
||||
|
|
|
@ -67,6 +67,7 @@ enum {
|
|||
FRA_IP_PROTO, /* ip proto */
|
||||
FRA_SPORT_RANGE, /* sport */
|
||||
FRA_DPORT_RANGE, /* dport */
|
||||
FRA_DSCP, /* dscp */
|
||||
__FRA_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -230,8 +230,8 @@ struct tpacket_hdr_v1 {
|
|||
* ts_first_pkt:
|
||||
* Is always the time-stamp when the block was opened.
|
||||
* Case a) ZERO packets
|
||||
* No packets to deal with but atleast you know the
|
||||
* time-interval of this block.
|
||||
* No packets to deal with but at least you know
|
||||
* the time-interval of this block.
|
||||
* Case b) Non-zero packets
|
||||
* Use the ts of the first packet in the block.
|
||||
*
|
||||
|
@ -265,7 +265,8 @@ enum tpacket_versions {
|
|||
- struct tpacket_hdr
|
||||
- pad to TPACKET_ALIGNMENT=16
|
||||
- struct sockaddr_ll
|
||||
- Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16
|
||||
- Gap, chosen so that packet data (Start+tp_net) aligns to
|
||||
TPACKET_ALIGNMENT=16
|
||||
- Start+tp_mac: [ Optional MAC header ]
|
||||
- Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16.
|
||||
- Pad to align to TPACKET_ALIGNMENT=16
|
||||
|
|
|
@ -141,7 +141,7 @@ struct in_addr {
|
|||
*/
|
||||
#define IP_PMTUDISC_INTERFACE 4
|
||||
/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
|
||||
* fragmented if they exeed the interface mtu
|
||||
* fragmented if they exceed the interface mtu
|
||||
*/
|
||||
#define IP_PMTUDISC_OMIT 5
|
||||
|
||||
|
|
|
@ -140,25 +140,6 @@
|
|||
|
||||
#endif /* _NETINET_IN_H */
|
||||
|
||||
/* Coordinate with glibc netipx/ipx.h header. */
|
||||
#if defined(__NETIPX_IPX_H)
|
||||
|
||||
#define __UAPI_DEF_SOCKADDR_IPX 0
|
||||
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0
|
||||
#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0
|
||||
#define __UAPI_DEF_IPX_CONFIG_DATA 0
|
||||
#define __UAPI_DEF_IPX_ROUTE_DEF 0
|
||||
|
||||
#else /* defined(__NETIPX_IPX_H) */
|
||||
|
||||
#define __UAPI_DEF_SOCKADDR_IPX 1
|
||||
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1
|
||||
#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1
|
||||
#define __UAPI_DEF_IPX_CONFIG_DATA 1
|
||||
#define __UAPI_DEF_IPX_ROUTE_DEF 1
|
||||
|
||||
#endif /* defined(__NETIPX_IPX_H) */
|
||||
|
||||
/* Definitions for xattr.h */
|
||||
#if defined(_SYS_XATTR_H)
|
||||
#define __UAPI_DEF_XATTR 0
|
||||
|
@ -240,23 +221,6 @@
|
|||
#define __UAPI_DEF_IP6_MTUINFO 1
|
||||
#endif
|
||||
|
||||
/* Definitions for ipx.h */
|
||||
#ifndef __UAPI_DEF_SOCKADDR_IPX
|
||||
#define __UAPI_DEF_SOCKADDR_IPX 1
|
||||
#endif
|
||||
#ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION
|
||||
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1
|
||||
#endif
|
||||
#ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION
|
||||
#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1
|
||||
#endif
|
||||
#ifndef __UAPI_DEF_IPX_CONFIG_DATA
|
||||
#define __UAPI_DEF_IPX_CONFIG_DATA 1
|
||||
#endif
|
||||
#ifndef __UAPI_DEF_IPX_ROUTE_DEF
|
||||
#define __UAPI_DEF_IPX_ROUTE_DEF 1
|
||||
#endif
|
||||
|
||||
/* Definitions for xattr.h */
|
||||
#ifndef __UAPI_DEF_XATTR
|
||||
#define __UAPI_DEF_XATTR 1
|
||||
|
|
|
@ -436,7 +436,7 @@ enum nft_set_elem_flags {
|
|||
* @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
|
||||
* @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
|
||||
* @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
|
||||
* @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64)
|
||||
* @NFTA_SET_ELEM_TIMEOUT: timeout value, zero means never times out (NLA_U64)
|
||||
* @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64)
|
||||
* @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY)
|
||||
* @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes)
|
||||
|
@ -1694,7 +1694,7 @@ enum nft_flowtable_flags {
|
|||
*
|
||||
* @NFTA_FLOWTABLE_TABLE: name of the table containing the expression (NLA_STRING)
|
||||
* @NFTA_FLOWTABLE_NAME: name of this flow table (NLA_STRING)
|
||||
* @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32)
|
||||
* @NFTA_FLOWTABLE_HOOK: netfilter hook configuration (NLA_NESTED)
|
||||
* @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32)
|
||||
* @NFTA_FLOWTABLE_HANDLE: object handle (NLA_U64)
|
||||
* @NFTA_FLOWTABLE_FLAGS: flags (NLA_U32)
|
||||
|
|
|
@ -16,10 +16,15 @@ struct nhmsg {
|
|||
struct nexthop_grp {
|
||||
__u32 id; /* nexthop id - must exist */
|
||||
__u8 weight; /* weight of this nexthop */
|
||||
__u8 resvd1;
|
||||
__u8 weight_high; /* high order bits of weight */
|
||||
__u16 resvd2;
|
||||
};
|
||||
|
||||
static __inline__ __u16 nexthop_grp_weight(const struct nexthop_grp *entry)
|
||||
{
|
||||
return ((entry->weight_high << 8) | entry->weight) + 1;
|
||||
}
|
||||
|
||||
enum {
|
||||
NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
|
||||
* default type if not specified
|
||||
|
@ -33,6 +38,9 @@ enum {
|
|||
#define NHA_OP_FLAG_DUMP_STATS BIT(0)
|
||||
#define NHA_OP_FLAG_DUMP_HW_STATS BIT(1)
|
||||
|
||||
/* Response OP_FLAGS. */
|
||||
#define NHA_OP_FLAG_RESP_GRP_RESVD_0 BIT(31) /* Dump clears resvd fields. */
|
||||
|
||||
enum {
|
||||
NHA_UNSPEC,
|
||||
NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */
|
||||
|
|
|
@ -531,20 +531,24 @@ int is_idmapping_supported(const char *path) {
|
|||
userns_fd = userns_acquire(uid_map, gid_map);
|
||||
if (ERRNO_IS_NEG_NOT_SUPPORTED(userns_fd) || ERRNO_IS_NEG_PRIVILEGE(userns_fd))
|
||||
return false;
|
||||
if (userns_fd == -ENOSPC) {
|
||||
log_debug_errno(userns_fd, "Failed to acquire new user namespace, user.max_user_namespaces seems to be exhausted or maybe even zero, assuming ID-mapping is not supported: %m");
|
||||
return false;
|
||||
}
|
||||
if (userns_fd < 0)
|
||||
return log_debug_errno(userns_fd, "ID-mapping supported namespace acquire failed for '%s' : %m", path);
|
||||
return log_debug_errno(userns_fd, "Failed to acquire new user namespace for checking if '%s' supports ID-mapping: %m", path);
|
||||
|
||||
dir_fd = RET_NERRNO(open(path, O_RDONLY | O_CLOEXEC | O_NOFOLLOW));
|
||||
if (ERRNO_IS_NEG_NOT_SUPPORTED(dir_fd))
|
||||
return false;
|
||||
if (dir_fd < 0)
|
||||
return log_debug_errno(dir_fd, "ID-mapping supported open failed for '%s' : %m", path);
|
||||
return log_debug_errno(dir_fd, "Failed to open '%s', cannot determine if ID-mapping is supported: %m", path);
|
||||
|
||||
mount_fd = RET_NERRNO(open_tree(dir_fd, "", AT_EMPTY_PATH | OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC));
|
||||
if (ERRNO_IS_NEG_NOT_SUPPORTED(mount_fd) || ERRNO_IS_NEG_PRIVILEGE(mount_fd) || mount_fd == -EINVAL)
|
||||
return false;
|
||||
if (mount_fd < 0)
|
||||
return log_debug_errno(mount_fd, "ID-mapping supported open_tree failed for '%s' : %m", path);
|
||||
return log_debug_errno(mount_fd, "Failed to open mount tree '%s', cannot determine if ID-mapping is supported: %m", path);
|
||||
|
||||
r = RET_NERRNO(mount_setattr(mount_fd, "", AT_EMPTY_PATH,
|
||||
&(struct mount_attr) {
|
||||
|
@ -554,7 +558,7 @@ int is_idmapping_supported(const char *path) {
|
|||
if (ERRNO_IS_NEG_NOT_SUPPORTED(r) || ERRNO_IS_NEG_PRIVILEGE(r) || r == -EINVAL)
|
||||
return false;
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "ID-mapping supported setattr failed for '%s' : %m", path);
|
||||
return log_debug_errno(r, "Failed to set mount attribute to '%s', cannot determine if ID-mapping is supported: %m", path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -123,14 +123,14 @@ static int run(int argc, char *argv[]) {
|
|||
|
||||
log_setup();
|
||||
|
||||
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
|
||||
|
||||
if (!arg_doit) {
|
||||
log_info("Checking battery status and AC power existence is disabled by the kernel command line, skipping execution.");
|
||||
return 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ static void test_get_bcd_title_one(
|
|||
assert_se(!title);
|
||||
}
|
||||
|
||||
TEST(get_bcd_title) {
|
||||
TEST(get_bcd_title, .proc_mounted = true) {
|
||||
test_get_bcd_title_one("test-bcd/win10.bcd.zst", u"Windows 10", sizeof(u"Windows 10"));
|
||||
|
||||
test_get_bcd_title_one("test-bcd/description-bad-type.bcd.zst", NULL, 0);
|
||||
|
@ -52,7 +52,7 @@ TEST(get_bcd_title) {
|
|||
test_get_bcd_title_one("test-bcd/empty.bcd.zst", NULL, 0);
|
||||
}
|
||||
|
||||
TEST(base_block) {
|
||||
TEST(base_block, .proc_mounted = true) {
|
||||
size_t len;
|
||||
BaseBlock backup;
|
||||
uint8_t *bcd_base;
|
||||
|
@ -89,7 +89,7 @@ TEST(base_block) {
|
|||
*bcd = backup;
|
||||
}
|
||||
|
||||
TEST(bad_bcd) {
|
||||
TEST(bad_bcd, .proc_mounted = true) {
|
||||
size_t len;
|
||||
uint8_t *hbins;
|
||||
uint32_t offset;
|
||||
|
|
|
@ -98,16 +98,11 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||
}
|
||||
}
|
||||
|
||||
#if HAVE_SYSV_COMPAT
|
||||
else if (streq(key, "fastboot") && !value) {
|
||||
log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.");
|
||||
else if (streq(key, "fastboot") && !value)
|
||||
arg_skip = true;
|
||||
|
||||
} else if (streq(key, "forcefsck") && !value) {
|
||||
log_warning("Please pass 'fsck.mode=force' rather than 'forcefsck' on the kernel command line.");
|
||||
else if (streq(key, "forcefsck") && !value)
|
||||
arg_force = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "fd-util.h"
|
||||
#include "fuzz.h"
|
||||
#include "json-util.h"
|
||||
#include "stat-util.h"
|
||||
#include "strv.h"
|
||||
|
||||
static int json_dispatch_config(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) {
|
||||
|
@ -90,6 +91,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
if (outside_size_range(size, 0, 65536))
|
||||
return 0;
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return EXIT_TEST_SKIP;
|
||||
|
||||
fuzz_setup_logging();
|
||||
|
||||
assert_se(datadup = memdup_suffix0(data, size));
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
if ! mountpoint /proc; then
|
||||
echo "procfs is not available, skipping"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
export SYSTEMD_LOG_LEVEL=debug
|
||||
|
||||
kernel_install="${1:?}"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "fuzz.h"
|
||||
#include "path-util.h"
|
||||
#include "rm-rf.h"
|
||||
#include "stat-util.h"
|
||||
#include "tmpfile-util.h"
|
||||
|
||||
/* stub out network so that the server doesn't send */
|
||||
|
@ -74,6 +75,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
if (size < sizeof(DHCPMessage))
|
||||
return 0;
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return EXIT_TEST_SKIP;
|
||||
|
||||
fuzz_setup_logging();
|
||||
|
||||
assert_se(duped = memdup(data, size));
|
||||
|
|
|
@ -143,7 +143,7 @@ static void* client(void *p) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
TEST(description) {
|
||||
TEST(description, .proc_mounted = true) {
|
||||
_cleanup_free_ char *a = NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
union sockaddr_union sa = {
|
||||
|
|
|
@ -544,7 +544,7 @@ static void test_inotify_one(unsigned n_create_events) {
|
|||
sd_event_unref(e);
|
||||
}
|
||||
|
||||
TEST(inotify) {
|
||||
TEST(inotify, .proc_mounted = true) {
|
||||
test_inotify_one(100); /* should work without overflow */
|
||||
test_inotify_one(33000); /* should trigger a q overflow */
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ static int pidfd_handler(sd_event_source *s, const siginfo_t *si, void *userdata
|
|||
return 0;
|
||||
}
|
||||
|
||||
TEST(pidfd) {
|
||||
TEST(pidfd, .proc_mounted = true) {
|
||||
sd_event_source *s = NULL, *t = NULL;
|
||||
sd_event *e = NULL;
|
||||
int pidfd;
|
||||
|
@ -757,7 +757,7 @@ static int inotify_self_destroy_handler(sd_event_source *s, const struct inotify
|
|||
return 1;
|
||||
}
|
||||
|
||||
TEST(inotify_self_destroy) {
|
||||
TEST(inotify_self_destroy, .proc_mounted = true) {
|
||||
_cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL;
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
char path[] = "/tmp/inotifyXXXXXX";
|
||||
|
@ -793,7 +793,7 @@ static int inotify_process_buffered_data_handler(sd_event_source *s, const struc
|
|||
return 1;
|
||||
}
|
||||
|
||||
TEST(inotify_process_buffered_data) {
|
||||
TEST(inotify_process_buffered_data, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *p = NULL, *q = NULL;
|
||||
_cleanup_(sd_event_source_unrefp) sd_event_source *a = NULL, *b = NULL;
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
|
|
|
@ -578,7 +578,7 @@ static void test_sequence_numbers_one(void) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(sequence_numbers) {
|
||||
TEST(sequence_numbers, .proc_mounted = true) {
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_JOURNAL_COMPACT", "0", 1));
|
||||
test_sequence_numbers_one();
|
||||
|
||||
|
@ -869,7 +869,7 @@ static void test_generic_array_bisect_one(size_t n, size_t num_corrupted) {
|
|||
verify(f, seqnum, offset_candidates, offset, n);
|
||||
}
|
||||
|
||||
TEST(generic_array_bisect) {
|
||||
TEST(generic_array_bisect, .proc_mounted = true) {
|
||||
for (size_t n = 1; n < 10; n++)
|
||||
for (size_t m = 1; m <= n; m++)
|
||||
test_generic_array_bisect_one(n, m);
|
||||
|
|
|
@ -181,6 +181,9 @@ int main(int argc, char *argv[]) {
|
|||
if (access("/etc/machine-id", F_OK) != 0)
|
||||
return log_tests_skipped("/etc/machine-id not found");
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
/* Run this test multiple times with different configurations of features. */
|
||||
|
|
|
@ -180,6 +180,9 @@ int main(int argc, char *argv[]) {
|
|||
const char *verification_key = NULL;
|
||||
int max_iterations = 512;
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
if (argc > 1) {
|
||||
/* Don't limit the number of iterations when the verification key
|
||||
* is provided on the command line, we want to do that only in CIs */
|
||||
|
|
|
@ -118,7 +118,7 @@ static void test_non_empty_one(void) {
|
|||
puts("------------------------------------------------------------");
|
||||
}
|
||||
|
||||
TEST(non_empty) {
|
||||
TEST(non_empty, .proc_mounted = true) {
|
||||
assert_se(setenv("SYSTEMD_JOURNAL_COMPACT", "0", 1) >= 0);
|
||||
test_non_empty_one();
|
||||
|
||||
|
@ -258,7 +258,7 @@ static void test_min_compress_size_one(void) {
|
|||
assert_se(!check_compressed(256, 255));
|
||||
}
|
||||
|
||||
TEST(min_compress_size) {
|
||||
TEST(min_compress_size, .proc_mounted = true) {
|
||||
assert_se(setenv("SYSTEMD_JOURNAL_COMPACT", "0", 1) >= 0);
|
||||
test_min_compress_size_one();
|
||||
|
||||
|
|
|
@ -101,18 +101,19 @@ static int help(int argc, char *argv[], void *userdata) {
|
|||
" -j Same as --json=pretty on tty, --json=short otherwise\n"
|
||||
" --append=PATH Load specified JSON signature, and append new signature to it\n"
|
||||
"\n%3$sUKI PE Section Options:%4$s %3$sUKI PE Section%4$s\n"
|
||||
" --linux=PATH Path to Linux kernel image file %7$s .linux\n"
|
||||
" --osrel=PATH Path to os-release file %7$s .osrel\n"
|
||||
" --cmdline=PATH Path to file with kernel command line %7$s .cmdline\n"
|
||||
" --initrd=PATH Path to initrd image file %7$s .initrd\n"
|
||||
" --ucode=PATH Path to microcode image file %7$s .ucode\n"
|
||||
" --splash=PATH Path to splash bitmap file %7$s .splash\n"
|
||||
" --dtb=PATH Path to DeviceTree file %7$s .dtb\n"
|
||||
" --uname=PATH Path to 'uname -r' file %7$s .uname\n"
|
||||
" --sbat=PATH Path to SBAT file %7$s .sbat\n"
|
||||
" --pcrpkey=PATH Path to public key for PCR signatures %7$s .pcrpkey\n"
|
||||
" --profile=PATH Path to profile file %7$s .profile\n"
|
||||
" --hwids=PATH Path to HWIDs file %7$s .hwids\n"
|
||||
" --linux=PATH Path to Linux kernel image file %7$s .linux\n"
|
||||
" --osrel=PATH Path to os-release file %7$s .osrel\n"
|
||||
" --cmdline=PATH Path to file with kernel command line %7$s .cmdline\n"
|
||||
" --initrd=PATH Path to initrd image file %7$s .initrd\n"
|
||||
" --ucode=PATH Path to microcode image file %7$s .ucode\n"
|
||||
" --splash=PATH Path to splash bitmap file %7$s .splash\n"
|
||||
" --dtb=PATH Path to DeviceTree file %7$s .dtb\n"
|
||||
" --dtbauto=PATH Path to DeviceTree file for auto selection %7$s .dtbauto\n"
|
||||
" --uname=PATH Path to 'uname -r' file %7$s .uname\n"
|
||||
" --sbat=PATH Path to SBAT file %7$s .sbat\n"
|
||||
" --pcrpkey=PATH Path to public key for PCR signatures %7$s .pcrpkey\n"
|
||||
" --profile=PATH Path to profile file %7$s .profile\n"
|
||||
" --hwids=PATH Path to HWIDs file %7$s .hwids\n"
|
||||
"\nSee the %2$s for details.\n",
|
||||
program_invocation_short_name,
|
||||
link,
|
||||
|
|
|
@ -209,7 +209,7 @@ static void test_config_parse_address_one(const char *rvalue, int family, unsign
|
|||
}
|
||||
}
|
||||
|
||||
TEST(config_parse_address) {
|
||||
TEST(config_parse_address, .proc_mounted = true) {
|
||||
test_config_parse_address_one("", AF_INET, 0, NULL, 0);
|
||||
test_config_parse_address_one("/", AF_INET, 0, NULL, 0);
|
||||
test_config_parse_address_one("/8", AF_INET, 0, NULL, 0);
|
||||
|
|
|
@ -2280,10 +2280,9 @@ static int copy_devnode_one(const char *dest, const char *node, bool ignore_mkno
|
|||
r = path_extract_directory(from, &parent);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to extract directory from %s: %m", from);
|
||||
if (!path_equal(parent, "/dev/")) {
|
||||
if (userns_mkdir(dest, parent, 0755, 0, 0) < 0)
|
||||
return log_error_errno(r, "Failed to create directory %s: %m", parent);
|
||||
}
|
||||
r = userns_mkdir(dest, parent, 0755, 0, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create directory %s: %m", parent);
|
||||
|
||||
if (mknod(to, st.st_mode, st.st_rdev) < 0) {
|
||||
r = -errno; /* Save the original error code. */
|
||||
|
@ -4654,7 +4653,7 @@ static int nspawn_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t r
|
|||
|
||||
ucred = CMSG_FIND_DATA(&msghdr, SOL_SOCKET, SCM_CREDENTIALS, struct ucred);
|
||||
if (!ucred || ucred->pid != inner_child_pid) {
|
||||
log_debug("Received notify message without valid credentials. Ignoring.");
|
||||
log_debug("Received notify message from process that is not the payload's PID 1. Ignoring.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,14 +36,9 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||
arg_skip = true;
|
||||
else
|
||||
log_warning("Invalid quotacheck.mode= value, ignoring: %s", value);
|
||||
}
|
||||
|
||||
#if HAVE_SYSV_COMPAT
|
||||
else if (streq(key, "forcequotacheck") && !value) {
|
||||
log_warning("Please use 'quotacheck.mode=force' rather than 'forcequotacheck' on the kernel command line. Proceeding anyway.");
|
||||
} else if (streq(key, "forcequotacheck") && !value)
|
||||
arg_force = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -51,8 +51,16 @@ static void load_testdata_env(void) {
|
|||
return;
|
||||
called = true;
|
||||
|
||||
assert_se(readlink_and_make_absolute("/proc/self/exe", &s) >= 0);
|
||||
assert_se(path_extract_directory(s, &d) >= 0);
|
||||
r = readlink_and_make_absolute("/proc/self/exe", &s);
|
||||
if (r >= 0)
|
||||
assert_se(path_extract_directory(s, &d) >= 0);
|
||||
else {
|
||||
_cleanup_free_ char *program = NULL;
|
||||
|
||||
log_debug_errno(r, "Failed to determine executable's directory, using current directory: %m");
|
||||
assert_se(path_make_absolute_cwd(program_invocation_name, &program) >= 0);
|
||||
assert_se(path_extract_directory(program, &d) >= 0);
|
||||
}
|
||||
assert_se(envpath = path_join(d, "systemd-runtest.env"));
|
||||
|
||||
r = load_env_file_pairs(NULL, envpath, &pairs);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "signal-util.h"
|
||||
#include "stat-util.h"
|
||||
#include "static-destruct.h"
|
||||
#include "strv.h"
|
||||
|
||||
|
@ -106,6 +107,7 @@ typedef struct TestFunc {
|
|||
const char * const name;
|
||||
bool has_ret:1;
|
||||
bool sd_booted:1;
|
||||
bool proc_mounted:1;
|
||||
} TestFunc;
|
||||
|
||||
/* See static-destruct.h for an explanation of how this works. */
|
||||
|
@ -162,6 +164,10 @@ static inline int run_test_table(void) {
|
|||
log_info("/* systemd not booted, skipping %s */", t->name);
|
||||
if (t->has_ret && r == EXIT_SUCCESS)
|
||||
r = EXIT_TEST_SKIP;
|
||||
} else if (t->proc_mounted && proc_mounted() <= 0) {
|
||||
log_info("/* procfs is not available, skipping %s */", t->name);
|
||||
if (t->has_ret && r == EXIT_SUCCESS)
|
||||
r = EXIT_TEST_SKIP;
|
||||
} else {
|
||||
log_info("/* %s */", t->name);
|
||||
|
||||
|
|
|
@ -98,15 +98,17 @@ static int delete_dm(DeviceMapper *m) {
|
|||
assert(major(m->devnum) != 0);
|
||||
assert(m->path);
|
||||
|
||||
fd = open(m->path, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
log_debug_errno(errno, "Failed to open DM block device %s for syncing, ignoring: %m", m->path);
|
||||
else {
|
||||
(void) sync_with_progress(fd);
|
||||
fd = safe_close(fd);
|
||||
}
|
||||
|
||||
fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
_cleanup_close_ int block_fd = open(m->path, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
|
||||
if (block_fd < 0)
|
||||
log_debug_errno(errno, "Failed to open DM block device %s for syncing, ignoring: %m", m->path);
|
||||
else
|
||||
(void) sync_with_progress(block_fd);
|
||||
return log_debug_errno(errno, "Failed to open /dev/mapper/control: %m");
|
||||
|
||||
return RET_NERRNO(ioctl(fd, DM_DEV_REMOVE, &(struct dm_ioctl) {
|
||||
.version = {
|
||||
|
|
|
@ -211,10 +211,8 @@ static int sync_making_progress(unsigned long long *prev_dirty) {
|
|||
continue;
|
||||
|
||||
errno = 0;
|
||||
if (sscanf(line, "%*s %llu %*s", &ull) != 1) {
|
||||
log_warning_errno(errno_or_else(EIO), "Failed to parse /proc/meminfo field, ignoring: %m");
|
||||
return false;
|
||||
}
|
||||
if (sscanf(line, "%*s %llu %*s", &ull) != 1)
|
||||
return log_warning_errno(errno_or_else(EIO), "Failed to parse /proc/meminfo field: %m");
|
||||
|
||||
val += ull;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ static void test_mount_points_list_one(const char *fname) {
|
|||
yes_no(m->try_remount_ro));
|
||||
}
|
||||
|
||||
TEST(mount_points_list) {
|
||||
TEST(mount_points_list, .proc_mounted = true) {
|
||||
test_mount_points_list_one(NULL);
|
||||
test_mount_points_list_one("/test-umount/empty.mountinfo");
|
||||
test_mount_points_list_one("/test-umount/garbled.mountinfo");
|
||||
|
@ -60,7 +60,7 @@ static void test_swap_list_one(const char *fname) {
|
|||
log_debug("path=%s", m->path);
|
||||
}
|
||||
|
||||
TEST(swap_list) {
|
||||
TEST(swap_list, .proc_mounted = true) {
|
||||
test_swap_list_one(NULL);
|
||||
test_swap_list_one("/test-umount/example.swaps");
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "fuzz.h"
|
||||
#include "nulstr-util.h"
|
||||
#include "selinux-util.h"
|
||||
#include "stat-util.h"
|
||||
#include "static-destruct.h"
|
||||
#include "stdio-util.h"
|
||||
#include "strv.h"
|
||||
|
@ -22,6 +23,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
if (size > 16*1024)
|
||||
return 0; /* See the comment below about the limit for strv_length(). */
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return EXIT_TEST_SKIP;
|
||||
|
||||
fuzz_setup_logging();
|
||||
|
||||
arg_pager_flags = PAGER_DISABLE; /* We shouldn't execute the pager */
|
||||
|
|
|
@ -84,7 +84,7 @@ TEST(rename_process_invalid) {
|
|||
assert_se(rename_process("") == -EINVAL);
|
||||
}
|
||||
|
||||
TEST(rename_process_multi) {
|
||||
TEST(rename_process_multi, .proc_mounted = true) {
|
||||
pid_t pid;
|
||||
|
||||
pid = fork();
|
||||
|
@ -109,7 +109,7 @@ TEST(rename_process_multi) {
|
|||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(rename_process) {
|
||||
TEST(rename_process, .proc_mounted = true) {
|
||||
test_rename_process_one("foo", 1); /* should always fit */
|
||||
test_rename_process_one("this is a really really long process name, followed by some more words", 0); /* unlikely to fit */
|
||||
test_rename_process_one("1234567", 1); /* should always fit */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "audit-util.h"
|
||||
#include "tests.h"
|
||||
|
||||
TEST(audit_loginuid_from_pid) {
|
||||
TEST(audit_loginuid_from_pid, .proc_mounted = true) {
|
||||
_cleanup_(pidref_done) PidRef self = PIDREF_NULL, pid1 = PIDREF_NULL;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ static void test_path_is_encrypted_one(const char *p, int expect) {
|
|||
assert_se(expect < 0 || ((r > 0) == (expect > 0)));
|
||||
}
|
||||
|
||||
TEST(path_is_encrypted) {
|
||||
TEST(path_is_encrypted, .proc_mounted = true) {
|
||||
int booted = sd_booted(); /* If this is run in build environments such as koji, /dev/ might be a
|
||||
* regular fs. Don't assume too much if not running under systemd. */
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ int main(int argc, char *argv[]) {
|
|||
if (detect_container() > 0)
|
||||
return log_tests_skipped("test-bpf-firewall fails inside LXC and Docker containers: https://github.com/systemd/systemd/issues/9666");
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
ASSERT_OK(getrlimit(RLIMIT_MEMLOCK, &rl));
|
||||
rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, CAN_MEMLOCK_SIZE);
|
||||
(void) setrlimit(RLIMIT_MEMLOCK, &rl);
|
||||
|
|
|
@ -25,7 +25,7 @@ static void test_is_wanted_print_one(bool header) {
|
|||
log_info(" ");
|
||||
}
|
||||
|
||||
TEST(is_wanted_print) {
|
||||
TEST(is_wanted_print, .proc_mounted = true) {
|
||||
test_is_wanted_print_one(true);
|
||||
test_is_wanted_print_one(false); /* run twice to test caching */
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ static void test_chase_extract_filename_one(const char *path, const char *root,
|
|||
ASSERT_STREQ(fname, expected);
|
||||
}
|
||||
|
||||
TEST(chase) {
|
||||
TEST(chase, .proc_mounted = true) {
|
||||
_cleanup_free_ char *result = NULL, *pwd = NULL;
|
||||
_cleanup_close_ int pfd = -EBADF;
|
||||
char *temp;
|
||||
|
@ -727,7 +727,7 @@ TEST(chaseat_prefix_root) {
|
|||
ASSERT_STREQ(ret, expected);
|
||||
}
|
||||
|
||||
TEST(trailing_dot_dot) {
|
||||
TEST(trailing_dot_dot, .proc_mounted = true) {
|
||||
_cleanup_free_ char *path = NULL, *fdpath = NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ static bool has_xattr(const char *p) {
|
|||
return true;
|
||||
}
|
||||
|
||||
TEST(chown_recursive) {
|
||||
TEST(chown_recursive, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
struct stat st;
|
||||
const char *p;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "user-util.h"
|
||||
#include "virt.h"
|
||||
|
||||
TEST(condition_test_path) {
|
||||
TEST(condition_test_path, .proc_mounted = true) {
|
||||
Condition *condition;
|
||||
|
||||
condition = condition_new(CONDITION_PATH_EXISTS, "/bin/sh", false, false);
|
||||
|
@ -508,7 +508,7 @@ TEST(condition_test_firmware_smbios) {
|
|||
condition_free(condition);
|
||||
}
|
||||
|
||||
TEST(condition_test_kernel_command_line) {
|
||||
TEST(condition_test_kernel_command_line, .proc_mounted = true) {
|
||||
Condition *condition;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ static void test_copy_bytes_regular_file_one(const char *src, bool try_reflink,
|
|||
assert_se((uint64_t) buf3.st_size == max_bytes);
|
||||
}
|
||||
|
||||
TEST(copy_bytes_regular_file) {
|
||||
TEST(copy_bytes_regular_file, .proc_mounted = true) {
|
||||
test_copy_bytes_regular_file_one(saved_argv[0], false, UINT64_MAX);
|
||||
test_copy_bytes_regular_file_one(saved_argv[0], true, UINT64_MAX);
|
||||
test_copy_bytes_regular_file_one(saved_argv[0], false, 1000); /* smaller than copy buffer size */
|
||||
|
@ -391,7 +391,7 @@ TEST(copy_bytes_regular_file) {
|
|||
test_copy_bytes_regular_file_one(saved_argv[0], true, 32000);
|
||||
}
|
||||
|
||||
TEST(copy_atomic) {
|
||||
TEST(copy_atomic, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *p = NULL;
|
||||
const char *q;
|
||||
int r;
|
||||
|
@ -409,7 +409,7 @@ TEST(copy_atomic) {
|
|||
assert_se(copy_file_atomic("/etc/fstab", q, 0644, COPY_REPLACE) >= 0);
|
||||
}
|
||||
|
||||
TEST(copy_proc) {
|
||||
TEST(copy_proc, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *p = NULL;
|
||||
_cleanup_free_ char *f = NULL, *a = NULL, *b = NULL;
|
||||
|
||||
|
@ -569,7 +569,7 @@ TEST(copy_lock) {
|
|||
fd = safe_close(fd);
|
||||
}
|
||||
|
||||
TEST(copy_verify_linked) {
|
||||
TEST(copy_verify_linked, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_close_ int tfd = -EBADF, fd_1 = -EBADF, fd_2 = -EBADF;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ static void test_acquire_data_fd_one(unsigned flags) {
|
|||
fd = safe_close(fd);
|
||||
}
|
||||
|
||||
TEST(acquire_data_fd) {
|
||||
TEST(acquire_data_fd, .proc_mounted = true) {
|
||||
test_acquire_data_fd_one(0);
|
||||
test_acquire_data_fd_one(ACQUIRE_NO_DEV_NULL);
|
||||
test_acquire_data_fd_one(ACQUIRE_NO_MEMFD);
|
||||
|
@ -79,7 +79,7 @@ static void assert_equal_fd(int fd1, int fd2) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(copy_data_fd) {
|
||||
TEST(copy_data_fd, .proc_mounted = true) {
|
||||
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
|
||||
_cleanup_close_pair_ int sfd[2] = EBADF_PAIR;
|
||||
_cleanup_(sigkill_waitp) pid_t pid = -1;
|
||||
|
|
|
@ -158,7 +158,7 @@ TEST(fd_move_above_stdio) {
|
|||
assert_se(close_nointr(new_fd) != EBADF);
|
||||
}
|
||||
|
||||
TEST(rearrange_stdio) {
|
||||
TEST(rearrange_stdio, .proc_mounted = true) {
|
||||
pid_t pid;
|
||||
int r;
|
||||
|
||||
|
@ -363,7 +363,7 @@ static int seccomp_prohibit_close_range(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
TEST(close_all_fds) {
|
||||
TEST(close_all_fds, .proc_mounted = true) {
|
||||
int r;
|
||||
|
||||
/* Runs the test four times. Once as is. Once with close_range() syscall blocked via seccomp, once
|
||||
|
@ -433,7 +433,7 @@ TEST(format_proc_fd_path) {
|
|||
ASSERT_STREQ(FORMAT_PROC_FD_PATH(2147483647), "/proc/self/fd/2147483647");
|
||||
}
|
||||
|
||||
TEST(fd_reopen) {
|
||||
TEST(fd_reopen, .proc_mounted = true) {
|
||||
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
|
||||
struct stat st1, st2;
|
||||
int fl;
|
||||
|
@ -697,7 +697,7 @@ TEST(fds_are_same_mount) {
|
|||
assert_se(fds_are_same_mount(fd2, fd3) > 0);
|
||||
}
|
||||
|
||||
TEST(fd_get_path) {
|
||||
TEST(fd_get_path, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_close_ int tfd = -EBADF, fd = -EBADF;
|
||||
_cleanup_free_ char *p = NULL, *q = NULL, *saved_cwd = NULL;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
|
||||
TEST(fdset_new_fill) {
|
||||
TEST(fdset_new_fill, .proc_mounted = true) {
|
||||
_cleanup_fdset_free_ FDSet *fdset = NULL;
|
||||
int fd = -EBADF, flags;
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ TEST(status_field) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(capeff) {
|
||||
TEST(capeff, .proc_mounted = true) {
|
||||
for (int pid = 0; pid < 2; pid++) {
|
||||
_cleanup_free_ char *capeff = NULL;
|
||||
int r, p;
|
||||
|
@ -485,7 +485,7 @@ TEST(write_string_file_no_create) {
|
|||
ASSERT_STREQ(buf, "boohoo\n");
|
||||
}
|
||||
|
||||
TEST(write_string_file_verify) {
|
||||
TEST(write_string_file_verify, .proc_mounted = true) {
|
||||
_cleanup_free_ char *buf = NULL, *buf2 = NULL;
|
||||
int r;
|
||||
|
||||
|
@ -525,7 +525,7 @@ static void check_file_pairs_one(char **l) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(load_env_file_pairs) {
|
||||
TEST(load_env_file_pairs, .proc_mounted = true) {
|
||||
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-load_env_file_pairs-XXXXXX";
|
||||
int fd, r;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
|
@ -940,7 +940,7 @@ TEST(read_nul_string) {
|
|||
assert_se(read_nul_string(f, LONG_LINE_MAX, &s) == 0 && streq_ptr(s, ""));
|
||||
}
|
||||
|
||||
TEST(read_full_file_socket) {
|
||||
TEST(read_full_file_socket, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *z = NULL;
|
||||
_cleanup_close_ int listener = -EBADF;
|
||||
_cleanup_free_ char *data = NULL, *clientname = NULL;
|
||||
|
@ -1106,7 +1106,7 @@ TEST(read_virtual_file) {
|
|||
test_read_virtual_file_one(SIZE_MAX);
|
||||
}
|
||||
|
||||
TEST(fdopen_independent) {
|
||||
TEST(fdopen_independent, .proc_mounted = true) {
|
||||
#define TEST_TEXT "this is some random test text we are going to write to a memfd"
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
|
|
|
@ -683,7 +683,7 @@ TEST(openat_report_new) {
|
|||
ASSERT_FALSE(b);
|
||||
}
|
||||
|
||||
TEST(xopenat_full) {
|
||||
TEST(xopenat_full, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_close_ int tfd = -EBADF, fd = -EBADF, fd2 = -EBADF;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "tmpfile-util.h"
|
||||
#include "umask-util.h"
|
||||
|
||||
TEST(install_file) {
|
||||
TEST(install_file, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *p = NULL;
|
||||
_cleanup_free_ char *a = NULL, *b = NULL, *c = NULL;
|
||||
struct stat stat1, stat2;
|
||||
|
|
|
@ -1265,7 +1265,7 @@ TEST(parse_continue) {
|
|||
assert_se(sd_json_parse_with_source_continue(&p, "piff", /* flags= */ 0, &x, &line, &column) == -EINVAL);
|
||||
}
|
||||
|
||||
TEST(pidref) {
|
||||
TEST(pidref, .proc_mounted = true) {
|
||||
_cleanup_(pidref_done) PidRef myself = PIDREF_NULL, pid1 = PIDREF_NULL;
|
||||
|
||||
assert_se(pidref_set_pid(&myself, 0) >= 0);
|
||||
|
@ -1349,7 +1349,7 @@ TEST(devnum) {
|
|||
ASSERT_FAIL(json_dispatch_devnum("devnum", v, /* flags= */ 0, &parsed));
|
||||
}
|
||||
|
||||
TEST(fd_info) {
|
||||
TEST(fd_info, .proc_mounted = true) {
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
|
||||
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
|
|
@ -224,15 +224,14 @@ static int run(int argc, char *argv[]) {
|
|||
dissected = dissected_image_unref(dissected);
|
||||
#endif
|
||||
|
||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0) {
|
||||
log_tests_skipped("not running privileged");
|
||||
return 0;
|
||||
}
|
||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
|
||||
return log_tests_skipped("not running privileged");
|
||||
|
||||
if (detect_container() > 0) {
|
||||
log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
|
||||
return 0;
|
||||
}
|
||||
if (detect_container() > 0)
|
||||
return log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, 0, LO_FLAGS_PARTSCAN, LOCK_EX, &loop) >= 0);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ static int fake_pressure_callback(sd_event_source *s, void *userdata) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
TEST(fake_pressure) {
|
||||
TEST(fake_pressure, .proc_mounted = true) {
|
||||
_cleanup_(sd_event_source_unrefp) sd_event_source *es = NULL, *ef = NULL;
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
_cleanup_free_ char *j = NULL, *k = NULL;
|
||||
|
|
|
@ -130,7 +130,7 @@ TEST(mount_flags_to_string) {
|
|||
"MS_I_VERSION|MS_STRICTATIME|MS_LAZYTIME|fc000200");
|
||||
}
|
||||
|
||||
TEST(bind_remount_recursive) {
|
||||
TEST(bind_remount_recursive, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *tmp = NULL;
|
||||
_cleanup_free_ char *subdir = NULL;
|
||||
|
||||
|
@ -184,7 +184,7 @@ TEST(bind_remount_recursive) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(bind_remount_one) {
|
||||
TEST(bind_remount_one, .proc_mounted = true) {
|
||||
pid_t pid;
|
||||
|
||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0) {
|
||||
|
@ -279,7 +279,7 @@ TEST(make_mount_point_inode) {
|
|||
assert_se(!(S_IXOTH & st.st_mode));
|
||||
}
|
||||
|
||||
TEST(make_mount_switch_root) {
|
||||
TEST(make_mount_switch_root, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_free_ char *s = NULL;
|
||||
int r;
|
||||
|
@ -333,7 +333,7 @@ TEST(make_mount_switch_root) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(umount_recursive) {
|
||||
TEST(umount_recursive, .proc_mounted = true) {
|
||||
static const struct {
|
||||
const char *prefix;
|
||||
const char * const keep[3];
|
||||
|
@ -418,7 +418,7 @@ TEST(umount_recursive) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(fd_make_mount_point) {
|
||||
TEST(fd_make_mount_point, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_free_ char *s = NULL;
|
||||
int r;
|
||||
|
@ -467,7 +467,7 @@ TEST(fd_make_mount_point) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(bind_mount_submounts) {
|
||||
TEST(bind_mount_submounts, .proc_mounted = true) {
|
||||
_cleanup_(rmdir_and_freep) char *a = NULL, *b = NULL;
|
||||
_cleanup_free_ char *x = NULL;
|
||||
int r;
|
||||
|
@ -537,7 +537,7 @@ TEST(bind_mount_submounts) {
|
|||
assert_se(umount_recursive(b, 0) >= 0);
|
||||
}
|
||||
|
||||
TEST(path_is_network_fs_harder) {
|
||||
TEST(path_is_network_fs_harder, .proc_mounted = true) {
|
||||
_cleanup_close_ int dir_fd = -EBADF;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -445,6 +445,9 @@ static int intro(void) {
|
|||
/* let's move into our own mount namespace with all propagation from the host turned off, so
|
||||
* that /proc/self/mountinfo is static and constant for the whole time our test runs. */
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
if (unshare(CLONE_NEWNS) < 0) {
|
||||
if (!ERRNO_IS_PRIVILEGE(errno))
|
||||
return log_error_errno(errno, "Failed to detach mount namespace: %m");
|
||||
|
|
|
@ -19,7 +19,7 @@ TEST(path_is_os_tree) {
|
|||
assert_se(path_is_os_tree("/idontexist") == -ENOENT);
|
||||
}
|
||||
|
||||
TEST(parse_os_release) {
|
||||
TEST(parse_os_release, .proc_mounted = true) {
|
||||
_cleanup_free_ char *id = NULL, *id2 = NULL, *name = NULL, *foobar = NULL;
|
||||
|
||||
if (access("/etc/os-release", F_OK) >= 0 || access("/usr/lib/os-release", F_OK) >= 0) {
|
||||
|
@ -61,7 +61,7 @@ TEST(parse_os_release) {
|
|||
ASSERT_OK_ERRNO(unsetenv("SYSTEMD_OS_RELEASE"));
|
||||
}
|
||||
|
||||
TEST(parse_extension_release) {
|
||||
TEST(parse_extension_release, .proc_mounted = true) {
|
||||
/* Let's assume that we have a valid extension image */
|
||||
_cleanup_free_ char *id = NULL, *version_id = NULL, *foobar = NULL, *a = NULL, *b = NULL;
|
||||
_cleanup_(rm_rf_physical_and_freep) char *tempdir = NULL;
|
||||
|
@ -104,7 +104,7 @@ TEST(parse_extension_release) {
|
|||
ASSERT_NULL(foobar);
|
||||
}
|
||||
|
||||
TEST(load_os_release_pairs) {
|
||||
TEST(load_os_release_pairs, .proc_mounted = true) {
|
||||
_cleanup_(unlink_tempfilep) char tmpfile[] = "/tmp/test-os-util.XXXXXX";
|
||||
ASSERT_EQ(write_tmpfile(tmpfile,
|
||||
"ID=\"ignored\" \n"
|
||||
|
|
|
@ -421,7 +421,7 @@ TEST(find_executable_full) {
|
|||
assert_se(find_executable_full(test_file_name, NULL, STRV_MAKE("/doesnotexist", "/tmp", "/bin"), false, &p, NULL) == -ENOENT);
|
||||
}
|
||||
|
||||
TEST(find_executable) {
|
||||
TEST(find_executable, .proc_mounted = true) {
|
||||
char *p;
|
||||
|
||||
assert_se(find_executable("/bin/sh", &p) == 0);
|
||||
|
|
|
@ -60,7 +60,7 @@ TEST(pidref_set_pidstr) {
|
|||
assert_se(!pidref_equal(&pidref, &PIDREF_MAKE_FROM_PID(getpid_cached()+1)));
|
||||
}
|
||||
|
||||
TEST(pidref_set_pidfd) {
|
||||
TEST(pidref_set_pidfd, .proc_mounted = true) {
|
||||
_cleanup_(pidref_done) PidRef a = PIDREF_NULL, b = PIDREF_NULL, c = PIDREF_NULL, d = PIDREF_NULL;
|
||||
|
||||
assert_se(pidref_set_self(&a) >= 0);
|
||||
|
@ -211,7 +211,7 @@ TEST(pidref_done_sigkill_wait) {
|
|||
freeze();
|
||||
}
|
||||
|
||||
TEST(pidref_verify) {
|
||||
TEST(pidref_verify, .proc_mounted = true) {
|
||||
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
|
||||
|
||||
assert_se(pidref_verify(NULL) == -ESRCH);
|
||||
|
|
|
@ -24,7 +24,7 @@ static int parse_item(const char *key, const char *value, void *data) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
TEST(proc_cmdline_parse) {
|
||||
TEST(proc_cmdline_parse, .proc_mounted = true) {
|
||||
assert_se(proc_cmdline_parse(parse_item, &obj, PROC_CMDLINE_STRIP_RD_PREFIX) >= 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ static void test_pid_get_comm_one(pid_t pid) {
|
|||
log_info("PID"PID_FMT" $PATH: '%s'", pid, strna(i));
|
||||
}
|
||||
|
||||
TEST(pid_get_comm) {
|
||||
TEST(pid_get_comm, .proc_mounted = true) {
|
||||
if (saved_argc > 1) {
|
||||
pid_t pid = 0;
|
||||
|
||||
|
@ -813,7 +813,7 @@ TEST(setpriority_closest) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(get_process_ppid) {
|
||||
TEST(get_process_ppid, .proc_mounted = true) {
|
||||
uint64_t limit;
|
||||
int r;
|
||||
|
||||
|
@ -850,7 +850,7 @@ TEST(get_process_ppid) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(set_oom_score_adjust) {
|
||||
TEST(set_oom_score_adjust, .proc_mounted = true) {
|
||||
int a, b, r;
|
||||
|
||||
ASSERT_OK(get_oom_score_adjust(&a));
|
||||
|
@ -881,7 +881,7 @@ static void* dummy_thread(void *p) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
TEST(get_process_threads) {
|
||||
TEST(get_process_threads, .proc_mounted = true) {
|
||||
int r;
|
||||
|
||||
/* Run this test in a child, so that we can guarantee there's exactly one thread around in the child */
|
||||
|
@ -973,7 +973,7 @@ TEST(is_reaper_process) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(pid_get_start_time) {
|
||||
TEST(pid_get_start_time, .proc_mounted = true) {
|
||||
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
|
||||
|
||||
ASSERT_OK(pidref_set_self(&pidref));
|
||||
|
|
|
@ -16,6 +16,9 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
assert_se(procfs_cpu_get_usage(&nsec) >= 0);
|
||||
log_info("Current system CPU time: %s", FORMAT_TIMESPAN(nsec/NSEC_PER_USEC, 1));
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ TEST(setrlimit) {
|
|||
assert_se(old.rlim_max == new.rlim_max);
|
||||
}
|
||||
|
||||
TEST(pid_getrlimit) {
|
||||
TEST(pid_getrlimit, .proc_mounted = true) {
|
||||
int r;
|
||||
|
||||
/* We fork off a child and read the parent's resource limit from there (i.e. our own), and compare
|
||||
|
|
|
@ -363,7 +363,7 @@ TEST(restrict_namespace) {
|
|||
assert_se(wait_for_terminate_and_check("nsseccomp", pid, WAIT_LOG) == EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(protect_sysctl) {
|
||||
TEST(protect_sysctl, .proc_mounted = true) {
|
||||
pid_t pid;
|
||||
_cleanup_free_ char *seccomp = NULL;
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ TEST(in_addr_port_ifindex_name_from_string_auto) {
|
|||
test_in_addr_port_ifindex_name_from_string_auto_one("[fe80::18]:53%lo#hoge.com", AF_INET6, 53, 1, "hoge.com", "[fe80::18]:53%1#hoge.com");
|
||||
}
|
||||
|
||||
TEST(netns_get_nsid) {
|
||||
TEST(netns_get_nsid, .proc_mounted = true) {
|
||||
uint32_t u;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -542,7 +542,7 @@ TEST(ipv6_enabled) {
|
|||
log_info("IPv6 enabled: %s", yes_no(socket_ipv6_is_enabled()));
|
||||
}
|
||||
|
||||
TEST(sockaddr_un_set_path) {
|
||||
TEST(sockaddr_un_set_path, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_(unlink_and_freep) char *sh = NULL;
|
||||
_cleanup_free_ char *j = NULL;
|
||||
|
|
|
@ -56,7 +56,7 @@ static const Specifier specifier_table[] = {
|
|||
{}
|
||||
};
|
||||
|
||||
TEST(specifier_printf) {
|
||||
TEST(specifier_printf, .proc_mounted = true) {
|
||||
static const Specifier table[] = {
|
||||
{ 'X', specifier_string, (char*) "AAAA" },
|
||||
{ 'Y', specifier_string, (char*) "BBBB" },
|
||||
|
@ -128,7 +128,7 @@ TEST(specifier_real_path_missing_file) {
|
|||
assert_se(r == -ENOENT);
|
||||
}
|
||||
|
||||
TEST(specifiers) {
|
||||
TEST(specifiers, .proc_mounted = true) {
|
||||
int r;
|
||||
|
||||
for (const Specifier *s = specifier_table; s->specifier; s++) {
|
||||
|
@ -173,7 +173,7 @@ TEST(specifiers_assorted) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(specifiers_missing_data_ok) {
|
||||
TEST(specifiers_missing_data_ok, .proc_mounted = true) {
|
||||
_cleanup_free_ char *resolved = NULL;
|
||||
|
||||
assert_se(setenv("SYSTEMD_OS_RELEASE", "/dev/null", 1) == 0);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
|
||||
TEST(null_or_empty_path) {
|
||||
TEST(null_or_empty_path, .proc_mounted = true) {
|
||||
assert_se(null_or_empty_path("/dev/null") == 1);
|
||||
assert_se(null_or_empty_path("/dev/tty") == 1); /* We assume that any character device is "empty", bleh. */
|
||||
assert_se(null_or_empty_path("../../../../../../../../../../../../../../../../../../../../dev/null") == 1);
|
||||
|
@ -30,7 +30,7 @@ TEST(null_or_empty_path) {
|
|||
assert_se(null_or_empty_path("/nosuchfileordir") == -ENOENT);
|
||||
}
|
||||
|
||||
TEST(null_or_empty_path_with_root) {
|
||||
TEST(null_or_empty_path_with_root, .proc_mounted = true) {
|
||||
assert_se(null_or_empty_path_with_root("/dev/null", NULL) == 1);
|
||||
assert_se(null_or_empty_path_with_root("/dev/null", "/") == 1);
|
||||
assert_se(null_or_empty_path_with_root("/dev/null", "/.././../") == 1);
|
||||
|
@ -46,7 +46,7 @@ TEST(null_or_empty_path_with_root) {
|
|||
assert_se(null_or_empty_path_with_root("/foobar/barbar/dev/null", "/foobar/barbar/") == 1);
|
||||
}
|
||||
|
||||
TEST(inode_same) {
|
||||
TEST(inode_same, .proc_mounted = true) {
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
_cleanup_(unlink_tempfilep) char name[] = "/tmp/test-files_same.XXXXXX";
|
||||
_cleanup_(unlink_tempfilep) char name_alias[] = "/tmp/test-files_same.alias";
|
||||
|
@ -190,7 +190,7 @@ TEST(fd_is_ns) {
|
|||
assert_se(IN_SET(fd_is_ns(fd, CLONE_NEWNET), 1, -EUCLEAN));
|
||||
}
|
||||
|
||||
TEST(dir_is_empty) {
|
||||
TEST(dir_is_empty, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *empty_dir = NULL;
|
||||
_cleanup_free_ char *j = NULL, *jj = NULL, *jjj = NULL;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ TEST(sysctl_normalize) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(sysctl_read) {
|
||||
TEST(sysctl_read, .proc_mounted = true) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
struct utsname u;
|
||||
sd_id128_t a, b;
|
||||
|
|
|
@ -70,7 +70,7 @@ TEST(read_one_char) {
|
|||
assert_se(read_one_char(file, &r, 1000000, &need_nl) < 0);
|
||||
}
|
||||
|
||||
TEST(getttyname_malloc) {
|
||||
TEST(getttyname_malloc, .proc_mounted = true) {
|
||||
_cleanup_free_ char *ttyname = NULL;
|
||||
_cleanup_close_ int master = -EBADF;
|
||||
|
||||
|
@ -214,7 +214,7 @@ TEST(terminal_fix_size) {
|
|||
log_notice("Fixed terminal size.");
|
||||
}
|
||||
|
||||
TEST(terminal_is_pty_fd) {
|
||||
TEST(terminal_is_pty_fd, .proc_mounted = true) {
|
||||
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
|
||||
int r;
|
||||
|
||||
|
@ -294,7 +294,7 @@ TEST(terminal_reset_defensive) {
|
|||
log_notice_errno(r, "Failed to reset terminal: %m");
|
||||
}
|
||||
|
||||
TEST(pty_open_peer) {
|
||||
TEST(pty_open_peer, .proc_mounted = true) {
|
||||
_cleanup_close_ int pty_fd = -EBADF, peer_fd = -EBADF;
|
||||
_cleanup_free_ char *pty_path = NULL;
|
||||
|
||||
|
|
|
@ -461,7 +461,7 @@ static void test_format_timestamp_with_tz_one(const char *tz) {
|
|||
tzset();
|
||||
}
|
||||
|
||||
TEST(FORMAT_TIMESTAMP_with_tz) {
|
||||
TEST(FORMAT_TIMESTAMP_with_tz, .proc_mounted = true) {
|
||||
_cleanup_strv_free_ char **timezones = NULL;
|
||||
|
||||
test_format_timestamp_with_tz_one("UTC");
|
||||
|
|
|
@ -242,7 +242,7 @@ TEST(tempfn_random_child) {
|
|||
test_tempfn_random_child_one(p, "hoge", q, 0);
|
||||
}
|
||||
|
||||
TEST(link_tmpfile) {
|
||||
TEST(link_tmpfile, .proc_mounted = true) {
|
||||
_cleanup_free_ char *cmd = NULL, *cmd2 = NULL, *ans = NULL, *ans2 = NULL, *d = NULL, *tmp = NULL, *line = NULL;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *p = saved_argv[1] ?: "/tmp";
|
||||
|
|
|
@ -10,6 +10,9 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
if (proc_mounted() <= 0)
|
||||
return log_tests_skipped("procfs not available");
|
||||
|
||||
u = umask(0111);
|
||||
|
||||
n = 0;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "tmpfile-util.h"
|
||||
#include "xattr-util.h"
|
||||
|
||||
TEST(getxattr_at_malloc) {
|
||||
TEST(getxattr_at_malloc, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_free_ char *value = NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
@ -86,7 +86,7 @@ static void verify_xattr(int dfd, const char *expected) {
|
|||
ASSERT_STREQ(value, expected);
|
||||
}
|
||||
|
||||
TEST(xsetxattr) {
|
||||
TEST(xsetxattr, .proc_mounted = true) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
|
||||
_cleanup_close_ int dfd = -EBADF, fd = -EBADF;
|
||||
const char *x;
|
||||
|
|
|
@ -960,10 +960,13 @@ exec $(systemctl cat systemd-networkd.service | sed -n '/^ExecStart=/ {{ s/^.*=/
|
|||
|
||||
# wait until devices got created
|
||||
for _ in range(50):
|
||||
out = subprocess.check_output(['ip', 'a', 'show', 'dev', self.if_router])
|
||||
if b'state UP' in out and b'scope global' in out:
|
||||
if subprocess.run(['ip', 'link', 'show', 'dev', self.if_router],
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
subprocess.call(['ip', 'link', 'show', 'dev', self.if_router])
|
||||
self.fail('Timed out waiting for {ifr} created.'.format(ifr=self.if_router))
|
||||
|
||||
def shutdown_iface(self):
|
||||
'''Remove test interface and stop DHCP server'''
|
||||
|
|
|
@ -4,6 +4,11 @@ set -eux
|
|||
shopt -s nullglob
|
||||
shopt -s globstar
|
||||
|
||||
if ! mountpoint /proc; then
|
||||
echo "procfs is not available, skipping"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if [[ -n "${1:-}" ]]; then
|
||||
generator=$1
|
||||
elif [[ -x /usr/lib/systemd/system-generators/systemd-fstab-generator ]]; then
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -ex
|
||||
|
||||
if ! mountpoint /proc; then
|
||||
echo "procfs is not available, skipping"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
# Silence warning from running_in_chroot_or_offline()
|
||||
export SYSTEMD_IN_CHROOT=0
|
||||
|
||||
|
|
|
@ -234,6 +234,11 @@ def test_conditionalized_execute_bit():
|
|||
assert "user:root:rwx" in c.stdout and "group:root:r-x" in c.stdout
|
||||
|
||||
if __name__ == '__main__':
|
||||
# If proc is not mounted, skip the test
|
||||
if not os.path.exists('/proc/self'):
|
||||
print("procfs is not available, skipping")
|
||||
sys.exit(EXIT_TEST_SKIP)
|
||||
|
||||
test_invalids(user=False)
|
||||
test_invalids(user=True)
|
||||
test_uninitialized_t()
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -e
|
||||
|
||||
if ! mountpoint /proc; then
|
||||
echo "procfs is not available, skipping"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
SYSUSERS="${1:-systemd-sysusers}"
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
|
|
|
@ -10,6 +10,11 @@ set -o pipefail
|
|||
BINARY="${1:?}"
|
||||
export SYSTEMD_LOG_LEVEL=info
|
||||
|
||||
if [[ ! -d /proc/self/ ]]; then
|
||||
echo "/proc/self/ is not available, skipping"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if [[ ! -x "$BINARY" ]]; then
|
||||
echo "$BINARY is not an executable"
|
||||
exit 1
|
||||
|
|
|
@ -1,14 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
import os
|
||||
from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
from subprocess import PIPE, run
|
||||
|
||||
|
||||
def extract_interfaces_xml(output_dir, executable):
|
||||
# If proc is not mounted, set LD_LIBRARY_PATH so that shared/core libs can be found
|
||||
env = os.environ.copy()
|
||||
if not os.path.exists('/proc/self'):
|
||||
if 'LD_LIBRARY_PATH' not in env:
|
||||
env["LD_LIBRARY_PATH"] = "src/shared:src/core"
|
||||
else:
|
||||
env["LD_LIBRARY_PATH"] = f"src/shared:src/core:{env['LD_LIBRARY_PATH']}"
|
||||
|
||||
proc = run(
|
||||
args=[executable.absolute(), '--bus-introspect', 'list'],
|
||||
stdout=PIPE,
|
||||
env=env,
|
||||
check=True,
|
||||
universal_newlines=True)
|
||||
|
||||
|
@ -18,6 +28,7 @@ def extract_interfaces_xml(output_dir, executable):
|
|||
proc = run(
|
||||
args=[executable.absolute(), '--bus-introspect', interface_name],
|
||||
stdout=PIPE,
|
||||
env=env,
|
||||
check=True,
|
||||
universal_newlines=True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue