summaryrefslogtreecommitdiffstats
path: root/src/test/test-audit-util.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-11-20 14:44:38 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2024-11-20 17:48:55 +0100
commitdbbe895807264a5cce3362f658141e391a35c5f0 (patch)
treef438963b273c20ccaa7910c320e97fdd5f6aebb9 /src/test/test-audit-util.c
parentcore/exec-invoke: suppress placeholder home only in build_environment() (#35219) (diff)
downloadsystemd-dbbe895807264a5cce3362f658141e391a35c5f0.tar.xz
systemd-dbbe895807264a5cce3362f658141e391a35c5f0.zip
test-audit-util: Migrate to new assertion macros
Diffstat (limited to '')
-rw-r--r--src/test/test-audit-util.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/test/test-audit-util.c b/src/test/test-audit-util.c
index 242a3f16de..75df1426a6 100644
--- a/src/test/test-audit-util.c
+++ b/src/test/test-audit-util.c
@@ -7,24 +7,26 @@ TEST(audit_loginuid_from_pid) {
_cleanup_(pidref_done) PidRef self = PIDREF_NULL, pid1 = PIDREF_NULL;
int r;
- assert_se(pidref_set_self(&self) >= 0);
- assert_se(pidref_set_pid(&pid1, 1) >= 0);
+ ASSERT_OK(pidref_set_self(&self));
+ ASSERT_OK(pidref_set_pid(&pid1, 1));
uid_t uid;
r = audit_loginuid_from_pid(&self, &uid);
- assert_se(r >= 0 || r == -ENODATA);
+ if (r != -ENODATA)
+ ASSERT_OK(r);
if (r >= 0)
log_info("self audit login uid: " UID_FMT, uid);
- assert_se(audit_loginuid_from_pid(&pid1, &uid) == -ENODATA);
+ ASSERT_ERROR(audit_loginuid_from_pid(&pid1, &uid), ENODATA);
uint32_t sessionid;
r = audit_session_from_pid(&self, &sessionid);
- assert_se(r >= 0 || r == -ENODATA);
+ if (r != -ENODATA)
+ ASSERT_OK(r);
if (r >= 0)
log_info("self audit session id: %" PRIu32, sessionid);
- assert_se(audit_session_from_pid(&pid1, &sessionid) == -ENODATA);
+ ASSERT_ERROR(audit_session_from_pid(&pid1, &sessionid), ENODATA);
}
static int intro(void) {