diff --git a/configure.ac b/configure.ac index 92aecdcfec..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.63) +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]))) @@ -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 @@ -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}"]) @@ -137,13 +137,13 @@ 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]) -AM_PROG_LEX +AC_PROG_LEX(noyywrap) AC_PROG_YACC AC_PROG_INSTALL AC_PATH_PROG([PERL], [perl]) @@ -819,9 +819,6 @@ 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 AC_HEADER_SYS_WAIT AC_HEADER_DIRENT AC_HEADER_STDBOOL 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)` 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 diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 3a4bb0a9d4..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,76 +264,65 @@ 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 \ - $(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_test_LDADD = libtest.la ../../libntech/libcompat/libcompat.la +- ../../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 ../../libpromises/libpromises.la if !NT 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 +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 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; 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) {