diff --git a/testsuite/distrib.good b/testsuite/distrib.good deleted file mode 100644 index a6a8426..0000000 --- a/testsuite/distrib.good +++ /dev/null @@ -1,29 +0,0 @@ -Path: mailnewsgateway -From crash@cygnus.com Wed Mar 8 18: 02:42 1995 -From: crash@cygnus.com (Jason Molenda) -Message-ID: <9503090202.AA06931.alt.buddha.fat.short.guy@phydeaux.cygnus.com> -Subject: Note for sed testsuite -Original-To: molenda@msi.umn.edu -Date: Wed, 8 Mar 1995 18:02:24 -0800 (PST) -X-Mailer: ELM [version 2.4 PL23] -Newsgroups: alt.buddha.short.fat.guy -Distribution: world -Sender: news@cygnus.com -Approved: alt.buddha.short.fat.guy@cygnus.com - - _Summum Bonum_ - - All the breath and the bloom of the - year in the bag of one bee: - All the wonder and wealth of the mine in - the heart of one gem: - In the core of one pearl all the shade and the - shine of the sea: - Breath and bloom, shade and shine, -- wonder, - wealth, and -- how far above them -- - Truth, thats brighter than gem, - Trust, that's purer than pearl, -- - Brightest truth, purest trust in the universe -- - all were for me - In the kiss of one girl. - -- Robert Browning diff --git a/testsuite/distrib.sed b/testsuite/distrib.sed deleted file mode 100644 index 918b30f..0000000 --- a/testsuite/distrib.sed +++ /dev/null @@ -1,56 +0,0 @@ -# This is straight out of C News -# -# -# All this does is massage the headers so they look like what news -# software expects. To:, Cc: and Resent-*: headers are masked. -# Reply-To: is turned into references, which is questionable (could -# just as well be dropped. -# -# The From: line is rewritten to use the "address (comments)" form -# instead of "phrase " form our mailer uses. Also, addresses -# with no "@domainname" are assumed to originate locally, and so are -# given a domain. -# -# The Sender: field below reflects the address of the person who -# maintains our mailing lists. The Approved: field is in a special -# form, so that we can do bidirectional gatewaying. Any message -# in a newsgroup that bears this stamp will not be fed into the -# matching mailing list. - -1i\ -Path: mailnewsgateway - :a - /^[Rr]eceived:/b r - /^[Nn]ewsgroups:/b r - /^[Pp]ath:/b r - /^[Tt][Oo]:/s/^/Original-/ - /^[Cc][Cc]:/s/^/Original-/ - /^[Rr][Ee][Ss][Ee][Nn][Tt]-.*/s/^/Original-/ - /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:/s/@/.alt.buddha.fat.short.guy@/ - s/^[Ii]n-[Rr]eply-[Tt]o:/References:/ - /^From:/{ - s/<\([^@]*\)>$/<\1@$thissite>/ - s/^From:[ ][ ]*\(.*\) *<\(.*\)>$/From: \2 (\1)/ - } - s/-[Ii]d:/-ID:/ - s/^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[ ]*$/Subject: (none)/ - s/^\([^:]*:\)[ ]*/\1 / - /^$/{i\ -Newsgroups: alt.buddha.short.fat.guy\ -Distribution: world\ -Sender: news@cygnus.com\ -Approved: alt.buddha.short.fat.guy@cygnus.com - b e - } - p - n - b a - :r - s/.*//g - n - /^[ ]/b r - b a - :e - p - n - b e diff --git a/testsuite/distrib.sh b/testsuite/distrib.sh index 21e4c08..35686d7 100644 --- a/testsuite/distrib.sh +++ b/testsuite/distrib.sh @@ -1,9 +1,29 @@ -#! /bin/sh -# -# This is stolen from C News -# +#!/bin/sh + +# Test runner for the old 'distrib' test + +# Copyright (C) 2017 Free Software Foundation, Inc. + +# 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 of the License, 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 . +. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed +print_ver_ sed + +fail=0 +# This is straight out of C News +# # # All this does is massage the headers so they look like what news # software expects. To:, Cc: and Resent-*: headers are masked. @@ -20,13 +40,10 @@ # form, so that we can do bidirectional gatewaying. Any message # in a newsgroup that bears this stamp will not be fed into the # matching mailing list. - -sed=${1-sed} - -$sed -n -e "1{i\\ +cat << \EOF > distrib.sed || framework_failure_ +1i\ Path: mailnewsgateway - }" \ - -e ":a + :a /^[Rr]eceived:/b r /^[Nn]ewsgroups:/b r /^[Pp]ath:/b r @@ -36,16 +53,16 @@ Path: mailnewsgateway /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:/s/@/.alt.buddha.fat.short.guy@/ s/^[Ii]n-[Rr]eply-[Tt]o:/References:/ /^From:/{ - s/<\([^@]*\)>\$/<\1@$thissite>/ - s/^From:[ ][ ]*\(.*\) *<\(.*\)>\$/From: \2 (\1)/ + s/<\([^@]*\)>$/<\1@$thissite>/ + s/^From:[ ][ ]*\(.*\) *<\(.*\)>$/From: \2 (\1)/ } s/-[Ii]d:/-ID:/ s/^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[ ]*$/Subject: (none)/ s/^\([^:]*:\)[ ]*/\1 / - /^\$/{i\\ -Newsgroups: alt.buddha.short.fat.guy\\ -Distribution: world\\ -Sender: news@cygnus.com\\ + /^$/{i\ +Newsgroups: alt.buddha.short.fat.guy\ +Distribution: world\ +Sender: news@cygnus.com\ Approved: alt.buddha.short.fat.guy@cygnus.com b e } @@ -60,4 +77,53 @@ Approved: alt.buddha.short.fat.guy@cygnus.com :e p n - b e" + b e +EOF + + +# The expected output +cat << \EOF > distrib-exp || framework_failure_ +Path: mailnewsgateway +From crash@cygnus.com Wed Mar 8 18: 02:42 1995 +From: crash@cygnus.com (Jason Molenda) +Message-ID: <9503090202.AA06931.alt.buddha.fat.short.guy@phydeaux.cygnus.com> +Subject: Note for sed testsuite +Original-To: molenda@msi.umn.edu +Date: Wed, 8 Mar 1995 18:02:24 -0800 (PST) +X-Mailer: ELM [version 2.4 PL23] +Newsgroups: alt.buddha.short.fat.guy +Distribution: world +Sender: news@cygnus.com +Approved: alt.buddha.short.fat.guy@cygnus.com + + _Summum Bonum_ + + All the breath and the bloom of the + year in the bag of one bee: + All the wonder and wealth of the mine in + the heart of one gem: + In the core of one pearl all the shade and the + shine of the sea: + Breath and bloom, shade and shine, -- wonder, + wealth, and -- how far above them -- + Truth, thats brighter than gem, + Trust, that's purer than pearl, -- + Brightest truth, purest trust in the universe -- + all were for me + In the kiss of one girl. + -- Robert Browning +EOF + +# NOTE: +# The input has lines wider than 80 characters, and is kept as a separate file. + +# location of external test files +dir="$abs_top_srcdir/testsuite" + + +sed -n -f distrib.sed < "$dir/distrib.inp" > distrib-out || fail=1 +remove_cr_inplace distrib-out +compare distrib-exp distrib-out || fail=1 + + +Exit $fail diff --git a/testsuite/local.mk b/testsuite/local.mk index b3d62ee..aa52df7 100644 --- a/testsuite/local.mk +++ b/testsuite/local.mk @@ -89,6 +89,7 @@ T += testsuite/8bit.sh \ testsuite/binary.sh \ testsuite/bsd-wrapper.sh \ testsuite/dc.sh \ + testsuite/distrib.sh \ testsuite/eval.sh \ testsuite/help.sh \ testsuite/inplace-hold.sh \ @@ -120,7 +121,7 @@ endif SEDTESTS += testsuite/newjis \ testsuite/noeolw \ testsuite/madding testsuite/mac-mf \ - testsuite/distrib testsuite/8to7 \ + testsuite/8to7 \ testsuite/badenc # Note that the first lines are statements. They ensure that environment @@ -196,10 +197,7 @@ EXTRA_DIST += \ testsuite/bsd.good \ testsuite/bsd.sh \ testsuite/dc.sed \ - testsuite/distrib.good \ testsuite/distrib.inp \ - testsuite/distrib.sed \ - testsuite/distrib.sh \ testsuite/mac-mf.good \ testsuite/mac-mf.inp \ testsuite/mac-mf.sed \