commit a1f9c9ccbd2886ecb5d4050fd1abb7c8151996c7
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Fri Aug 21 00:33:44 2026 +0200

    tests: print error message on spd_open failure

diff --git a/src/tests/clibrary.c b/src/tests/clibrary.c
index 0db6cacf..92417b56 100644
--- a/src/tests/clibrary.c
+++ b/src/tests/clibrary.c
@@ -37,13 +37,14 @@ int main()
 	
 	SPDConnection *conn;
 	int i, ret;
+	char *error;
 
 	printf("Start of the test of the test.\n");
 
 	printf("Trying to initialize Speech Daemon...\n");
-	conn = spd_open("say", NULL, NULL, SPD_MODE_SINGLE);
+	conn = spd_open2("say", NULL, NULL, SPD_MODE_SINGLE, NULL, 1, &error);
 	if (conn == 0) {
-		printf("Speech Daemon failed.\n");
+		printf("Speech Daemon failed:\n%s\n", error);
 		exit(1);
 	}
 	printf("OK\n");
diff --git a/src/tests/clibrary2.c b/src/tests/clibrary2.c
index 3fec491c..7a42a1ce 100644
--- a/src/tests/clibrary2.c
+++ b/src/tests/clibrary2.c
@@ -52,6 +52,7 @@ int main()
 	char **voices;
 	char *module;
 	char *language;
+	char *error;
 	int value;
 	SPDVoiceType voice_type = SPD_CHILD_MALE;
 	SPDVoice **synth_voices;
@@ -72,15 +73,15 @@ int main()
 	printf("Start of the test.\n");
 
 	printf("Trying to initialize Speech Daemon...\n");
-	conn = spd_open("say", NULL, NULL,
+	conn = spd_open2("say", NULL, NULL,
 #ifdef THOROUGH
-			SPD_MODE_THREADED
+			SPD_MODE_THREADED,
 #else
-			SPD_MODE_SINGLE
+			SPD_MODE_SINGLE,
 #endif
-			);
+			NULL, 1, &error);
 	if (conn == 0) {
-		printf("Speech Daemon failed\n");
+		printf("Speech Daemon failed:\n%s\n", error);
 		exit(1);
 	}
 	printf("OK\n");
diff --git a/src/tests/connection-recovery.c b/src/tests/connection-recovery.c
index fa51eb43..cc2ae589 100644
--- a/src/tests/connection-recovery.c
+++ b/src/tests/connection-recovery.c
@@ -36,14 +36,17 @@ SPDConnection *try_to_reconnect(void)
 {
 	SPDConnection *conn;
 	while (1) {
+		char *error;
 		printf("Trying to reconnect\n");
 		usleep(1000);
-		conn = spd_open("test", NULL, NULL, SPD_MODE_THREADED);
+		conn = spd_open2("test", NULL, NULL, SPD_MODE_THREADED, NULL, 1, &error);
 		if (conn != NULL) {
 			spd_say(conn, SPD_MESSAGE, "Reconnect successful");
 			printf("Reconnect successful\n");
 			return conn;
 		}
+		printf("Reconnect failed:\n%s\n", error);
+		free(error);
 	}
 }
 
@@ -53,10 +56,11 @@ int main(void)
 	int i = 0;
 	int failures = 0;
 	int ret;
+	char *error;
 
-	conn = spd_open("test", NULL, NULL, SPD_MODE_THREADED);
+	conn = spd_open2("test", NULL, NULL, SPD_MODE_THREADED, NULL, 1, &error);
 	if (conn == 0) {
-		printf("Speech Daemon failed\n");
+		printf("Speech Daemon failed:\n%s\n", error);
 		exit(1);
 	}
 
diff --git a/src/tests/long_message.c b/src/tests/long_message.c
index b4e8c79e..60b1de36 100644
--- a/src/tests/long_message.c
+++ b/src/tests/long_message.c
@@ -34,13 +34,14 @@ int main()
 {
 	SPDConnection *sockfd;
 	int ret;
+	char *error;
 
 	printf("Start of the test.\n");
 
 	printf("Trying to initialize Speech Dispatcher...\n");
-	sockfd = spd_open("test", NULL, NULL, SPD_MODE_SINGLE);
+	sockfd = spd_open2("test", NULL, NULL, SPD_MODE_SINGLE, NULL, 1, &error);
 	if (sockfd == 0) {
-		printf("Speech Dispatcher failed\n");
+		printf("Speech Daemon failed:\n%s\n", error);
 		exit(1);
 	}
 	printf("OK\n");
diff --git a/src/tests/spd_cancel_long_message.c b/src/tests/spd_cancel_long_message.c
index 30590d1f..0e35d05a 100644
--- a/src/tests/spd_cancel_long_message.c
+++ b/src/tests/spd_cancel_long_message.c
@@ -49,11 +49,12 @@ static void notification_cb(size_t msg_id, size_t client_id,
 int main(int argc, char *argv[])
 {
 	int result, count;
+	char *error;
 
 	/* Open Speech Dispatcher connection */
-	spd = spd_open(TEST_NAME, __FUNCTION__, NULL, SPD_MODE_THREADED);
+	spd = spd_open2(TEST_NAME, __FUNCTION__, NULL, SPD_MODE_THREADED, NULL, 1, &error);
 	if (!spd) {
-		printf("Speech-dispatcher: Failed to open connection. \n");
+		printf("Speech-dispatcher: Failed to open connection:\n%s\n", error);
 		exit(1);
 	}
 
diff --git a/src/tests/spd_set_notifications_all.c b/src/tests/spd_set_notifications_all.c
index 84824ea1..1ef85299 100644
--- a/src/tests/spd_set_notifications_all.c
+++ b/src/tests/spd_set_notifications_all.c
@@ -55,11 +55,12 @@ void index_mark_cb(size_t msg_id, size_t client_id, SPDNotificationType type,
 int main(int argc, char *argv[])
 {
 	int result, count;
+	char *error;
 
 	/* Open Speech Dispatcher connection in THREADED mode. */
-	spd = spd_open(TEST_NAME, __FUNCTION__, NULL, SPD_MODE_THREADED);
+	spd = spd_open2(TEST_NAME, __FUNCTION__, NULL, SPD_MODE_THREADED, NULL, 1, &error);
 	if (!spd) {
-		printf("Speech-dispatcher: Failed to open connection. \n");
+		printf("Speech-dispatcher: Failed to open connection:\n%s\n", error);
 		exit(1);
 	}
 
