Skip to content

Commit 1c840fc

Browse files
committed
Fix linker errors in make check
Added a test-only stub source that defines the globals required by libfapolicyd during unit-test linking. This is a result of commit #b9b8bbd Linked the new stub into the libfapolicyd-based test binaries to resolve missing symbols during make check.
1 parent a8c9538 commit 1c840fc

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/tests/Makefile.am

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ AM_CPPFLAGS = -I${top_srcdir}/src/library/
2828
AM_CFLAGS = -std=gnu11
2929

3030
avl_test_SOURCES = avl_test.c ${top_srcdir}/src/library/avl.c
31-
gid_proc_test_SOURCES = gid_proc_test.c
31+
gid_proc_test_SOURCES = gid_proc_test.c test-stubs.c
3232
gid_proc_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
33-
uid_proc_test_SOURCES = uid_proc_test.c
33+
uid_proc_test_SOURCES = uid_proc_test.c test-stubs.c
3434
uid_proc_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
35-
escape_test_SOURCES = escape_test.c
35+
escape_test_SOURCES = escape_test.c test-stubs.c
3636
escape_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
37-
attr_sets_test_SOURCES = attr_sets_test.c
37+
attr_sets_test_SOURCES = attr_sets_test.c test-stubs.c
3838
attr_sets_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
39-
elf_file_test_SOURCES = elf_file_test.c
39+
elf_file_test_SOURCES = elf_file_test.c test-stubs.c
4040
elf_file_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
41-
fd_fgets_test_SOURCES = fd_fgets_test.c
41+
fd_fgets_test_SOURCES = fd_fgets_test.c test-stubs.c
4242
fd_fgets_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
43-
file_type_detect_test_SOURCES = file_type_detect_test.c
43+
file_type_detect_test_SOURCES = file_type_detect_test.c test-stubs.c
4444
file_type_detect_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
4545
rules_test_SOURCES = rules_test.c
4646
rules_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
4747
rules_test_CPPFLAGS = -I${top_srcdir}/src/library/ -DTEST_BASE=\"${top_srcdir}\"
4848
trustdb_format_test_SOURCES = trustdb_format_test.c
49-
lru_test_SOURCES = lru_test.c
49+
lru_test_SOURCES = lru_test.c test-stubs.c
5050
lru_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
5151
event_test_SOURCES = event_test.c
5252
event_test_LDADD = \
@@ -63,10 +63,12 @@ event_test_DEPENDENCIES = $(event_test_LDADD)
6363
if WITH_RPM
6464
check_PROGRAMS += filter_test
6565
filter_test_SOURCES = filter_test.c
66+
filter_test_SOURCES += test-stubs.c
6667
filter_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
6768
filter_test_CPPFLAGS = -I${top_srcdir}/src/library/ -DTEST_BASE=\"${top_srcdir}\"
6869
check_PROGRAMS += file_filter_test
6970
file_filter_test_SOURCES = file_filter_test.c
71+
file_filter_test_SOURCES += test-stubs.c
7072
file_filter_test_LDADD = ${top_builddir}/src/.libs/libfapolicyd.la
7173
file_filter_test_CPPFLAGS = -I${top_srcdir}/src/library/ -DTEST_BASE=\"${top_srcdir}\"
7274
endif

src/tests/test-stubs.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* test-stubs.c - provide globals needed by libfapolicyd for unit tests
3+
*
4+
* This file supplies minimal definitions of globals referenced by the
5+
* library so that standalone tests can link without pulling in the daemon
6+
* or CLI entry points.
7+
*/
8+
9+
#include <stdatomic.h>
10+
11+
#include "conf.h"
12+
13+
atomic_bool stop;
14+
unsigned int debug_mode;
15+
conf_t config;

0 commit comments

Comments
 (0)