From 2c918aad6763754bdffb84796b410e21f24bb7ec Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Fri, 19 Jan 2024 11:37:40 +0000 Subject: [PATCH] tests: Use /tmp for tmpdirs that contain sockets Socket paths have a length limit, and depending on the working directory of the source code, these tests occasionally fail if the path is too long. Avoid this by using a template string that is absolute and in /tmp, which should avoid the socket path length issues. This fixes building libssh with pkcs11 provider support in 'fedpkg mockbuild'. Signed-off-by: Clemens Lang Reviewed-by: Jakub Jelen --- tests/client/torture_auth_pkcs11.c | 2 +- tests/unittests/torture_pki_ecdsa_uri.c | 2 +- tests/unittests/torture_pki_rsa_uri.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/client/torture_auth_pkcs11.c b/tests/client/torture_auth_pkcs11.c index f0658484..2537d2d8 100644 --- a/tests/client/torture_auth_pkcs11.c +++ b/tests/client/torture_auth_pkcs11.c @@ -40,7 +40,7 @@ #define LIBSSH_ECDSA_384_TESTKEY "id_pkcs11_ecdsa_384" #define LIBSSH_ECDSA_521_TESTKEY "id_pkcs11_ecdsa_521" -const char template[] = "temp_dir_XXXXXX"; +const char template[] = "/tmp/temp_dir_XXXXXX"; struct pki_st { char *temp_dir; diff --git a/tests/unittests/torture_pki_ecdsa_uri.c b/tests/unittests/torture_pki_ecdsa_uri.c index fe38c6c6..fd3088b8 100644 --- a/tests/unittests/torture_pki_ecdsa_uri.c +++ b/tests/unittests/torture_pki_ecdsa_uri.c @@ -27,7 +27,7 @@ #define PUB_URI_FMT_384_INVALID_TOKEN "pkcs11:token=ecdsa521;object=ecdsa384;type=public" #define PUB_URI_FMT_521_INVALID_OBJECT "pkcs11:token=ecdsa521;object=ecdsa384;type=public" -const char template[] = "temp_dir_XXXXXX"; +const char template[] = "/tmp/temp_dir_XXXXXX"; const unsigned char INPUT[] = "1234567890123456789012345678901234567890" "123456789012345678901234"; struct pki_st { diff --git a/tests/unittests/torture_pki_rsa_uri.c b/tests/unittests/torture_pki_rsa_uri.c index a13e470c..46c9a083 100644 --- a/tests/unittests/torture_pki_rsa_uri.c +++ b/tests/unittests/torture_pki_rsa_uri.c @@ -16,7 +16,7 @@ #define PUB_URI_FMT "pkcs11:token=%s;object=%s;type=public" #define PRIV_URI_FMT "pkcs11:token=%s;object=%s;type=private?pin-value=%s" -const char template[] = "temp_dir_XXXXXX"; +const char template[] = "/tmp/temp_dir_XXXXXX"; const unsigned char INPUT[] = "1234567890123456789012345678901234567890" "123456789012345678901234"; struct pki_st {