]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
tests add simple functional tests about discarding invalid mails
authorBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 25 Oct 2022 15:22:50 +0000 (17:22 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 26 Oct 2022 09:39:21 +0000 (11:39 +0200)
tests/Kyuafile.in
tests/Makefile.am
tests/functional-tests.sh [new file with mode: 0644]

index 4d5c0e4c1128794da84bbbd64dfd58ab45b984c1..5daf0698bfa2c22aca9fd0b7b530b7fc2c0268cc 100644 (file)
@@ -4,3 +4,4 @@ test_suite('mlmmj')
 
 atf_test_program{name='mlmmj'}
 atf_test_program{name='mlmmj-send'}
+atf_test_program{name='functional-tests'}
index 770e78dc2cb3454dc94ef33582c6124bd0d52cfe..21711720518d53a0c5c150ab92bc298da3843363 100644 (file)
@@ -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 (file)
index 0000000..8536017
--- /dev/null
@@ -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
+}