diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-11-04 15:54:26 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-11-04 15:54:26 +0200 |
commit | 829ca96f33688eb154b4281b52464000cd21520a (patch) | |
tree | eca48d20f8fb96812c870f98ca8b4595d6a249c4 | |
parent | fa9b7326dc4a76a7deb3ea445eb6581caa947dfb (diff) | |
download | mailfromd-829ca96f33688eb154b4281b52464000cd21520a.tar.gz mailfromd-829ca96f33688eb154b4281b52464000cd21520a.tar.bz2 |
Add tests fir dns_query
* tests/dns_query.at: New file.
* tests/Makefile.am: Add dns_query.at
* tests/testsuite.at: Likewise.
* tests/atlocal.in (MFOPTS): Change order of the include directories.
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rw-r--r-- | tests/dns_query.at | 118 | ||||
-rw-r--r-- | tests/testsuite.at | 5 |
4 files changed, 124 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index ee5b1094..b6666a4f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -64,6 +64,7 @@ TESTSUITE_AT = \ connect03.at\ curmsg.at\ declvar.at\ + dns_query.at\ enum.at\ eof.at\ expstr.at\ diff --git a/tests/atlocal.in b/tests/atlocal.in index 4ae2e96c..a84902e2 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -23,7 +23,7 @@ cleanup() { trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15 -MFOPTS="-I@abs_builddir@ -I@abs_builddir@/etc -I@abs_top_srcdir@/tests/etc -I@abs_top_srcdir@/src -I@abs_top_srcdir@/mflib --no-preprocess --no-config" +MFOPTS="-I@abs_builddir@ -I@abs_top_srcdir@/src -I@abs_top_srcdir@/mflib -I@abs_top_srcdir@/tests/etc --no-preprocess --no-config" MFADDOPTS= TESTDIR=@abs_builddir@ ETCDIR=@abs_top_srcdir@/tests/etc diff --git a/tests/dns_query.at b/tests/dns_query.at new file mode 100644 index 00000000..096b06c4 --- /dev/null +++ b/tests/dns_query.at @@ -0,0 +1,118 @@ +# This file is part of Mailfromd testsuite. -*- Autotest -*- +# Copyright (C) 2007-2020 Sergey Poznyakoff +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +m4_pushdef([DNS_QUERY_TEST],[ +AT_CHECK([ +AT_REQUIRE_DNS +cleardb + +AT_DATA([prog], +[require dns +func main(...) returns number +do + set n dns_query($1) + echo dns_reply_count(n) + loop for set i 0, + while i < dns_reply_count(n), + set i i + 1 + do + echo dns_reply_string(n, i) + done + return 0 +done +]) +mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog +], +[0], +[], +[$2])]) + +# ################################ + +AT_SETUP([dns_query: a]) +AT_KEYWORDS([dns dns_query dns_query_a]) +DNS_QUERY_TEST([DNS_TYPE_A, "bkmx.test1.mf.gnu.org.ua", 1], +[3 +192.0.2.3 +192.0.2.4 +192.0.2.5 +]) +AT_CLEANUP + +# ################################ + +AT_SETUP([dns_query: ptr]) +AT_KEYWORDS([dns dns_query dns_query_ptr]) +DNS_QUERY_TEST([DNS_TYPE_PTR, "198.51.100.2"], +[1 +mail1.test2.mf.gnu.org.ua +]) +AT_CLEANUP + +# ################################ + +AT_SETUP([dns_query: txt]) +AT_KEYWORDS([dns dns_query dns_query_txt]) +DNS_QUERY_TEST([DNS_TYPE_TXT, "test1.mf.gnu.org.ua", 1], +[2 +Mailfromd test domain 1 +v=spf1 -all +]) +AT_CLEANUP + +# ################################ + +AT_SETUP([dns_query: ns]) +AT_KEYWORDS([dns dns_query dns_query_ns]) +DNS_QUERY_TEST([DNS_TYPE_NS, "nstest.mf.gnu.org.ua", 1], +[3 +ns.test2.mf.gnu.org.ua +ns1.test1.mf.gnu.org.ua +ns2.test1.mf.gnu.org.ua +]) +AT_CLEANUP + +# ################################ + +AT_SETUP([dns_query: mx]) +AT_KEYWORDS([dns dns_query dns_query_mx]) + +DNS_QUERY_TEST([DNS_TYPE_MX, "test1.mf.gnu.org.ua"], +[3 +mail.test1.mf.gnu.org.ua +mail.test2.mf.gnu.org.ua +bkmx.test1.mf.gnu.org.ua +]) + +DNS_QUERY_TEST([DNS_TYPE_MX, "test1.mf.gnu.org.ua", 1], +[3 +bkmx.test1.mf.gnu.org.ua +mail.test1.mf.gnu.org.ua +mail.test2.mf.gnu.org.ua +]) + +DNS_QUERY_TEST([DNS_TYPE_MX, "test1.mf.gnu.org.ua", 1, 1], +[7 +192.0.2.2 +192.0.2.3 +192.0.2.4 +192.0.2.5 +198.51.100.2 +198.51.100.3 +198.51.100.4 +]) + +AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index 315f14c3..eb974e5a 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -238,12 +238,15 @@ m4_include([next01.at]) m4_include([next02.at]) m4_include([next03.at]) -AT_BANNER([Individual Functions]) +AT_BANNER([DNS Functions]) +m4_include([dns_query.at]) m4_include([resolve.at]) m4_include([rescname.at]) m4_include([hostname.at]) m4_include([hasmx.at]) m4_include([ismx.at]) + +AT_BANNER([Individual Functions]) m4_include([strings.at]) m4_include([sed.at]) |