aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-05-10 17:58:29 +0200
committerMarc Hoersken <info@marc-hoersken.de>2020-05-10 17:58:29 +0200
commit000f72169092ffca83e571d16ec840c7b840f756 (patch)
treeee3126985617bdaccd9438d7afbc9a70271fce65 /tests
parent6f63ab41b2949ad9819efb0f585122b880cd55ba (diff)
tests/server/tftpd.c: fix include and enhance debug logging
setjmp.h should only be included if HAVE_SETJMP_H is defined. Add additional log statements to see wether reads and writes are blocking or finishing before an alarm signal is received. Assisted-by: Peter Wu Part of #5364
Diffstat (limited to 'tests')
-rw-r--r--tests/server/tftpd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index 0c0e9bedf..4215bfe4a 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -78,7 +78,9 @@
#include <sys/filio.h>
#endif
+#ifdef HAVE_SETJMP_H
#include <setjmp.h>
+#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -1183,8 +1185,9 @@ static void sendtftp(struct testcase *test, struct formats *pf)
}
send_data:
+ logmsg("write");
if(swrite(peer, sdp, size + 4) != size + 4) {
- logmsg("write");
+ logmsg("write: fail");
return;
}
read_ahead(test, pf->f_convert);
@@ -1192,7 +1195,9 @@ static void sendtftp(struct testcase *test, struct formats *pf)
#ifdef HAVE_ALARM
alarm(rexmtval); /* read the ack */
#endif
+ logmsg("read");
n = sread(peer, &ackbuf.storage[0], sizeof(ackbuf.storage));
+ logmsg("read: %zd", n);
#ifdef HAVE_ALARM
alarm(0);
#endif
@@ -1252,8 +1257,9 @@ static void recvtftp(struct testcase *test, struct formats *pf)
(void) sigsetjmp(timeoutbuf, 1);
#endif
send_ack:
+ logmsg("write");
if(swrite(peer, &ackbuf.storage[0], 4) != 4) {
- logmsg("write: fail\n");
+ logmsg("write: fail");
goto abort;
}
write_behind(test, pf->f_convert);
@@ -1261,14 +1267,16 @@ send_ack:
#ifdef HAVE_ALARM
alarm(rexmtval);
#endif
+ logmsg("read");
n = sread(peer, rdp, PKTSIZE);
+ logmsg("read: %zd", n);
#ifdef HAVE_ALARM
alarm(0);
#endif
if(got_exit_signal)
goto abort;
if(n < 0) { /* really? */
- logmsg("read: fail\n");
+ logmsg("read: fail");
goto abort;
}
rdp->th_opcode = ntohs((unsigned short)rdp->th_opcode);