diff options
author | Daiki Ueno <dueno@redhat.com> | 2019-06-01 12:54:49 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2019-06-18 14:17:28 +0200 |
commit | cbdbfaaf255083091decc280058caa87db19aeb9 (patch) | |
tree | de121040d00b4b635396abe6786c0c6ac1626692 | |
parent | 084347319f6e832ec2c36d7b27a64c8f2614f084 (diff) |
build: Don't hardcode module path
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | p11-kit/Makefile.am | 12 | ||||
-rw-r--r-- | p11-kit/test-deprecated.c | 2 | ||||
-rw-r--r-- | p11-kit/test-init.c | 2 | ||||
-rw-r--r-- | p11-kit/test-server.c | 12 | ||||
-rwxr-xr-x | p11-kit/test-server.sh | 4 | ||||
-rw-r--r-- | p11-kit/test-transport.c | 6 |
7 files changed, 25 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am index 53d92be..2adcaa7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,9 @@ DISTCHECK_CONFIGURE_FLAGS = \ AM_TESTS_ENVIRONMENT = \ abs_top_builddir="$(abs_top_builddir)"; \ - export abs_top_builddir; + export abs_top_builddir; \ + P11_MODULE_PATH="$(abs_top_builddir)/.libs"; \ + export P11_MODULE_PATH; AM_TESTS_FD_REDIRECT = 9>&2; LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am index b649119..bb4eaf5 100644 --- a/p11-kit/Makefile.am +++ b/p11-kit/Makefile.am @@ -336,9 +336,11 @@ test_conf_LDADD = $(p11_kit_LIBS) test_deprecated_SOURCES = p11-kit/test-deprecated.c test_deprecated_LDADD = $(p11_kit_LIBS) +test_deprecated_CFLAGS = $(AM_CPPFLAGS) $(libp11_kit_testable_la_CFLAGS) test_init_SOURCES = p11-kit/test-init.c test_init_LDADD = $(p11_kit_LIBS) +test_init_CFLAGS = $(AM_CPPFLAGS) $(libp11_kit_testable_la_CFLAGS) test_iter_SOURCES = p11-kit/test-iter.c test_iter_LDADD = $(p11_kit_LIBS) @@ -360,6 +362,7 @@ test_rpc_LDADD = $(p11_kit_LIBS) test_server_SOURCES = p11-kit/test-server.c test_server_LDADD = $(p11_kit_LIBS) +test_server_CFLAGS = $(AM_CPPFLAGS) $(libp11_kit_testable_la_CFLAGS) test_uri_SOURCES = p11-kit/test-uri.c test_uri_LDADD = $(p11_kit_LIBS) @@ -371,13 +374,13 @@ check_PROGRAMS += \ p11-kit/print-messages \ p11-kit/frob-setuid -print_messages_SOURCES = p11-kit/print-messages.c -print_messages_LDADD = $(p11_kit_LIBS) +p11_kit_print_messages_SOURCES = p11-kit/print-messages.c +p11_kit_print_messages_LDADD = $(p11_kit_LIBS) sh_tests += p11-kit/test-messages.sh -frob_setuid_SOURCES = p11-kit/frob-setuid.c -frob_setuid_LDADD = $(p11_kit_LIBS) +p11_kit_frob_setuid_SOURCES = p11-kit/frob-setuid.c +p11_kit_frob_setuid_LDADD = $(p11_kit_LIBS) c_tests += \ test-virtual \ @@ -398,6 +401,7 @@ test_managed_LDADD = $(p11_kit_LIBS) test_transport_SOURCES = p11-kit/test-transport.c test_transport_LDADD = $(p11_kit_LIBS) +test_transport_CFLAGS = $(AM_CPPFLAGS) $(libp11_kit_testable_la_CFLAGS) test_virtual_SOURCES = p11-kit/test-virtual.c test_virtual_LDADD = $(p11_kit_LIBS) diff --git a/p11-kit/test-deprecated.c b/p11-kit/test-deprecated.c index c8b8001..b61966d 100644 --- a/p11-kit/test-deprecated.c +++ b/p11-kit/test-deprecated.c @@ -471,7 +471,7 @@ test_load_and_initialize (void) CK_RV rv; int ret; - rv = p11_kit_load_initialize_module (BUILDDIR "/.libs/mock-one" SHLEXT, &module); + rv = p11_kit_load_initialize_module (P11_MODULE_PATH "/mock-one" SHLEXT, &module); assert (rv == CKR_OK); assert (module != NULL); diff --git a/p11-kit/test-init.c b/p11-kit/test-init.c index 18eb025..9cc691f 100644 --- a/p11-kit/test-init.c +++ b/p11-kit/test-init.c @@ -343,7 +343,7 @@ test_load_and_initialize (void) CK_RV rv; int ret; - module = p11_kit_module_load (BUILDDIR "/.libs/mock-one" SHLEXT, 0); + module = p11_kit_module_load (P11_MODULE_PATH "/mock-one" SHLEXT, 0); assert (module != NULL); rv = p11_kit_module_initialize (module); diff --git a/p11-kit/test-server.c b/p11-kit/test-server.c index 76b9d4e..a1fbcb7 100644 --- a/p11-kit/test-server.c +++ b/p11-kit/test-server.c @@ -169,7 +169,7 @@ test_initialize (void *unused) CK_FUNCTION_LIST_PTR module; CK_RV rv; - module = p11_kit_module_load (BUILDDIR "/.libs/p11-kit-client" SHLEXT, 0); + module = p11_kit_module_load (P11_MODULE_PATH "/p11-kit-client" SHLEXT, 0); assert (module != NULL); rv = p11_kit_module_initialize (module); @@ -190,7 +190,7 @@ test_initialize_no_address (void *unused) unsetenv ("P11_KIT_SERVER_ADDRESS"); setenv ("XDG_RUNTIME_DIR", test.directory, 1); - module = p11_kit_module_load (BUILDDIR "/.libs/p11-kit-client" SHLEXT, 0); + module = p11_kit_module_load (P11_MODULE_PATH "/p11-kit-client" SHLEXT, 0); assert (module != NULL); rv = p11_kit_module_initialize (module); @@ -212,7 +212,7 @@ test_open_session (void *arg) CK_ULONG count; CK_RV rv; - module = p11_kit_module_load (BUILDDIR "/.libs/p11-kit-client" SHLEXT, 0); + module = p11_kit_module_load (P11_MODULE_PATH "/p11-kit-client" SHLEXT, 0); assert (module != NULL); rv = p11_kit_module_initialize (module); @@ -244,7 +244,7 @@ test_open_session_write_protected (void *unused) CK_ULONG count; CK_RV rv; - module = p11_kit_module_load (BUILDDIR "/.libs/p11-kit-client" SHLEXT, 0); + module = p11_kit_module_load (P11_MODULE_PATH "/p11-kit-client" SHLEXT, 0); assert (module != NULL); rv = p11_kit_module_initialize (module); @@ -269,7 +269,7 @@ main (int argc, char *argv[]) { struct fixture with_provider = { - BUILDDIR "/.libs/mock-one" SHLEXT, + P11_MODULE_PATH "/mock-one" SHLEXT, "pkcs11:", 1 }; @@ -279,7 +279,7 @@ main (int argc, 3 }; struct fixture write_protected = { - BUILDDIR "/.libs/mock-one" SHLEXT, + P11_MODULE_PATH "/mock-one" SHLEXT, "pkcs11:?write-protected=yes", 1 }; diff --git a/p11-kit/test-server.sh b/p11-kit/test-server.sh index 74b9491..b6b8227 100755 --- a/p11-kit/test-server.sh +++ b/p11-kit/test-server.sh @@ -2,6 +2,8 @@ set -e +: ${P11_MODULE_PATH="$abs_top_builddir"/.libs} + testdir=`mktemp -d -t test-server.XXXXXX` if test $? -ne 0; then echo "cannot create temporary directory" >&2 @@ -23,7 +25,7 @@ export XDG_RUNTIME_DIR echo 1..4 -"$abs_top_builddir"/p11-kit/p11-kit-server -s --provider "$abs_top_builddir"/.libs/mock-one.so pkcs11: > start.env 2> start.err +"$abs_top_builddir"/p11-kit/p11-kit-server -s --provider "$P11_MODULE_PATH"/mock-one.so pkcs11: > start.env 2> start.err if test $? -eq 0; then echo "ok 1 /server/start" else diff --git a/p11-kit/test-transport.c b/p11-kit/test-transport.c index a5a93ea..521e14c 100644 --- a/p11-kit/test-transport.c +++ b/p11-kit/test-transport.c @@ -83,9 +83,9 @@ setup_remote (void *unused) p11_test_file_write (NULL, test.user_config, data, strlen (data)); setenv ("P11_KIT_PRIVATEDIR", BUILDDIR "/p11-kit", 1); - data = "remote: |" BUILDDIR "/p11-kit/p11-kit" EXEEXT " remote " BUILDDIR "/.libs/mock-two" SHLEXT "\n"; + data = "remote: |" BUILDDIR "/p11-kit/p11-kit" EXEEXT " remote " P11_MODULE_PATH "/mock-two" SHLEXT "\n"; p11_test_file_write (test.user_modules, "remote.module", data, strlen (data)); - data = "remote: |" BUILDDIR "/p11-kit/p11-kit" EXEEXT " remote " BUILDDIR "/.libs/mock-five" SHLEXT "\nx-init-reserved: initialize-arg"; + data = "remote: |" BUILDDIR "/p11-kit/p11-kit" EXEEXT " remote " P11_MODULE_PATH "/mock-five" SHLEXT "\nx-init-reserved: initialize-arg"; p11_test_file_write (test.user_modules, "init-arg.module", data, strlen (data)); p11_kit_override_system_files (NULL, test.user_config, @@ -192,7 +192,7 @@ launch_server (void) assert_num_cmp (rc, !=, -1); argv[0] = "p11-kit-remote"; - argv[1] = BUILDDIR "/.libs/mock-two.so"; + argv[1] = P11_MODULE_PATH "/mock-two.so"; argv[2] = NULL; rc = execv (BUILDDIR "/p11-kit/p11-kit-remote", argv); |