Skip to content

Commit cb13fe7

Browse files
committed
Disable some tests when static is disabled
When static is disabled, it prevents a few tests from working in the auparse tests. This is because of visibility not working. Added a new BUILD_STATIC conditional in the build scripts to detect when static libraries are unavailable during configuration. Updated the auparse test makefile to exclude internal tests by default and only include databuf_test, lru_cache_test, and uid_name_wrap_test when static linking is enabled.
1 parent c2238c3 commit cb13fe7

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

auparse/test/Makefile.am

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
#
2222

2323
CONFIG_CLEAN_FILES = *.loT *.rej *.orig *.cur
24-
noinst_PROGRAMS = auparse_test auparselol_test lookup_test databuf_test \
25-
auparse_extra_test lru_cache_test uid_name_wrap_test
24+
noinst_PROGRAMS = auparse_test auparselol_test lookup_test auparse_extra_test
2625
TESTS = run_auparse_tests.sh run_auparselol_test.sh lookup_test \
27-
databuf_test auparse_extra_test lru_cache_test uid_name_wrap_test
26+
auparse_extra_test
2827
dist_check_SCRIPTS = run_auparse_tests.sh run_auparselol_test.sh
2928
EXTRA_DIST = auparse_test.ref auparse_test.ref.py test.log test2.log test3.log test4.log auditd_raw.sed run_auparse_tests.sh auparse_test.py run_auparselol_test.sh
3029
CLEANFILES = run_auparse_tests.sh run_auparselol_test.sh
@@ -39,7 +38,12 @@ AM_LDFLAGS = ${ASAN_FLAGS}
3938
else
4039
AM_CFLAGS = -D_GNU_SOURCE -Wno-pointer-sign ${WFLAGS}
4140
endif
41+
42+
if BUILD_STATIC
4243
STATIC_LINK = -static
44+
noinst_PROGRAMS += databuf_test lru_cache_test uid_name_wrap_test
45+
TESTS += databuf_test lru_cache_test uid_name_wrap_test
46+
endif
4347

4448
lookup_test_SOURCES = lookup_test.c
4549
lookup_test_LDFLAGS = ${STATIC_LINK}
@@ -59,18 +63,19 @@ auparselol_test_LDADD = ${top_builddir}/auparse/libauparse.la \
5963
${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
6064
auparselol_test_DEPENDENCIES = ${top_builddir}/auparse/libauparse.la ${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
6165

62-
databuf_test_SOURCES = databuf_test.c
63-
databuf_test_LDFLAGS = ${STATIC_LINK}
64-
databuf_test_LDADD = ${top_builddir}/auparse/libauparse.la \
65-
${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
66-
databuf_test_DEPENDENCIES = ${top_builddir}/auparse/libauparse.la ${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
67-
6866
auparse_extra_test_SOURCES = auparse_extra_test.c
6967
auparse_extra_test_LDFLAGS = ${STATIC_LINK}
7068
auparse_extra_test_LDADD = ${top_builddir}/auparse/libauparse.la \
7169
${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
7270
auparse_extra_test_DEPENDENCIES = ${top_builddir}/auparse/libauparse.la ${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
7371

72+
if BUILD_STATIC
73+
databuf_test_SOURCES = databuf_test.c
74+
databuf_test_LDFLAGS = ${STATIC_LINK}
75+
databuf_test_LDADD = ${top_builddir}/auparse/libauparse.la \
76+
${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
77+
databuf_test_DEPENDENCIES = ${top_builddir}/auparse/libauparse.la ${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
78+
7479
lru_cache_test_SOURCES = lru_cache_test.c
7580
lru_cache_test_LDFLAGS = ${STATIC_LINK}
7681
lru_cache_test_LDADD = ${top_builddir}/auparse/libauparse.la \
@@ -82,6 +87,7 @@ uid_name_wrap_test_LDFLAGS = ${STATIC_LINK}
8287
uid_name_wrap_test_LDADD = ${top_builddir}/auparse/libauparse.la \
8388
${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
8489
uid_name_wrap_test_DEPENDENCIES = ${top_builddir}/auparse/libauparse.la ${top_builddir}/lib/libaudit.la ${top_builddir}/common/libaucommon.la
90+
endif
8591

8692
drop_srcdir = sed 's,$(srcdir)/test,test,'
8793

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ CFLAGS="${TMPCFLAGS}"
313313
LDFLAGS="${TMPLDFLAGS}"
314314
AC_SUBST(ASAN_FLAGS)
315315
AM_CONDITIONAL(HAVE_ASAN, test x$have_asan = xyes)
316+
AM_CONDITIONAL(BUILD_STATIC, test "x$enable_static" != "xno")
316317

317318
withval=""
318319
AC_MSG_CHECKING(whether to include arm eabi processor support)

0 commit comments

Comments
 (0)