From: Baptiste Daroussin Date: Sat, 11 Feb 2023 07:14:55 +0000 (+0100) Subject: tests: use atf_utils_readline X-Git-Tag: RELEASE_1_4_0b1~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7080bb3a54b8f9cf6f7aa9c01101f249bbe2173;p=thirdparty%2Fmlmmj.git tests: use atf_utils_readline --- diff --git a/tests/mlmmj.c b/tests/mlmmj.c index 2f800386..d2a244f7 100644 --- a/tests/mlmmj.c +++ b/tests/mlmmj.c @@ -338,7 +338,7 @@ ATF_TC_BODY(init_sock, tc) exit(0); } close(mypipe[1]); - mygetline(mypipe[0]); + atf_utils_readline(mypipe[0]); int sock; do { init_sockfd(&sock, "127.0.0.1", 25678); @@ -1006,7 +1006,7 @@ ATF_TC_BODY(smtp, tc) if (p == 0) { dprintf(smtppipe[0], "220 me fake smtp\n"); /* EHLO */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "250-hostname.net\n" "250-PIPELINEING\n" @@ -1019,31 +1019,31 @@ ATF_TC_BODY(smtp, tc) "250-SMTPUTF8\n" "250 CHUNKING\n"); /* HELO */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "250-hostname.net\n"); /* MAIL FROM */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); /* RCPT TO */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); /* DATA */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "354 Send message content; end with .\n"); /* DATA */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); /* QUIT */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "221 2.0.0 Bye\n"); /* RSET */ - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); dprintf(smtppipe[0], "250 2.0.0 Ok\n"); exit (0); @@ -1092,7 +1092,7 @@ ATF_TC_BODY(init_smtp, tc) if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); - reply = mygetline(c); + reply = atf_utils_readline(c); printf("%s", reply); dprintf(c, "250-hostname.net\n" @@ -1105,13 +1105,13 @@ ATF_TC_BODY(init_smtp, tc) "250-DSN\n" "250-SMTPUTF8\n" "250 CHUNKING\n"); - reply = mygetline(c); + reply = atf_utils_readline(c); printf("%s", reply); dprintf(c, "221 2.0.0 bye\n"); exit(0); } close(smtppipe[1]); - mygetline(smtppipe[0]); + atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, 0); @@ -1137,7 +1137,7 @@ ATF_TC_BODY(smtp_bad_greetings, tc) exit(0); } close(smtppipe[1]); - mygetline(smtppipe[0]); + atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, MLMMJ_CONNECT); @@ -1160,13 +1160,13 @@ ATF_TC_BODY(smtp_bad_ehlo, tc) if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); - reply = mygetline(c); + reply = atf_utils_readline(c); printf("%s", reply); dprintf(c, "501 nop nope\n"); exit(0); } close(smtppipe[1]); - mygetline(smtppipe[0]); + atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, MLMMJ_EHLO); @@ -1189,23 +1189,23 @@ ATF_TC_BODY(smtp_no_ehlo, tc) if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); - reply = mygetline(c); + reply = atf_utils_readline(c); printf("%s", reply); dprintf(c, "801 meh\n"); - reply = mygetline(c); + reply = atf_utils_readline(c); printf("%s", reply); close(c); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); - reply = mygetline(c); + reply = atf_utils_readline(c); printf("%s", reply); dprintf(c, "250 OK\n"); exit(0); } close(smtppipe[1]); - mygetline(smtppipe[0]); + atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, 0); @@ -1256,11 +1256,11 @@ ATF_TC_BODY(send_mail_0, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); /* nope */ dprintf(smtppipe[0], "550 2.1.0 kO\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); exit(0); } @@ -1296,13 +1296,13 @@ ATF_TC_BODY(send_mail_1, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "550 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); exit(0); } @@ -1323,16 +1323,16 @@ ATF_TC_BODY(send_mail_2, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "550 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); exit(0); } @@ -1353,16 +1353,16 @@ ATF_TC_BODY(send_mail_3, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "550 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); exit(0); } @@ -1383,16 +1383,16 @@ ATF_TC_BODY(send_mail_4, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); exit(0); } @@ -1413,25 +1413,25 @@ ATF_TC_BODY(send_mail_5, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "350 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "350 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); exit(0); } @@ -1452,24 +1452,24 @@ ATF_TC_BODY(send_mail_6, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "350 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); exit(0); @@ -1492,24 +1492,24 @@ ATF_TC_BODY(send_mail_7, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "350 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); exit(0); @@ -1533,26 +1533,26 @@ ATF_TC_BODY(send_mail_8, tc) ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { - char *reply = mygetline(smtppipe[0]); + char *reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 Ok\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "350 2.1.0 OK\n"); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); - reply = mygetline(smtppipe[0]); + reply = atf_utils_readline(smtppipe[0]); printf("%s", reply); dprintf(smtppipe[0], "250 2.1.0 OK\n"); exit(0);