]> granicus.if.org Git - p11-kit/commitdiff
build: Use separate p11-kit-{remote,server} executable for testing
authorDaiki Ueno <dueno@redhat.com>
Wed, 27 Jun 2018 09:22:44 +0000 (11:22 +0200)
committerDaiki Ueno <ueno@gnu.org>
Mon, 16 Jul 2018 14:19:42 +0000 (16:19 +0200)
Otherwise, the p11-kit-remote program called from p11-kit-server would
load the system modules instead of the local fixtures.

.gitignore
p11-kit/Makefile.am
p11-kit/server.c
p11-kit/test-server.c

index a94118d84d1aa44458668c9e3cdc76e79184a84a..9390002883e531ac28eeb00424dbb2712408d671 100644 (file)
@@ -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
index 6b9a8a9a7e86163a8ca150ec148a1887de3c1f6c..49d25dcb06b34ed946f693a9ffc3ea6138d26cba 100644 (file)
@@ -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)
index 0c0092b8c15b944d3820025c42e5a92c7148705d..87d6ad4dd1780789153ccb424bbfa78e420f9caa 100644 (file)
@@ -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) {
index ca9ac42454106badeef48452cfc673bc3d0b69aa..691f68a264de435eb25eb3fedf51cb58ec69a52a 100644 (file)
@@ -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);
        }