Skip to content

Commit 8d9eb39

Browse files
committed
tests: add prefix to all perror calls
1 parent a067af4 commit 8d9eb39

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tests/client-server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def wait_tcp_port(host, port):
3131
.format(time.strftime("%c"), host, port))
3232
time.sleep(0.1)
3333
else:
34-
print("unable to connect")
34+
print("client-server.py: unable to connect")
3535
sys.exit(1)
3636
print("client-server.py: detected server is up on {}:{}".format(host, port))
3737

tests/client.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ make_conn(const char *hostname, const char *port)
4848
getaddrinfo_output->ai_socktype,
4949
getaddrinfo_output->ai_protocol);
5050
if(sockfd < 0) {
51-
perror("making socket");
51+
perror("client: making socket");
5252
goto cleanup;
5353
}
5454

5555
int connect_result = connect(
5656
sockfd, getaddrinfo_output->ai_addr, getaddrinfo_output->ai_addrlen);
5757
if(connect_result < 0) {
58-
perror("connecting");
58+
perror("client: connecting");
5959
goto cleanup;
6060
}
6161
enum demo_result result = nonblock(sockfd);
@@ -205,7 +205,7 @@ send_request_and_read_response(struct conndata *conn,
205205

206206
int select_result = select(sockfd + 1, &read_fds, &write_fds, NULL, NULL);
207207
if(select_result == -1) {
208-
perror("select");
208+
perror("client: select");
209209
goto cleanup;
210210
}
211211

tests/server.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ handle_conn(struct conndata *conn)
151151

152152
int result = select(sockfd + 1, &read_fds, &write_fds, NULL, &tv);
153153
if(result == -1) {
154-
perror("select");
154+
perror("server: select");
155155
goto cleanup;
156156
}
157157
if(result == 0) {
@@ -254,7 +254,7 @@ main(int argc, const char **argv)
254254
struct sigaction siga = { 0 };
255255
siga.sa_handler = handle_signal;
256256
if(sigaction(SIGTERM, &siga, NULL) == -1) {
257-
perror("setting a signal handler");
257+
perror("server: setting a signal handler");
258258
return 1;
259259
}
260260
#endif /* _WIN32 */
@@ -343,12 +343,12 @@ main(int argc, const char **argv)
343343

344344
if(bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_in)) ==
345345
-1) {
346-
perror("bind");
346+
perror("server: bind");
347347
goto cleanup;
348348
}
349349

350350
if(listen(sockfd, 50) == -1) {
351-
perror("listen");
351+
perror("server: listen");
352352
goto cleanup;
353353
}
354354
LOG("listening on localhost:8443. AUTH_CERT=%s, AUTH_CRL=%s, VECTORED_IO=%s",
@@ -365,7 +365,7 @@ main(int argc, const char **argv)
365365
break;
366366
}
367367
if(clientfd < 0) {
368-
perror("accept");
368+
perror("server: accept");
369369
goto cleanup;
370370
}
371371

0 commit comments

Comments
 (0)