ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ac3a84
From d63a1edb6bef959e8d6a481464a809badcc3a2eb Mon Sep 17 00:00:00 2001
ac3a84
From: Torsten Hilbrich <torsten.hilbrich@secunet.com>
ac3a84
Date: Mon, 7 Nov 2022 08:38:58 +0100
ac3a84
Subject: [PATCH] test: compile test-utmp.c only if UTMP is enabled
ac3a84
MIME-Version: 1.0
ac3a84
Content-Type: text/plain; charset=UTF-8
ac3a84
Content-Transfer-Encoding: 8bit
ac3a84
ac3a84
When compiling with -D utmp=false the compilation fails with:
ac3a84
ac3a84
../../git/systemd/src/test/test-utmp.c: In function ‘test_dump_run_utmp’:
ac3a84
../../git/systemd/src/test/test-utmp.c:21:9: error: cleanup argument not a function
ac3a84
   21 |         _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
ac3a84
      |         ^~~~~~~~
ac3a84
../../git/systemd/src/test/test-utmp.c:23:17: error: implicit declaration of function ‘utxent_start’ [-Werror=implicit-function-declaration]
ac3a84
   23 |         utmpx = utxent_start();
ac3a84
      |                 ^~~~~~~~~~~~
ac3a84
ac3a84
any many other errors
ac3a84
ac3a84
Add a conditional to compile test-utmp.c only if ENABLE_UTMP is true.
ac3a84
ac3a84
(cherry picked from commit 41cac2a8b98fc5faebe942c697b17e109822342d)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/test/meson.build | 3 ++-
ac3a84
 1 file changed, 2 insertions(+), 1 deletion(-)
ac3a84
ac3a84
diff --git a/src/test/meson.build b/src/test/meson.build
ac3a84
index 86fc1d4fc0..2a4dfe26db 100644
ac3a84
--- a/src/test/meson.build
ac3a84
+++ b/src/test/meson.build
ac3a84
@@ -622,7 +622,8 @@ tests += [
ac3a84
 
ac3a84
         [files('test-journal-importer.c')],
ac3a84
 
ac3a84
-        [files('test-utmp.c')],
ac3a84
+        [files('test-utmp.c'),
ac3a84
+         [], [], [], 'ENABLE_UTMP'],
ac3a84
 
ac3a84
         [files('test-udev.c'),
ac3a84
          [libudevd_core,