From 4f3da6c74254834091ad757c312c62d136275a5d Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Thu, 9 Jan 2025 17:41:41 +0100 Subject: [PATCH 01/15] Enabled subdir-objects in AM_INIT_AUTOMAKE This way we don't get annoying warnings like: ``` warning: source file '$(srcdir)/../../libutils/statistics.c' is in a subdirectory, but option 'subdir-objects' is disabled ``` Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 92aecdcfec..c5a9b00006 100644 --- a/configure.ac +++ b/configure.ac @@ -69,7 +69,7 @@ m4_define(SERIAL_TESTS, m4_bmatch(AUTOMAKE_VERSION, [^1\.\([0-9]\|1[0-1]\)\(\.\| AC_MSG_RESULT(AUTOMAKE_VERSION) -AM_INIT_AUTOMAKE([tar-ustar] SERIAL_TESTS) +AM_INIT_AUTOMAKE([tar-ustar] SERIAL_TESTS [subdir-objects]) AM_MAINTAINER_MODE([enable]) m4_divert_text([DEFAULTS], [: "${AR_FLAGS=cr}"]) From db9f2f446bdbce258a1f8352ec64fb39d63996cc Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 10:19:19 +0100 Subject: [PATCH 02/15] Fixed warning AC_PROG_LEX without either yywrap or noyywrap is obsolete Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c5a9b00006..d814f0b633 100644 --- a/configure.ac +++ b/configure.ac @@ -143,7 +143,7 @@ m4_ifdef([LT_INIT], [AC_DISABLE_STATIC AC_PROG_LIBTOOL]) -AM_PROG_LEX +AC_PROG_LEX(noyywrap) AC_PROG_YACC AC_PROG_INSTALL AC_PATH_PROG([PERL], [perl]) From ca132a849846d1d3af9cc60323fc7f564509ab7a Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 10:26:23 +0100 Subject: [PATCH 03/15] Ran autoupdate on configure.ac Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- configure.ac | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index d814f0b633..833b4439d2 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ dnl # Run ./autogen.sh to build configure script dnl # dnl ########################################################################## -AC_PREREQ(2.63) +AC_PREREQ([2.71]) m4_define([cfversion_from_env], m4_normalize(m4_esyscmd([echo $EXPLICIT_VERSION]))) m4_define([cfversion_from_file], m4_normalize(m4_esyscmd([cat CFVERSION]))) @@ -46,7 +46,7 @@ m4_ifval(cfversion_from_env, [ ]) -AC_INIT(cfengine, cfversion) +AC_INIT([cfengine],[cfversion]) AC_CONFIG_SRCDIR([libpromises/generic_agent.c]) AC_CANONICAL_TARGET @@ -137,11 +137,11 @@ AS_CASE([${target_os}], dnl GCC specific flags m4_include([m4/cf3_gcc_flags.m4]) -# Use either new LT_INIT or old AC_DISABLE_STATIC/AC_PROG_LIBTOOL macros +# Use either new LT_INIT or old AC_DISABLE_STATIC/LT_INIT macros m4_ifdef([LT_INIT], [LT_INIT([disable-static])], [AC_DISABLE_STATIC - AC_PROG_LIBTOOL]) + LT_INIT]) AC_PROG_LEX(noyywrap) AC_PROG_YACC @@ -820,8 +820,29 @@ AC_CHECK_HEADERS(sys/jail.h, [], [], [AC_INCLUDES_DEFAULT AC_CHECK_HEADERS(net/route.h netinet/in.h netinet/ip.h) -AC_HEADER_STDC -AC_HEADER_TIME +m4_warn([obsolete], +[The preprocessor macro `STDC_HEADERS' is obsolete. + Except in unusual embedded environments, you can safely include all + ISO C90 headers unconditionally.])dnl +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. +AC_CHECK_INCLUDES_DEFAULT +AC_PROG_EGREP + +m4_warn([obsolete], +[Update your code to rely only on HAVE_SYS_TIME_H, +then remove this warning and the obsolete code below it. +All current systems provide time.h; it need not be checked for. +Not all systems provide sys/time.h, but those that do, all allow +you to include it and time.h simultaneously.])dnl +AC_CHECK_HEADERS_ONCE([sys/time.h]) +# Obsolete code to be removed. +if test $ac_cv_header_sys_time_h = yes; then + AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both + and . This macro is obsolete.]) +fi +# End of obsolete code. + AC_HEADER_SYS_WAIT AC_HEADER_DIRENT AC_HEADER_STDBOOL From 54767c854bd775bcf15fc702efbd8d44b4e761bb Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 10:46:37 +0100 Subject: [PATCH 04/15] Fixed warnings after autoupdate Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- configure.ac | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/configure.ac b/configure.ac index 833b4439d2..d9238dfd16 100644 --- a/configure.ac +++ b/configure.ac @@ -819,30 +819,6 @@ AC_CHECK_HEADERS(sys/jail.h, [], [], [AC_INCLUDES_DEFAULT ]) AC_CHECK_HEADERS(net/route.h netinet/in.h netinet/ip.h) - -m4_warn([obsolete], -[The preprocessor macro `STDC_HEADERS' is obsolete. - Except in unusual embedded environments, you can safely include all - ISO C90 headers unconditionally.])dnl -# Autoupdate added the next two lines to ensure that your configure -# script's behavior did not change. They are probably safe to remove. -AC_CHECK_INCLUDES_DEFAULT -AC_PROG_EGREP - -m4_warn([obsolete], -[Update your code to rely only on HAVE_SYS_TIME_H, -then remove this warning and the obsolete code below it. -All current systems provide time.h; it need not be checked for. -Not all systems provide sys/time.h, but those that do, all allow -you to include it and time.h simultaneously.])dnl -AC_CHECK_HEADERS_ONCE([sys/time.h]) -# Obsolete code to be removed. -if test $ac_cv_header_sys_time_h = yes; then - AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both - and . This macro is obsolete.]) -fi -# End of obsolete code. - AC_HEADER_SYS_WAIT AC_HEADER_DIRENT AC_HEADER_STDBOOL From 2e245a1e31c38ee69a8a727e2b18929ddb2ebd2c Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 11:27:21 +0100 Subject: [PATCH 05/15] Fixed warning non-POSIX variable name Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- examples/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index 662351a12e..ad5f6a53bf 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -29,10 +29,10 @@ MAINTAINERCLEANFILES = Makefile.in mdate-sh # only re-run the outputs for examples that already have an example_output block remake: - perl ./remake_outputs.pl $(shell grep -l example_output $(dist_examples_DATA)) + perl ./remake_outputs.pl `shell grep -l example_output $(dist_examples_DATA)` recheck: - perl ./remake_outputs.pl -c $(shell grep -l example_output $(dist_examples_DATA)) + perl ./remake_outputs.pl -c `shell grep -l example_output $(dist_examples_DATA)` recheck_verbose: - perl ./remake_outputs.pl -v -c $(shell grep -l example_output $(dist_examples_DATA)) + perl ./remake_outputs.pl -v -c `shell grep -l example_output $(dist_examples_DATA)` From bf373a5b544afee7b6afb79c04891c18a13df44d Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 12:02:38 +0100 Subject: [PATCH 06/15] Put AC_PREREQ back to version 2.63 We need configure.ac to be supported on older platforms Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d9238dfd16..41f778434a 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ dnl # Run ./autogen.sh to build configure script dnl # dnl ########################################################################## -AC_PREREQ([2.71]) +AC_PREREQ([2.63]) m4_define([cfversion_from_env], m4_normalize(m4_esyscmd([echo $EXPLICIT_VERSION]))) m4_define([cfversion_from_file], m4_normalize(m4_esyscmd([cat CFVERSION]))) From 82a16c28330ce4bf6e51b57b1fc1b8f5d0e63c56 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 14:11:38 +0100 Subject: [PATCH 07/15] Fixed non-POSIX variable name warning ``` tests/acceptance/Makefile.am:103: warning: wildcard [0-9]*: non-POSIX variable name tests/acceptance/Makefile.am:103: (probably a GNU make extension) ``` Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- tests/acceptance/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/Makefile.am b/tests/acceptance/Makefile.am index 4e76f8df8e..ec8042d15a 100644 --- a/tests/acceptance/Makefile.am +++ b/tests/acceptance/Makefile.am @@ -100,7 +100,7 @@ EXTRA_DIST = default.cf.sub dcs.cf.sub plucked.cf.sub run_with_server.cf.sub \ root-MD5=617eb383deffef843ea856b129d0a423.priv # Recursively include all tests in the dist tarball and set proper permissions -EXTRA_DIST += $(wildcard [0-9]*) +EXTRA_DIST += `wildcard [0-9]*` dist-hook: chmod -R go-w $(distdir) From 27d3d7766804b79dc55591b0c162fecea4f2064e Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 14:29:29 +0100 Subject: [PATCH 08/15] Reapply "Fix init_script_test_helper not being cleaned properly." Looks like 520144f11a2267734a88e1aaf4aa9edd333d0dac was an attempt to fix init_script_test_helper from not being cleaned properly. This commit was reverted in ebd97bd29beee6de6b82d4565e588e86adf31127, and another attempt was added in 9dc759f448a202ee413814aa4b64d365df4fbc85. However, the revert actually removed the entire `init_script_test_helper` binary from being compiled. This reapplying the first fix, and combining it with the second fix should do the trick. Found this while trying to clear the warning: ``` tests/unit/Makefile.am:402: warning: variable 'init_script_test_helper_SOURCES' is defined but no program or tests/unit/Makefile.am:402: library has 'init_script_test_helper' as canonical name (possible typo) ``` This reverts commit ebd97bd29beee6de6b82d4565e588e86adf31127. --- tests/unit/Makefile.am | 1 + tests/unit/init_script_test.sh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 3a4bb0a9d4..0bc3034b23 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -407,6 +407,7 @@ nfs_test_LDADD = ../../libpromises/libpromises.la libtest.la init_script_test_helper_SOURCES = init_script_test_helper.c init_script_test.sh: init_script_test_helper CLEANFILES += init_script_test_helper +noinst_PROGRAMS += init_script_test_helper endif EXTRA_DIST += init_script_test_helper.c EXTRA_DIST += init_script_test.sh diff --git a/tests/unit/init_script_test.sh b/tests/unit/init_script_test.sh index f105ede55d..dddcc8587b 100755 --- a/tests/unit/init_script_test.sh +++ b/tests/unit/init_script_test.sh @@ -91,10 +91,10 @@ fi # Fail on any error. set -e -cp init_script_test_helper $CFTEST_PREFIX/bin/cf-test-execd -cp init_script_test_helper $CFTEST_PREFIX/bin/cf-test-serverd -cp init_script_test_helper $CFTEST_PREFIX/bin/cf-test-monitord -cp init_script_test_helper $CFTEST_PREFIX/bin/cf-test-agent +cp .libs/init_script_test_helper $CFTEST_PREFIX/bin/cf-test-execd +cp .libs/init_script_test_helper $CFTEST_PREFIX/bin/cf-test-serverd +cp .libs/init_script_test_helper $CFTEST_PREFIX/bin/cf-test-monitord +cp .libs/init_script_test_helper $CFTEST_PREFIX/bin/cf-test-agent touch $CFTEST_PREFIX/inputs/promises.cf From 349a484e5d62907ad745c9dc3e48a25851402a19 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 10 Jan 2025 17:10:21 +0100 Subject: [PATCH 09/15] Remove references to `top_sourcedir` in Makefile.am I don't know why, but this was necessary, and all the other tests does this. I was getting the following errors after enabling subdir-objects in `AM_INIT_AUTOMAKE`: ``` Makefile:1843: ../../cf-upgrade/.deps/cf_upgrade_test-alloc-mini.Po: No such file or directory Makefile:1844: ../../cf-upgrade/.deps/cf_upgrade_test-command_line.Po: No such file or directory Makefile:1845: ../../cf-upgrade/.deps/cf_upgrade_test-configuration.Po: No such file or directory Makefile:1846: ../../cf-upgrade/.deps/cf_upgrade_test-log.Po: No such file or directory Makefile:1847: ../../cf-upgrade/.deps/cf_upgrade_test-process.Po: No such file or directory Makefile:1848: ../../cf-upgrade/.deps/cf_upgrade_test-update.Po: No such file or directory ``` Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- tests/unit/Makefile.am | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 0bc3034b23..ca14c72960 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -386,17 +386,17 @@ verify_databases_test_LDADD = ../../cf-agent/libcf-agent.la libtest.la iteration_test_SOURCES = iteration_test.c cf_upgrade_test_SOURCES = cf_upgrade_test.c \ - $(top_srcdir)/cf-upgrade/alloc-mini.c \ - $(top_srcdir)/cf-upgrade/alloc-mini.h \ - $(top_srcdir)/cf-upgrade/command_line.c \ - $(top_srcdir)/cf-upgrade/command_line.h \ - $(top_srcdir)/cf-upgrade/configuration.c \ - $(top_srcdir)/cf-upgrade/configuration.h \ - $(top_srcdir)/cf-upgrade/log.c $(top_srcdir)/cf-upgrade/log.h \ - $(top_srcdir)/cf-upgrade/process.c $(top_srcdir)/cf-upgrade/process.h \ - $(top_srcdir)/cf-upgrade/update.c \ - $(top_srcdir)/cf-upgrade/update.h -cf_upgrade_test_CPPFLAGS = -I$(top_srcdir)/cf-upgrade -I$(top_srcdir)/libntech/libutils -I$(top_srcdir) + ../../cf-upgrade/alloc-mini.c \ + ../../cf-upgrade/alloc-mini.h \ + ../../cf-upgrade/command_line.c \ + ../../cf-upgrade/command_line.h \ + ../../cf-upgrade/configuration.c \ + ../../cf-upgrade/configuration.h \ + ../../cf-upgrade/log.c ../../cf-upgrade/log.h \ + ../../cf-upgrade/process.c ../../cf-upgrade/process.h \ + ../../cf-upgrade/update.c \ + ../../cf-upgrade/update.h +cf_upgrade_test_CPPFLAGS = -I../../cf-upgrade -I../../libntech/libutils -I../../ cf_upgrade_test_LDADD = libtest.la ../../libntech/libcompat/libcompat.la if !NT From d1f9c86009f31c220d34402cb709ef70ec590e54 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Mon, 13 Jan 2025 10:41:25 +0100 Subject: [PATCH 10/15] Removed linking libraries to init_script_test_helper The `init_script_test_helper` binary does not require any libraries. The libraries `libpromises.la` and `libtest.la` were previously added through the `LDADD` variable in the top of Makefile.am. Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- tests/unit/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index ca14c72960..44311bfb56 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -404,6 +404,7 @@ check_PROGRAMS += nfs_test nfs_test_SOURCES = nfs_test.c nfs_test_LDADD = ../../libpromises/libpromises.la libtest.la +init_script_test_helper_LDADD = init_script_test_helper_SOURCES = init_script_test_helper.c init_script_test.sh: init_script_test_helper CLEANFILES += init_script_test_helper From d64fea424d39e5bc0509b7bf3ff188063d482fa7 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Mon, 13 Jan 2025 11:07:24 +0100 Subject: [PATCH 11/15] Removed reference to $(srcdir) in test/load/Makefile.am For some reason it causes the following error ``` 10:58:19 Makefile:598: ../../libpromises/.deps/lastseen.Po: No such file or directory 10:58:19 make[3]: *** No rule to make target '../../libpromises/.deps/lastseen.Po'. Stop. ``` in bootstrap_pr while doing `make dist` in Jenkins. Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- tests/load/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/load/Makefile.am b/tests/load/Makefile.am index 89c5762d81..29a820f79b 100644 --- a/tests/load/Makefile.am +++ b/tests/load/Makefile.am @@ -54,8 +54,8 @@ db_load_LDADD = ../unit/libdb.la lastseen_load_SOURCES = lastseen_load.c \ - $(srcdir)/../../libpromises/lastseen.c \ - $(srcdir)/../../libntech/libutils/statistics.c + ../../libpromises/lastseen.c \ + ../../libntech/libutils/statistics.c lastseen_load_LDADD = ../unit/libdb.la ../../libpromises/libpromises.la endif From 55421f48ac642eda13f23a1a68273e1dd1264591 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Mon, 13 Jan 2025 11:14:19 +0100 Subject: [PATCH 12/15] Revert "Fixed non-POSIX variable name warning" This reverts commit ba693ca41ae7110d08b62fd440b91a30ed9c0166. --- tests/acceptance/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/Makefile.am b/tests/acceptance/Makefile.am index ec8042d15a..4e76f8df8e 100644 --- a/tests/acceptance/Makefile.am +++ b/tests/acceptance/Makefile.am @@ -100,7 +100,7 @@ EXTRA_DIST = default.cf.sub dcs.cf.sub plucked.cf.sub run_with_server.cf.sub \ root-MD5=617eb383deffef843ea856b129d0a423.priv # Recursively include all tests in the dist tarball and set proper permissions -EXTRA_DIST += `wildcard [0-9]*` +EXTRA_DIST += $(wildcard [0-9]*) dist-hook: chmod -R go-w $(distdir) From bcdc9ff9c836b2df61dd8cf17fd62194f834a925 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 9 May 2025 12:20:53 +0200 Subject: [PATCH 13/15] Fixed failures in distclean target Building stuff from libutils in test/unit causes make distclean to delete the same files twice resulting in failure. This happens as an effect of enabling subdir-objects which causes recursive builds. Ticket: CFE-2780 Signed-off-by: Lars Erik Wik --- tests/unit/Makefile.am | 168 ++++++++++------------------------------- 1 file changed, 41 insertions(+), 127 deletions(-) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 44311bfb56..98ebce07e8 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -54,37 +54,6 @@ AM_CFLAGS = $(PTHREAD_CFLAGS) check_LTLIBRARIES = libtest.la libtest_la_SOURCES = cmockery.c cmockery.h schema.h test.c test.h -libtest_la_LIBADD = ../../libntech/libcompat/libcompat.la - - -check_LTLIBRARIES += libdb.la -libdb_la_SOURCES = db_stubs.c \ - ../../libpromises/dbm_api.c \ - ../../libpromises/dbm_quick.c \ - ../../libpromises/dbm_tokyocab.c \ - ../../libpromises/dbm_lmdb.c \ - ../../libpromises/dbm_migration.c \ - ../../libpromises/dbm_migration_lastseen.c \ - ../../libpromises/global_mutex.c \ - ../../cf-check/backup.c \ - ../../cf-check/diagnose.c \ - ../../cf-check/lmdump.c \ - ../../cf-check/repair.c \ - ../../cf-check/replicate_lmdb.c \ - ../../cf-check/utilities.c \ - ../../cf-check/validate.c \ - ../../libntech/libutils/logging.c \ - ../../libntech/libutils/mutex.c \ - ../../libntech/libutils/cleanup.c -if HPUX -libdb_la_SOURCES += ../../libpromises/cf3globals.c -endif -libdb_la_LIBADD = ../../libntech/libutils/libutils.la -#libdb_la_CPPFLAGS = $(LMDB_CPPFLAGS) $(TOKYOCABINET_CPPFLAGS) $(QDBM_CPPFLAGS) -# Make sure that source files are compiled to separate object files -# libdb_la-file.o -libdb_la_CFLAGS = $(AM_CFLAGS) - check_PROGRAMS = \ processes_select_test \ arg_split_test \ @@ -216,33 +185,15 @@ set_domainname_test_LDADD = libtest.la ../../libpromises/libpromises.la regex_test_SOURCES = regex_test.c ../../libpromises/match_scope.c -protocol_test_SOURCES = protocol_test.c \ - ../../cf-serverd/server_common.c \ - ../../cf-serverd/server_tls.c \ - ../../cf-serverd/server.c \ - ../../cf-serverd/cf-serverd-enterprise-stubs.c \ - ../../cf-serverd/server_transform.c \ - ../../cf-serverd/cf-serverd-functions.c \ - ../../cf-serverd/server_access.c \ - ../../cf-serverd/strlist.c -protocol_test_LDADD = ../../libpromises/libpromises.la libtest.la +protocol_test_SOURCES = protocol_test.c +protocol_test_LDADD = ../../libpromises/libpromises.la libtest.la ../../cf-serverd/libcf-serverd.la if HAVE_AVAHI_CLIENT if HAVE_AVAHI_COMMON -findhub_test_SOURCES = findhub_test.c \ - ../../cf-agent/findhub.c \ - ../../cf-agent/load_avahi.c - -avahi_config_test_SOURCES = avahi_config_test.c \ - ../../cf-serverd/server_common.c \ - ../../cf-serverd/server_tls.c \ - ../../cf-serverd/server.c \ - ../../cf-serverd/server_transform.c \ - ../../cf-serverd/cf-serverd-enterprise-stubs.c \ - ../../cf-serverd/server_access.c \ - ../../cf-serverd/server_classic.c \ - ../../cf-serverd/strlist.c +findhub_test_SOURCES = findhub_test.c + +avahi_config_test_SOURCES = avahi_config_test.c avahi_config_test_LDADD = ../../libpromises/libpromises.la libtest.la endif @@ -252,31 +203,18 @@ db_test_SOURCES = db_test.c db_test_LDADD = libtest.la ../../libpromises/libpromises.la db_concurrent_test_SOURCES = db_concurrent_test.c -#db_concurrent_test_CPPFLAGS = $(libdb_la_CPPFLAGS) -db_concurrent_test_LDADD = libtest.la libdb.la +db_concurrent_test_LDADD = libtest.la ../../libpromises/libpromises.la -lastseen_test_SOURCES = lastseen_test.c \ - ../../libntech/libutils/statistics.c -#lastseen_test_CPPFLAGS = $(libdb_la_CPPFLAGS) +lastseen_test_SOURCES = lastseen_test.c lastseen_test_LDADD = libtest.la ../../libpromises/libpromises.la lastseen_migration_test_SOURCES = lastseen_migration_test.c -#lastseen_migration_test_CPPFLAGS = $(libdb_la_CPPFLAGS) lastseen_migration_test_LDADD = ../../libpromises/libpromises.la CLEANFILES = *.gcno *.gcda cfengine-enterprise.so -package_versions_compare_test_SOURCES = package_versions_compare_test.c \ - ../../cf-agent/package_module.c \ - ../../cf-agent/verify_packages.c \ - ../../cf-agent/verify_new_packages.c \ - ../../cf-agent/vercmp.c \ - ../../cf-agent/vercmp_internal.c \ - ../../cf-agent/retcode.c \ - ../../libpromises/match_scope.c - -#package_versions_compare_test_CPPFLAGS = $(AM_CPPFLAGS) -package_versions_compare_test_LDADD = ../../libpromises/libpromises.la \ +package_versions_compare_test_SOURCES = package_versions_compare_test.c +package_versions_compare_test_LDADD = ../../cf-agent/libcf-agent.la ../../libpromises/libpromises.la \ libtest.la files_copy_test_SOURCES = files_copy_test.c @@ -285,15 +223,10 @@ files_copy_test_LDADD = libtest.la ../../libpromises/libpromises.la sort_test_SOURCES = sort_test.c sort_test_LDADD = libtest.la ../../libpromises/libpromises.la -logging_test_SOURCES = logging_test.c \ - ../../libpromises/syslog_client.c \ - ../../libpromises/patches.c \ - ../../libpromises/constants.c -logging_test_LDADD = libtest.la ../../libntech/libutils/libutils.la +logging_test_SOURCES = logging_test.c +logging_test_LDADD = libtest.la ../../libpromises/libpromises.la -connection_management_test_SOURCES = connection_management_test.c \ - ../../cf-serverd/server_common.c \ - ../../cf-serverd/server_tls.c +connection_management_test_SOURCES = connection_management_test.c connection_management_test_LDADD = ../../libpromises/libpromises.la \ libtest.la \ ../../cf-serverd/libcf-serverd.la @@ -310,11 +243,8 @@ if LINUX check_PROGRAMS += linux_process_test -linux_process_test_SOURCES = linux_process_test.c \ - ../../libpromises/process_unix.c \ - ../../libpromises/process_linux.c \ - ../../libntech/libutils/file_lib.c -linux_process_test_LDADD = libtest.la ../../libntech/libutils/libutils.la +linux_process_test_SOURCES = linux_process_test.c +linux_process_test_LDADD = libtest.la ../../libpromises/libpromises.la endif @@ -325,11 +255,8 @@ check_PROGRAMS += aix_process_test # because they provide dummy versions of some standard functions. set_domainname_test_LDFLAGS = -Wl,-bexpall evalfunction_test_LDFLAGS = -Wl,-bexpall -aix_process_test_SOURCES = aix_process_test.c \ - ../../libpromises/process_unix.c \ - ../../libpromises/process_aix.c \ - ../../libntech/libutils/file_lib.c -aix_process_test_LDADD = libtest.la ../../libntech/libutils/libutils.la +aix_process_test_SOURCES = aix_process_test.c +aix_process_test_LDADD = libtest.la ../../libpromises/libpromises.la endif @@ -337,67 +264,54 @@ if SOLARIS check_PROGRAMS += solaris_process_test -solaris_process_test_SOURCES = solaris_process_test.c \ - ../../libpromises/process_unix.c \ - ../../libpromises/process_solaris.c \ - ../../libntech/libutils/file_lib.c -solaris_process_test_LDADD = libtest.la ../../libntech/libutils/libutils.la +solaris_process_test_SOURCES = solaris_process_test.c +solaris_process_test_LDADD = libtest.la ../../libpromises/libpromises.la endif -process_terminate_unix_test_SOURCES = process_terminate_unix_test.c \ - ../../libpromises/process_unix.c -process_terminate_unix_test_LDADD = libtest.la ../../libntech/libutils/libutils.la +process_terminate_unix_test_SOURCES = process_terminate_unix_test.c +process_terminate_unix_test_LDADD = libtest.la ../../libpromises/libpromises.la -exec_config_test_SOURCES = exec-config-test.c \ - ../../cf-execd/exec-config.c ../../cf-execd/execd-config.c -exec_config_test_LDADD = libtest.la ../../libpromises/libpromises.la +exec_config_test_SOURCES = exec-config-test.c +exec_config_test_LDADD = libtest.la ../../libpromises/libpromises.la ../../cf-execd/libcf-execd.la sysinfo_test_LDADD = libtest.la \ ../../libenv/libenv.la \ ../../libpromises/libpromises.la -mon_cpu_test_SOURCES = mon_cpu_test.c \ - ../../cf-monitord/mon.h \ - ../../cf-monitord/mon_cpu.c -mon_cpu_test_LDADD = ../../libpromises/libpromises.la libtest.la +mon_cpu_test_SOURCES = mon_cpu_test.c +mon_cpu_test_LDADD = ../../libpromises/libpromises.la libtest.la ../../cf-monitord/libcf-monitord.la -mon_load_test_SOURCES = mon_load_test.c \ - ../../cf-monitord/mon.h \ - ../../cf-monitord/mon_load.c -mon_load_test_LDADD = ../../libpromises/libpromises.la libtest.la +mon_load_test_SOURCES = mon_load_test.c +mon_load_test_LDADD = ../../libpromises/libpromises.la libtest.la ../../cf-monitord/libcf-monitord.la -mon_processes_test_SOURCES = mon_processes_test.c \ - ../../cf-monitord/mon.h \ - ../../cf-monitord/mon_processes.c -mon_processes_test_LDADD = ../../libpromises/libpromises.la libtest.la +mon_processes_test_SOURCES = mon_processes_test.c +mon_processes_test_LDADD = ../../libpromises/libpromises.la libtest.la ../../cf-monitord/libcf-monitord.la key_test_SOURCES = key_test.c key_test_LDADD = ../../libpromises/libpromises.la \ - ../../libntech/libutils/libutils.la \ libtest.la -strlist_test_SOURCES = strlist_test.c \ - ../../cf-serverd/strlist.c \ - ../../cf-serverd/strlist.h +strlist_test_SOURCES = strlist_test.c +strlist_test_LDADD = ../../libpromises/libpromises.la libtest.la ../../cf-serverd/libcf-serverd.la verify_databases_test_LDADD = ../../cf-agent/libcf-agent.la libtest.la iteration_test_SOURCES = iteration_test.c cf_upgrade_test_SOURCES = cf_upgrade_test.c \ - ../../cf-upgrade/alloc-mini.c \ - ../../cf-upgrade/alloc-mini.h \ - ../../cf-upgrade/command_line.c \ - ../../cf-upgrade/command_line.h \ - ../../cf-upgrade/configuration.c \ - ../../cf-upgrade/configuration.h \ - ../../cf-upgrade/log.c ../../cf-upgrade/log.h \ - ../../cf-upgrade/process.c ../../cf-upgrade/process.h \ - ../../cf-upgrade/update.c \ - ../../cf-upgrade/update.h +- ../../cf-upgrade/alloc-mini.c \ +- ../../cf-upgrade/alloc-mini.h \ +- ../../cf-upgrade/command_line.c \ +- ../../cf-upgrade/command_line.h \ +- ../../cf-upgrade/configuration.c \ +- ../../cf-upgrade/configuration.h \ +- ../../cf-upgrade/log.c ../../cf-upgrade/log.h \ +- ../../cf-upgrade/process.c ../../cf-upgrade/process.h \ +- ../../cf-upgrade/update.c \ +- ../../cf-upgrade/update.h cf_upgrade_test_CPPFLAGS = -I../../cf-upgrade -I../../libntech/libutils -I../../ -cf_upgrade_test_LDADD = libtest.la ../../libntech/libcompat/libcompat.la +cf_upgrade_test_LDADD = libtest.la ../../libpromises/libpromises.la if !NT check_PROGRAMS += nfs_test From 70b6913091d5e2e89529e5a9ae9a8118f04eb28b Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 9 May 2025 13:54:01 +0200 Subject: [PATCH 14/15] Fixed ODR violation in logging_test.c Signed-off-by: Lars Erik Wik --- tests/unit/logging_test.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/logging_test.c b/tests/unit/logging_test.c index cc4468edd0..c570c4764f 100644 --- a/tests/unit/logging_test.c +++ b/tests/unit/logging_test.c @@ -6,9 +6,6 @@ #include #include -// This test uses syslog_client.c directly, without libpromises, -// this is necessary so we don't get "undefined symbol" errors: -char VFQNAME[CF_MAXVARSIZE]; static struct sockaddr *got_address; From d984990b794f994babaa36650557f27363856c35 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 9 May 2025 14:39:48 +0200 Subject: [PATCH 15/15] Try this Signed-off-by: Lars Erik Wik --- tests/unit/process_terminate_unix_test.c | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/unit/process_terminate_unix_test.c b/tests/unit/process_terminate_unix_test.c index 3dffc6b1b4..d3f61b7f4a 100644 --- a/tests/unit/process_terminate_unix_test.c +++ b/tests/unit/process_terminate_unix_test.c @@ -15,30 +15,30 @@ /* Settings */ -time_t proc_1_start_time; -time_t proc_1_reaction_time; -bool proc_1_int_blocked; -bool proc_1_term_blocked; -bool proc_1_have_access; +static time_t proc_1_start_time; +static time_t proc_1_reaction_time; +static bool proc_1_int_blocked; +static bool proc_1_term_blocked; +static bool proc_1_have_access; /* State */ -time_t current_time; +static time_t current_time; -bool exists; -bool stopped; +static bool exists; +static bool stopped; -time_t signal_time; -bool has_stop; -bool has_cont; -bool has_int; -bool has_term; -bool has_kill; +static time_t signal_time; +static bool has_stop; +static bool has_cont; +static bool has_int; +static bool has_term; +static bool has_kill; /* History */ -bool was_stopped; -int exit_signal; +static bool was_stopped; +static int exit_signal; void InitTime(void) {