From: Baptiste Daroussin Date: Tue, 25 Oct 2022 15:22:50 +0000 (+0200) Subject: tests add simple functional tests about discarding invalid mails X-Git-Tag: RELEASE_1_4_0a1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bb0ed6f3260c74a9ad97005d91dc901f2e99986;p=thirdparty%2Fmlmmj.git tests add simple functional tests about discarding invalid mails --- diff --git a/tests/Kyuafile.in b/tests/Kyuafile.in index 4d5c0e4c..5daf0698 100644 --- a/tests/Kyuafile.in +++ b/tests/Kyuafile.in @@ -4,3 +4,4 @@ test_suite('mlmmj') atf_test_program{name='mlmmj'} atf_test_program{name='mlmmj-send'} +atf_test_program{name='functional-tests'} diff --git a/tests/Makefile.am b/tests/Makefile.am index 770e78dc..21711720 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,7 +7,8 @@ mlmmj_SOURCES = mlmmj.c AM_CFLAGS = -g -Wall -pedantic -Wsign-compare -DDEFAULTTEXTDIR='"@textlibdir@"' -I$(srcdir)/../include @ATF_CFLAGS@ mlmmj_LDADD = $(top_builddir)/src/libmlmmj.a @ATF_LIBS@ -test_scripts = mlmmj-send.sh +test_scripts = mlmmj-send.sh \ + functional-tests.sh check_SCRIPTS= $(test_scripts:.sh=) SUFFIXES= .sh diff --git a/tests/functional-tests.sh b/tests/functional-tests.sh new file mode 100644 index 00000000..85360170 --- /dev/null +++ b/tests/functional-tests.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/test_env.sh + +tests_init \ + discard + +discard_body() +{ + + mlmmjrecv=$(command -v mlmmj-receive) + mlmmjmaint=$(command -v mlmmj-maintd) + init_ml list + here=$(pwd) + + atf_check -s exit:0 $mlmmjrecv -L list -F <<-EOF +bla +EOF + atf_check -o inline:"bla\n" cat list/queue/discarded/* + # the discarded file is too new, do not drop it yet + atf_check -s exit:0 $mlmmjmaint -F -L ${here}/list + atf_check -o inline:"bla\n" cat list/queue/discarded/* + atf_check touch -m -t 197001010101 list/queue/discarded/* + atf_check -s exit:0 $mlmmjmaint -F -L ${here}/list + atf_check -o inline:"list/queue/discarded\n" find list/queue/discarded -type d -empty +}