1# 2# Copyright 2021 Northern.tech AS 3# 4# This file is part of CFEngine 3 - written and maintained by Northern.tech AS. 5# 6# This program is free software; you can redistribute it and/or modify it 7# under the terms of the GNU General Public License as published by the 8# Free Software Foundation; version 3. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, write to the Free Software 17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 18# 19# To the extent this program is licensed as part of the Enterprise 20# versions of CFEngine, the applicable Commercial Open Source License 21# (COSL) may apply to this file if you as a licensee so wish it. See 22# included file COSL.txt. 23# 24# Just recursively include in dist tarball all data we need for unit tests 25EXTRA_DIST = data 26 27AM_CPPFLAGS = $(CORE_CPPFLAGS) \ 28 $(ENTERPRISE_CPPFLAGS) \ 29 -I$(srcdir)/../../libcfnet \ 30 -I$(srcdir)/../../libenv \ 31 -I$(srcdir)/../../libpromises \ 32 -I$(srcdir)/../../libntech/libutils \ 33 -I$(srcdir)/../../cf-monitord \ 34 -I$(srcdir)/../../cf-serverd \ 35 -I$(srcdir)/../../cf-agent \ 36 -I$(srcdir)/../../cf-execd \ 37 -I$(srcdir)/../../cf-key \ 38 -I$(srcdir)/../../cf-check \ 39 -DTESTDATADIR='"$(srcdir)/data"' 40 41LDADD = ../../libpromises/libpromises.la libtest.la 42 43# automake does not support "maude_LIBS" variables. We can only alter 44# the generic LIBS one. In case the functions are mocked in the test 45# implementation, then we are pretty sure that they will be overriden by 46# our local implementation. So we include *everything*... 47LIBS = $(CORE_LIBS) 48AM_LDFLAGS = $(CORE_LDFLAGS) 49 50AM_CFLAGS = $(PTHREAD_CFLAGS) 51 52 53check_LTLIBRARIES = libtest.la 54libtest_la_SOURCES = cmockery.c cmockery.h schema.h test.c test.h \ 55 ../../libntech/libutils/alloc.c \ 56 ../../libpromises/patches.c \ 57 ../../libpromises/constants.c \ 58 ../../libntech/libutils/known_dirs.c \ 59 ../../libntech/libutils/map.c \ 60 ../../libntech/libutils/array_map.c \ 61 ../../libntech/libutils/hash.c \ 62 ../../libntech/libutils/hash_map.c 63 64libtest_la_LIBADD = ../../libntech/libcompat/libcompat.la 65 66check_LTLIBRARIES += libstr.la 67libstr_la_SOURCES = \ 68 ../../libntech/libutils/buffer.c \ 69 ../../libntech/libutils/pcre_wrap.c \ 70 ../../libntech/libutils/encode.c \ 71 ../../libntech/libutils/logging.c \ 72 ../../libntech/libutils/misc_lib.c \ 73 ../../libntech/libutils/regex.c \ 74 ../../libntech/libutils/sequence.c \ 75 ../../libntech/libutils/string_lib.c \ 76 ../../libntech/libutils/writer.c 77libstr_la_LIBADD = libtest.la 78 79 80check_LTLIBRARIES += libdb.la 81libdb_la_SOURCES = db_stubs.c \ 82 ../../libpromises/dbm_api.c \ 83 ../../libpromises/dbm_quick.c \ 84 ../../libpromises/dbm_tokyocab.c \ 85 ../../libpromises/dbm_lmdb.c \ 86 ../../libpromises/dbm_migration.c \ 87 ../../libpromises/dbm_migration_lastseen.c \ 88 ../../libpromises/global_mutex.c \ 89 ../../cf-check/backup.c \ 90 ../../cf-check/diagnose.c \ 91 ../../cf-check/lmdump.c \ 92 ../../cf-check/repair.c \ 93 ../../cf-check/replicate_lmdb.c \ 94 ../../cf-check/utilities.c \ 95 ../../cf-check/validate.c \ 96 ../../libntech/libutils/logging.c \ 97 ../../libntech/libutils/mutex.c \ 98 ../../libntech/libutils/cleanup.c 99if HPUX 100libdb_la_SOURCES += ../../libpromises/cf3globals.c 101endif 102libdb_la_LIBADD = libstr.la ../../libntech/libutils/libutils.la 103#libdb_la_CPPFLAGS = $(LMDB_CPPFLAGS) $(TOKYOCABINET_CPPFLAGS) $(QDBM_CPPFLAGS) 104# Make sure that source files are compiled to separate object files 105# libdb_la-file.o 106libdb_la_CFLAGS = $(AM_CFLAGS) 107 108check_PROGRAMS = \ 109 arg_split_test \ 110 assoc_test \ 111 item_test \ 112 rlist_test \ 113 domainname_test \ 114 set_domainname_test \ 115 evalfunction_test \ 116 eval_context_test \ 117 regex_test \ 118 lastseen_test \ 119 lastseen_migration_test \ 120 changes_migration_test \ 121 db_test \ 122 db_concurrent_test \ 123 item_lib_test \ 124 crypto_symmetric_test \ 125 persistent_lock_test \ 126 package_versions_compare_test \ 127 files_lib_test \ 128 files_copy_test \ 129 parsemode_test \ 130 parser_test \ 131 passopenfile_test \ 132 policy_test \ 133 sort_test \ 134 file_name_test \ 135 logging_test \ 136 granules_test \ 137 scope_test \ 138 conversion_test \ 139 files_interfaces_test \ 140 connection_management_test \ 141 expand_test \ 142 string_expressions_test \ 143 var_expressions_test \ 144 process_terminate_unix_test \ 145 process_test \ 146 exec-config-test \ 147 generic_agent_test \ 148 syntax_test \ 149 sysinfo_test \ 150 variable_test \ 151 verify_databases_test \ 152 protocol_test \ 153 mon_cpu_test \ 154 mon_load_test \ 155 mon_processes_test \ 156 mustache_test \ 157 class_test \ 158 key_test \ 159 cf_upgrade_test \ 160 matching_test \ 161 strlist_test \ 162 addr_lib_test \ 163 policy_server_test \ 164 split_process_line_test \ 165 new_packages_promise_test \ 166 iteration_test 167 168if HAVE_AVAHI_CLIENT 169if HAVE_AVAHI_COMMON 170check_PROGRAMS += \ 171 findhub_test \ 172 avahi_config_test 173endif 174endif 175 176if !NT 177check_PROGRAMS += redirection_test 178noinst_PROGRAMS = redirection_test_stub 179 180redirection_test_stub_SOURCES = redirection_test_stub.c 181endif 182 183check_SCRIPTS = dynamic_dependency_test.sh \ 184 tar_portability_test.sh 185 186if WITH_INIT_D_SCRIPT 187check_SCRIPTS += init_script_test.sh 188endif 189 190EXTRA_DIST += $(check_SCRIPTS) 191 192TESTS = $(check_PROGRAMS) $(check_SCRIPTS) 193 194if MACOSX 195XFAIL_TESTS = set_domainname_test 196XFAIL_TESTS += process_test 197XFAIL_TESTS += mon_processes_test 198endif 199 200if HPUX 201XFAIL_TESTS = mon_load_test # Redmine #3569 202endif 203 204# 205# OS X uses real system calls instead of our stubs unless this option is used 206# 207TESTS_ENVIRONMENT = DYLD_FORCE_FLAT_NAMESPACE=yes 208 209conversion_test_SOURCES = conversion_test.c ../../libpromises/conversion.c 210 211if !BUILTIN_EXTENSIONS 212check_PROGRAMS += enterprise_extension_test 213 214enterprise_extension_test_SOURCES = enterprise_extension_test.c 215 216check_LTLIBRARIES += cfengine-enterprise.la 217cfengine_enterprise_la_SOURCES = enterprise_extension_test_lib.c 218cfengine_enterprise_la_LDFLAGS = $(AM_LDFLAGS) \ 219 -avoid-version -module -shared -export-dynamic -rpath / 220EXTRA_enterprise_extension_test_DEPENDENCIES = cfengine-enterprise.la 221endif 222 223set_domainname_test_SOURCES = set_domainname_test.c 224set_domainname_test_LDADD = libstr.la ../../libpromises/libpromises.la 225 226str_test_SOURCES = str_test.c 227str_test_LDADD = libstr.la 228 229regex_test_SOURCES = regex_test.c ../../libpromises/match_scope.c 230 231protocol_test_SOURCES = protocol_test.c \ 232 ../../cf-serverd/server_common.c \ 233 ../../cf-serverd/server_tls.c \ 234 ../../cf-serverd/server.c \ 235 ../../cf-serverd/cf-serverd-enterprise-stubs.c \ 236 ../../cf-serverd/server_transform.c \ 237 ../../cf-serverd/cf-serverd-functions.c \ 238 ../../cf-serverd/server_access.c \ 239 ../../cf-serverd/strlist.c 240protocol_test_LDADD = ../../libpromises/libpromises.la libtest.la 241 242if HAVE_AVAHI_CLIENT 243if HAVE_AVAHI_COMMON 244 245findhub_test_SOURCES = findhub_test.c \ 246 ../../cf-agent/findhub.c \ 247 ../../cf-agent/load_avahi.c 248 249avahi_config_test_SOURCES = avahi_config_test.c \ 250 ../../cf-serverd/server_common.c \ 251 ../../cf-serverd/server_tls.c \ 252 ../../cf-serverd/server.c \ 253 ../../cf-serverd/server_transform.c \ 254 ../../cf-serverd/cf-serverd-enterprise-stubs.c \ 255 ../../cf-serverd/server_access.c \ 256 ../../cf-serverd/server_classic.c \ 257 ../../cf-serverd/strlist.c 258avahi_config_test_LDADD = ../../libpromises/libpromises.la libtest.la 259 260endif 261endif 262 263db_test_SOURCES = db_test.c 264db_test_LDADD = libtest.la ../../libpromises/libpromises.la 265 266db_concurrent_test_SOURCES = db_concurrent_test.c 267#db_concurrent_test_CPPFLAGS = $(libdb_la_CPPFLAGS) 268db_concurrent_test_LDADD = libdb.la 269 270lastseen_test_SOURCES = lastseen_test.c \ 271 ../../libpromises/item_lib.c \ 272 ../../libpromises/lastseen.c \ 273 ../../libntech/libutils/statistics.c 274#lastseen_test_CPPFLAGS = $(libdb_la_CPPFLAGS) 275lastseen_test_LDADD = libdb.la ../../libpromises/libpromises.la 276 277lastseen_migration_test_SOURCES = lastseen_migration_test.c \ 278 ../../libpromises/lastseen.c \ 279 ../../libntech/libutils/statistics.c \ 280 ../../libpromises/item_lib.c 281#lastseen_migration_test_CPPFLAGS = $(libdb_la_CPPFLAGS) 282lastseen_migration_test_LDADD = libdb.la ../../libpromises/libpromises.la 283 284CLEANFILES = *.gcno *.gcda cfengine-enterprise.so 285 286package_versions_compare_test_SOURCES = package_versions_compare_test.c \ 287 ../../cf-agent/package_module.c \ 288 ../../cf-agent/verify_packages.c \ 289 ../../cf-agent/verify_new_packages.c \ 290 ../../cf-agent/vercmp.c \ 291 ../../cf-agent/vercmp_internal.c \ 292 ../../cf-agent/retcode.c \ 293 ../../libpromises/match_scope.c 294 295#package_versions_compare_test_CPPFLAGS = $(AM_CPPFLAGS) 296package_versions_compare_test_LDADD = ../../libpromises/libpromises.la \ 297 libtest.la 298 299files_copy_test_SOURCES = files_copy_test.c 300files_copy_test_LDADD = libtest.la ../../libpromises/libpromises.la 301 302sort_test_SOURCES = sort_test.c 303sort_test_LDADD = libtest.la ../../libpromises/libpromises.la 304 305logging_test_SOURCES = logging_test.c ../../libpromises/syslog_client.c 306logging_test_LDADD = libtest.la ../../libntech/libutils/libutils.la 307 308connection_management_test_SOURCES = connection_management_test.c \ 309 ../../cf-serverd/server_common.c \ 310 ../../cf-serverd/server_tls.c 311connection_management_test_LDADD = ../../libpromises/libpromises.la \ 312 libtest.la \ 313 ../../cf-serverd/libcf-serverd.la 314 315rlist_test_SOURCES = rlist_test.c \ 316 ../../libpromises/rlist.c 317rlist_test_LDADD = libtest.la ../../libpromises/libpromises.la 318# Workaround for object file basename conflicts, search the web for 319# "automake created with both libtool and without" 320rlist_test_CPPFLAGS = $(AM_CPPFLAGS) 321 322process_test_LDADD = libtest.la ../../libpromises/libpromises.la 323 324if LINUX 325 326check_PROGRAMS += linux_process_test 327 328linux_process_test_SOURCES = linux_process_test.c \ 329 ../../libpromises/process_unix.c \ 330 ../../libpromises/process_linux.c \ 331 ../../libntech/libutils/file_lib.c 332linux_process_test_LDADD = libtest.la ../../libntech/libutils/libutils.la 333 334endif 335 336if AIX 337 338check_PROGRAMS += aix_process_test 339# We need to use -Wl,-bexpall when linking tests binaries on AIX 340# because they provide dummy versions of some standard functions. 341set_domainname_test_LDFLAGS = -Wl,-bexpall 342evalfunction_test_LDFLAGS = -Wl,-bexpall 343aix_process_test_SOURCES = aix_process_test.c \ 344 ../../libpromises/process_unix.c \ 345 ../../libpromises/process_aix.c \ 346 ../../libntech/libutils/file_lib.c 347aix_process_test_LDADD = libtest.la ../../libntech/libutils/libutils.la 348 349endif 350 351if SOLARIS 352 353check_PROGRAMS += solaris_process_test 354 355solaris_process_test_SOURCES = solaris_process_test.c \ 356 ../../libpromises/process_unix.c \ 357 ../../libpromises/process_solaris.c \ 358 ../../libntech/libutils/file_lib.c 359solaris_process_test_LDADD = libtest.la ../../libntech/libutils/libutils.la 360 361endif 362 363process_terminate_unix_test_SOURCES = process_terminate_unix_test.c \ 364 ../../libpromises/process_unix.c 365process_terminate_unix_test_LDADD = libtest.la ../../libntech/libutils/libutils.la 366 367exec_config_test_SOURCES = exec-config-test.c \ 368 ../../cf-execd/exec-config.c ../../cf-execd/execd-config.c 369exec_config_test_LDADD = libtest.la ../../libpromises/libpromises.la 370 371sysinfo_test_LDADD = libtest.la \ 372 ../../libenv/libenv.la \ 373 ../../libpromises/libpromises.la 374 375mon_cpu_test_SOURCES = mon_cpu_test.c \ 376 ../../cf-monitord/mon.h \ 377 ../../cf-monitord/mon_cpu.c 378mon_cpu_test_LDADD = ../../libpromises/libpromises.la libtest.la 379 380mon_load_test_SOURCES = mon_load_test.c \ 381 ../../cf-monitord/mon.h \ 382 ../../cf-monitord/mon_load.c 383mon_load_test_LDADD = ../../libpromises/libpromises.la libtest.la 384 385mon_processes_test_SOURCES = mon_processes_test.c \ 386 ../../cf-monitord/mon.h \ 387 ../../cf-monitord/mon_processes.c 388mon_processes_test_LDADD = ../../libpromises/libpromises.la libtest.la 389 390key_test_SOURCES = key_test.c 391key_test_LDADD = ../../libpromises/libpromises.la \ 392 ../../libntech/libutils/libutils.la \ 393 libtest.la 394 395strlist_test_SOURCES = strlist_test.c \ 396 ../../cf-serverd/strlist.c \ 397 ../../cf-serverd/strlist.h 398 399verify_databases_test_LDADD = ../../cf-agent/libcf-agent.la libtest.la 400 401iteration_test_SOURCES = iteration_test.c 402 403cf_upgrade_test_SOURCES = cf_upgrade_test.c \ 404 $(top_srcdir)/cf-upgrade/alloc-mini.c \ 405 $(top_srcdir)/cf-upgrade/alloc-mini.h \ 406 $(top_srcdir)/cf-upgrade/command_line.c \ 407 $(top_srcdir)/cf-upgrade/command_line.h \ 408 $(top_srcdir)/cf-upgrade/configuration.c \ 409 $(top_srcdir)/cf-upgrade/configuration.h \ 410 $(top_srcdir)/cf-upgrade/log.c $(top_srcdir)/cf-upgrade/log.h \ 411 $(top_srcdir)/cf-upgrade/process.c $(top_srcdir)/cf-upgrade/process.h \ 412 $(top_srcdir)/cf-upgrade/update.c \ 413 $(top_srcdir)/cf-upgrade/update.h 414cf_upgrade_test_CPPFLAGS = -I$(top_srcdir)/cf-upgrade -I$(top_srcdir)/libntech/libutils -I$(top_srcdir) 415cf_upgrade_test_LDADD = libtest.la ../../libntech/libcompat/libcompat.la 416 417if !NT 418check_PROGRAMS += nfs_test 419nfs_test_SOURCES = nfs_test.c 420nfs_test_LDADD = ../../libpromises/libpromises.la libtest.la 421 422init_script_test_helper_SOURCES = init_script_test_helper.c 423init_script_test.sh: init_script_test_helper 424CLEANFILES += init_script_test_helper 425endif 426EXTRA_DIST += init_script_test_helper.c 427EXTRA_DIST += init_script_test.sh 428