summaryrefslogtreecommitdiff
path: root/mh/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-10-22 03:16:00 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-10-22 03:41:03 +0300
commit09372ddfbaeb45facface67dea795f8e9059d899 (patch)
tree6240cdadf4ed6bc9b28f28cc7195e9f737285d38 /mh/tests
parent2f34f8ae2c0f9207d94629d94f664f728094e990 (diff)
downloadmailutils-09372ddfbaeb45facface67dea795f8e9059d899.tar.gz
mailutils-09372ddfbaeb45facface67dea795f8e9059d899.tar.bz2
Fixes in the testsuite & some minor fixes.
* comsat/comsat.c (main): Use real UID to determine user name. Don't rely on environment variables. * maidag/util.c (maidag_error): Re-initialize va_list before reusing it. * mh/ali.c (ali_print_name_list): Change printing loop to correctly handle empty lists. * mh/mh_whatnow.c (quit): Print newline before returning. * comsat/tests/testsuite.at: Skip tests if run as root. * maidag/tests/forward.at: Skip test if run as root. * mh/tests/ali.at: Ignore comment lines in /etc/passwd and /etc/group. Make sure awk is run with a valid stdin. Some implementations (true awk, in particular) try to close stdin even if it is not used and bail out if unable to do so. * mh/tests/atlocal.in (mimeflt): Make sure awk is run with a valid stdin (see above). * mh/tests/anno.at: Always use semicolon before closing curly brace in sed expressions. * mh/tests/mark.at: Likewise. * mh/tests/pick.at: Likewise. * testsuite/testsuite.inc: Likewise. * mh/tests/comp.at: Reflect changes to mh_whatnow.c. * mh/tests/mhn.at: Don't rely on a particular tar output format.
Diffstat (limited to 'mh/tests')
-rw-r--r--mh/tests/ali.at12
-rw-r--r--mh/tests/anno.at8
-rw-r--r--mh/tests/atlocal.in2
-rw-r--r--mh/tests/comp.at3
-rw-r--r--mh/tests/mark.at12
-rw-r--r--mh/tests/mhn.at18
-rw-r--r--mh/tests/pick.at2
7 files changed, 28 insertions, 29 deletions
diff --git a/mh/tests/ali.at b/mh/tests/ali.at
index 4686aa8a2..21372a226 100644
--- a/mh/tests/ali.at
+++ b/mh/tests/ali.at
@@ -75,7 +75,7 @@ ali: mh_aliases2:2: `mh_aliases' already included at top level
])
MH_CHECK([ali: group name],[ali04 ali-group-name],[
-awk -F : '$4!="" { print $1; print $4; exit 0 }' /etc/group > tmpout
+cat /etc/group | awk -F : '/^#/ { next } $4!="" { print $1; print $4; exit 0 }' > tmpout
test -s tmpout || AT_SKIP_TEST
sed -n '1s/.*/korzen: =&/p' tmpout > mh_aliases
sed '1d' tmpout | tr -d ' ' > expout
@@ -85,14 +85,12 @@ ali -a ./mh_aliases korzen | tr -d ' '
[expout])
MH_CHECK([ali: group id],[ali05 ali-group-id ali-gid],[
-awk -F : '$4==0 { print $1 }' /etc/passwd > expout
+cat /etc/passwd | awk -F : '/^#/ { next } $4==0 { print $1 }' > expout
test -s expout || AT_SKIP_TEST
-name=`awk -F : '$3==0 { print $1 }' /etc/group`
+name=`awk -F : '/^#/ { next } $3==0 { print $1 }' /etc/group < /dev/null`
test -z "$name" && AT_SKIP_TEST
-AT_DATA([mh_aliases],[
-korzen: +root
-])
+echo "korzen: +$name" > mh_aliases
# FIXME: Do I need to sort the output?
ali -list -a ./mh_aliases korzen
],
@@ -100,7 +98,7 @@ ali -list -a ./mh_aliases korzen
[expout])
MH_CHECK([ali: everybody],[ali06 ali-everybody],[
-awk -F : '$3>200 { print $1 }' /etc/passwd > expout
+cat /etc/passwd | awk -F : '/^#/ { next } $3>200 { print $1 }' > expout
test -s expout || AT_SKIP_TEST
AT_DATA([mh_aliases],[
everybody: *
diff --git a/mh/tests/anno.at b/mh/tests/anno.at
index 25bed0911..a6d97ad06 100644
--- a/mh/tests/anno.at
+++ b/mh/tests/anno.at
@@ -22,7 +22,7 @@ MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "Current-Folder: inbox" > Mail/context
echo "cur: 1" > Mail/inbox/.mh_sequences
echo Replied | anno || exit $?
-sed -n '1{s/Replied: .*/REPLIED/p}' Mail/inbox/1
+sed -n '1{s/Replied: .*/REPLIED/p;}' Mail/inbox/1
],
[0],
[REPLIED
@@ -32,7 +32,7 @@ MH_CHECK([anno -component],[anno01 anno-component],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "Current-Folder: inbox" > Mail/context
anno -component Replied 1 || exit $?
-sed -n '1{s/Replied: .*/REPLIED/p}' Mail/inbox/1
+sed -n '1{s/Replied: .*/REPLIED/p;}' Mail/inbox/1
],
[0],
[REPLIED
@@ -42,7 +42,7 @@ MH_CHECK([anno -component -text],[anno02 anno-component-text],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "Current-Folder: inbox" > Mail/context
anno -component Replied -text OK 1 || exit $?
-sed -n '3,$d;/Replied/{s/Replied: [[A-Z][a-z][a-z], [0-9][0-9] [A-Z][a-z][a-z] [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] .*]/Replied: DATE/;p}' Mail/inbox/1
+sed -n '3,$d;/Replied/{s/Replied: [[A-Z][a-z][a-z], [0-9][0-9] [A-Z][a-z][a-z] [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] .*]/Replied: DATE/;p;}' Mail/inbox/1
],
[0],
[Replied: OK
@@ -53,7 +53,7 @@ MH_CHECK([anno -component -text -nodate],[anno03 anno-component-text-nodate],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "Current-Folder: inbox" > Mail/context
anno -component Replied -text OK -nodate 1 || exit $?
-sed -n '3,$d;/Replied/{s/Replied: [[A-Z][a-z][a-z], [0-9][0-9] [A-Z][a-z][a-z] [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] .*]/Replied: DATE/;p}' Mail/inbox/1
+sed -n '3,$d;/Replied/{s/Replied: [[A-Z][a-z][a-z], [0-9][0-9] [A-Z][a-z][a-z] [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] .*]/Replied: DATE/;p;}' Mail/inbox/1
],
[0],
[Replied: OK
diff --git a/mh/tests/atlocal.in b/mh/tests/atlocal.in
index 6a38c2bee..18e9d842f 100644
--- a/mh/tests/atlocal.in
+++ b/mh/tests/atlocal.in
@@ -35,5 +35,5 @@ awk '
} else
print
}
-' $*
+' $* </dev/null
}
diff --git a/mh/tests/comp.at b/mh/tests/comp.at
index b264f2532..88f423d67 100644
--- a/mh/tests/comp.at
+++ b/mh/tests/comp.at
@@ -49,7 +49,8 @@ cc:
Subject:
--------
-- Input file end
-What now?])
+What now?
+])
MH_CHECK([comp file],[comp02 comp_file],[
echo 'quit' | compcmd file | remove_curdir | sed 's/ *$//'
diff --git a/mh/tests/mark.at b/mh/tests/mark.at
index 3646e6c40..8072dc72b 100644
--- a/mh/tests/mark.at
+++ b/mh/tests/mark.at
@@ -22,7 +22,7 @@ MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo 'Current-Folder: inbox' > Mail/context
mark -sequence andro -add 2
mark -sequence andro -add 3-5
-sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
+sed -n '/^andro:/{s/ */ /g;s/ $//;p;}' Mail/inbox/.mh_sequences
],
[0],
[andro: 2 3 4 5
@@ -32,9 +32,9 @@ MH_CHECK([mark -add -zero],[mark01 mark-add-zero],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo 'Current-Folder: inbox' > Mail/context
mark -sequence andro -add 2
-sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
+sed -n '/^andro:/{s/ */ /g;s/ $//;p;}' Mail/inbox/.mh_sequences
mark -zero -sequence andro -add 1 3
-sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
+sed -n '/^andro:/{s/ */ /g;s/ $//;p;}' Mail/inbox/.mh_sequences
],
[0],
[andro: 2
@@ -45,7 +45,7 @@ MH_CHECK([mark -add -nopublic],[mark02 mark-add-nopublic],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo 'Current-Folder: inbox' > Mail/context
mark -nopublic -sequence andro -add 1 2 3
-sed -n '/^atr-andro/{s/ */ /g;s/ $//;s/^[[^:]]*:/atr-andro:/;p}' Mail/context
+sed -n '/^atr-andro/{s/ */ /g;s/ $//;s/^[[^:]]*:/atr-andro:/;p;}' Mail/context
],
[0],
[atr-andro: 1 2 3
@@ -56,7 +56,7 @@ MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo 'Current-Folder: inbox' > Mail/context
echo 'andro: 2 3 4 5' > Mail/inbox/.mh_sequences
mark -sequence andro -del 3
-sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
+sed -n '/^andro:/{s/ */ /g;s/ $//;p;}' Mail/inbox/.mh_sequences
],
[0],
[andro: 2 4 5
@@ -70,7 +70,7 @@ cat > Mail/context <<EOT
atr-andro-$inbox: 2 3 4 5
EOT
mark -nopublic -sequence andro -del 3
-sed -n '/^atr-andro/{s/ */ /g;s/ $//;s/^[[^:]]*:/atr-andro:/;p}' Mail/context
+sed -n '/^atr-andro/{s/ */ /g;s/ $//;s/^[[^:]]*:/atr-andro:/;p;}' Mail/context
],
[0],
[atr-andro: 2 4 5
diff --git a/mh/tests/mhn.at b/mh/tests/mhn.at
index d55d4e73c..74b96db67 100644
--- a/mh/tests/mhn.at
+++ b/mh/tests/mhn.at
@@ -337,7 +337,7 @@ MH_CHECK([mhn-show type=tar],[mhn13 mhn-show-type=tar],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
AT_DATA([filter.awk],[
/^X-IMAPbase/ { next }
-/^-rw-r--r--/ { print $1, $2, $3, $6; next }
+/^-rw-r--r--/ { print $NF; next }
{ print }
])
mhn -show 2 | awk -f filter.awk
@@ -355,8 +355,8 @@ X-Envelope-Sender: gray@example.net
part 1 text/plain 15
Initial text.
--rw-r--r-- gray/staff 1418 Father_William
--rw-r--r-- gray/staff 937 Jabberwocky
+Father_William
+Jabberwocky
])
# FIXME: What about exit code?
@@ -388,7 +388,7 @@ MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
echo "mhn-show-application/x-tar: %ltar tvf '%F'" >> $MH
AT_DATA([filter.awk],[
/^X-IMAPbase/ { next }
-/^-rw-r--r--/ { print $1, $2, $3, $6; next }
+/^-rw-r--r--/ { print $NF; next }
{ sub(/ *$/,""); print }
])
mhn -show 1 | awk -f filter.awk
@@ -407,8 +407,8 @@ part 1 text/plain 15
Initial text.
part 2 application/x-tar 13835
--rw-r--r-- gray/staff 1418 Father_William
--rw-r--r-- gray/staff 937 Jabberwocky
+Father_William
+Jabberwocky
])
MH_CHECK([mhn-show- variable (without subtype)],
@@ -417,7 +417,7 @@ MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
echo "mhn-show-application: %ltar tvf '%F'" >> $MH
AT_DATA([filter.awk],[
/^X-IMAPbase/ { next }
-/^-rw-r--r--/ { print $1, $2, $3, $6; next }
+/^-rw-r--r--/ { print $NF; next }
{ sub(/ *$/,""); print }
])
mhn -show 1 | awk -f filter.awk
@@ -436,8 +436,8 @@ part 1 text/plain 15
Initial text.
part 2 application/x-tar 13835
--rw-r--r-- gray/staff 1418 Father_William
--rw-r--r-- gray/staff 937 Jabberwocky
+Father_William
+Jabberwocky
])
dnl -------------------------------------------------------------------
diff --git a/mh/tests/pick.at b/mh/tests/pick.at
index 726b4bdb3..81ffe750d 100644
--- a/mh/tests/pick.at
+++ b/mh/tests/pick.at
@@ -46,7 +46,7 @@ MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
echo "Current-Folder: inbox" > Mail/context
echo "cur: 1" > Mail/inbox/.mh_sequences
pick -from dormouse -sequence dormouse || exit $?
-sed -n '/^dormouse:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
+sed -n '/^dormouse:/{s/ */ /g;s/ $//;p;}' Mail/inbox/.mh_sequences
],
[0],
[dormouse: 17 31 49 61 65 67 69 77 79 81 83 88 89 91 92

Return to:

Send suggestions and report system problems to the System administrator.