summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-06-27 11:22:44 +0200
committerDaiki Ueno <ueno@gnu.org>2018-07-16 16:19:42 +0200
commit9d2ce267e6714c6a565a9ded3aa0001918d1ae1d (patch)
tree013252e2aa1b30d2338080c54bd558362fc0fffa
parent8d8bff0a2edf4659b641dde1333eb6a7c695671c (diff)
build: Use separate p11-kit-{remote,server} executable for testing
Otherwise, the p11-kit-remote program called from p11-kit-server would load the system modules instead of the local fixtures.
-rw-r--r--.gitignore2
-rw-r--r--p11-kit/Makefile.am26
-rw-r--r--p11-kit/server.c2
-rw-r--r--p11-kit/test-server.c4
4 files changed, 31 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index a94118d..9390002 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,6 +103,8 @@ x86_64-w64-mingw32
/p11-kit-remote
/p11-kit-server
+/p11-kit-remote-testable
+/p11-kit-server-testable
/print-messages
/po/POTFILES
diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am
index 6b9a8a9..49d25dc 100644
--- a/p11-kit/Makefile.am
+++ b/p11-kit/Makefile.am
@@ -243,6 +243,15 @@ p11_kit_remote_LDADD = \
libp11-kit.la \
$(NULL)
+check_PROGRAMS += p11-kit-remote-testable
+p11_kit_remote_testable_SOURCES = $(p11_kit_remote_SOURCES)
+
+p11_kit_remote_testable_LDADD = \
+ libp11-tool.la \
+ libp11-common.la \
+ libp11-kit-testable.la \
+ $(NULL)
+
private_PROGRAMS += p11-kit-server
p11_kit_server_SOURCES = \
@@ -257,6 +266,23 @@ p11_kit_server_LDADD = \
$(NULL)
p11_kit_server_CFLAGS = \
+ -DP11_KIT_REMOTE=\"p11-kit-remote\" \
+ $(COMMON_CFLAGS) \
+ $(LIBSYSTEMD_CFLAGS) \
+ $(NULL)
+
+check_PROGRAMS += p11-kit-server-testable
+p11_kit_server_testable_SOURCES = $(p11_kit_server_SOURCES)
+
+p11_kit_server_testable_LDADD = \
+ libp11-tool.la \
+ libp11-common.la \
+ libp11-kit-testable.la \
+ $(LIBSYSTEMD_LIBS) \
+ $(NULL)
+
+p11_kit_server_testable_CFLAGS = \
+ -DP11_KIT_REMOTE=\"p11-kit-remote-testable\" \
$(COMMON_CFLAGS) \
$(LIBSYSTEMD_CFLAGS) \
$(NULL)
diff --git a/p11-kit/server.c b/p11-kit/server.c
index 0c0092b..87d6ad4 100644
--- a/p11-kit/server.c
+++ b/p11-kit/server.c
@@ -496,7 +496,7 @@ server_loop (Server *server,
}
n_args = 0;
- args[n_args] = "p11-kit-remote";
+ args[n_args] = P11_KIT_REMOTE;
n_args++;
if (server->provider) {
diff --git a/p11-kit/test-server.c b/p11-kit/test-server.c
index ca9ac42..691f68a 100644
--- a/p11-kit/test-server.c
+++ b/p11-kit/test-server.c
@@ -65,7 +65,7 @@ static void
setup_server (void *arg)
{
char *argv[] = {
- "p11-kit-server",
+ "p11-kit-server-testable",
"-f",
"--provider",
BUILDDIR "/.libs/mock-one" SHLEXT,
@@ -110,7 +110,7 @@ setup_server (void *arg)
if (test.pid == 0) {
close (STDOUT_FILENO);
dup2 (fds[0], STDOUT_FILENO);
- execv (BUILDDIR "/p11-kit-server", argv);
+ execv (BUILDDIR "/p11-kit-server-testable", argv);
_exit (0);
}