naccyde / rpms / systemd

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