Skip to content

Commit

Permalink
Removed libstr from tests/unit/Makefile.am
Browse files Browse the repository at this point in the history
The library was probably made as a convenience library. However, when
linking with `libstr` and other CFEngine libraries, or when including
sources from these libraries, we can quickly run into many problems.
Problems like, objects 'created with both libtool and without'. Or
duplicate symbol definitions. It's better to either include with just
the sources we need, or to only link with the CFEngine libraries when
creating test binaries.

Ticket: CFE-4471
Changelog: None
Signed-off-by: Lars Erik Wik <[email protected]>
  • Loading branch information
larsewi committed Dec 11, 2024
1 parent 10782d6 commit f852c14
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions tests/unit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ libtest_la_SOURCES = cmockery.c cmockery.h schema.h test.c test.h

libtest_la_LIBADD = ../../libntech/libcompat/libcompat.la

check_LTLIBRARIES += libstr.la
libstr_la_SOURCES = \
../../libntech/libutils/buffer.c \
../../libntech/libutils/encode.c \
../../libntech/libutils/logging.c \
../../libntech/libutils/misc_lib.c \
../../libntech/libutils/regex.c \
../../libntech/libutils/sequence.c \
../../libntech/libutils/string_lib.c \
../../libntech/libutils/writer.c
libstr_la_LIBADD = libtest.la


check_LTLIBRARIES += libdb.la
libdb_la_SOURCES = db_stubs.c \
Expand All @@ -91,7 +79,7 @@ libdb_la_SOURCES = db_stubs.c \
if HPUX
libdb_la_SOURCES += ../../libpromises/cf3globals.c
endif
libdb_la_LIBADD = libstr.la ../../libntech/libutils/libutils.la
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
Expand Down Expand Up @@ -214,10 +202,9 @@ EXTRA_enterprise_extension_test_DEPENDENCIES = cfengine-enterprise.la
endif

set_domainname_test_SOURCES = set_domainname_test.c
set_domainname_test_LDADD = libstr.la ../../libpromises/libpromises.la
set_domainname_test_LDADD = libtest.la ../../libpromises/libpromises.la

str_test_SOURCES = str_test.c
str_test_LDADD = libstr.la

regex_test_SOURCES = regex_test.c ../../libpromises/match_scope.c

Expand Down Expand Up @@ -258,14 +245,14 @@ 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 = libdb.la
db_concurrent_test_LDADD = libtest.la libdb.la

lastseen_test_SOURCES = lastseen_test.c \
../../libpromises/item_lib.c \
../../libpromises/lastseen.c \
../../libntech/libutils/statistics.c
#lastseen_test_CPPFLAGS = $(libdb_la_CPPFLAGS)
lastseen_test_LDADD = libdb.la ../../libpromises/libpromises.la
lastseen_test_LDADD = libtest.la libdb.la ../../libpromises/libpromises.la

lastseen_migration_test_SOURCES = lastseen_migration_test.c \
../../libpromises/lastseen.c \
Expand Down

0 comments on commit f852c14

Please sign in to comment.