]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: compile test-utmp.c only if UTMP is enabled
authorTorsten Hilbrich <torsten.hilbrich@secunet.com>
Mon, 7 Nov 2022 07:38:58 +0000 (08:38 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Nov 2022 13:00:42 +0000 (22:00 +0900)
When compiling with -D utmp=false the compilation fails with:

../../git/systemd/src/test/test-utmp.c: In function ‘test_dump_run_utmp’:
../../git/systemd/src/test/test-utmp.c:21:9: error: cleanup argument not a function
   21 |         _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
      |         ^~~~~~~~
../../git/systemd/src/test/test-utmp.c:23:17: error: implicit declaration of function ‘utxent_start’ [-Werror=implicit-function-declaration]
   23 |         utmpx = utxent_start();
      |                 ^~~~~~~~~~~~

any many other errors

Add a conditional to compile test-utmp.c only if ENABLE_UTMP is true.

src/test/meson.build

index 86fc1d4fc0a00714fd3b61d6ce7e3ff6b16882eb..2a4dfe26dbebaeb67d880e008541af2392ab4398 100644 (file)
@@ -622,7 +622,8 @@ tests += [
 
         [files('test-journal-importer.c')],
 
-        [files('test-utmp.c')],
+        [files('test-utmp.c'),
+         [], [], [], 'ENABLE_UTMP'],
 
         [files('test-udev.c'),
          [libudevd_core,