source: trunk/src/sed/testsuite/distrib.sh@ 3670

Last change on this file since 3670 was 3613, checked in by bird, 10 months ago

src/sed: Merged in changes between 4.1.5 and 4.9 from the vendor branch. (svn merge /vendor/sed/4.1.5 /vendor/sed/current .)

File size: 3.7 KB
Line 
1#!/bin/sh
2
3# Test runner for the old 'distrib' test
4
5# Copyright (C) 2017-2022 Free Software Foundation, Inc.
6
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <https://www.gnu.org/licenses/>.
19. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
20print_ver_ sed
21
22# This is straight out of C News
23#
24#
25# All this does is massage the headers so they look like what news
26# software expects. To:, Cc: and Resent-*: headers are masked.
27# Reply-To: is turned into references, which is questionable (could
28# just as well be dropped.
29#
30# The From: line is rewritten to use the "address (comments)" form
31# instead of "phrase <route>" form our mailer uses. Also, addresses
32# with no "@domainname" are assumed to originate locally, and so are
33# given a domain.
34#
35# The Sender: field below reflects the address of the person who
36# maintains our mailing lists. The Approved: field is in a special
37# form, so that we can do bidirectional gatewaying. Any message
38# in a newsgroup that bears this stamp will not be fed into the
39# matching mailing list.
40cat << \EOF > distrib.sed || framework_failure_
411i\
42Path: mailnewsgateway
43 :a
44 /^[Rr]eceived:/b r
45 /^[Nn]ewsgroups:/b r
46 /^[Pp]ath:/b r
47 /^[Tt][Oo]:/s/^/Original-/
48 /^[Cc][Cc]:/s/^/Original-/
49 /^[Rr][Ee][Ss][Ee][Nn][Tt]-.*/s/^/Original-/
50 /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:/s/@/.alt.buddha.fat.short.guy@/
51 s/^[Ii]n-[Rr]eply-[Tt]o:/References:/
52 /^From:/{
53 s/<\([^@]*\)>$/<\1@$thissite>/
54 s/^From:[ ][ ]*\(.*\) *<\(.*\)>$/From: \2 (\1)/
55 }
56 s/-[Ii]d:/-ID:/
57 s/^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[ ]*$/Subject: (none)/
58 s/^\([^:]*:\)[ ]*/\1 /
59 /^$/{i\
60Newsgroups: alt.buddha.short.fat.guy\
61Distribution: world\
62Sender: news@cygnus.com\
63Approved: alt.buddha.short.fat.guy@cygnus.com
64 b e
65 }
66 p
67 n
68 b a
69 :r
70 s/.*//g
71 n
72 /^[ ]/b r
73 b a
74 :e
75 p
76 n
77 b e
78EOF
79
80
81# The expected output
82cat << \EOF > distrib-exp || framework_failure_
83Path: mailnewsgateway
84From crash@cygnus.com Wed Mar 8 18: 02:42 1995
85From: crash@cygnus.com (Jason Molenda)
86Message-ID: <9503090202.AA06931.alt.buddha.fat.short.guy@phydeaux.cygnus.com>
87Subject: Note for sed testsuite
88Original-To: molenda@msi.umn.edu
89Date: Wed, 8 Mar 1995 18:02:24 -0800 (PST)
90X-Mailer: ELM [version 2.4 PL23]
91Newsgroups: alt.buddha.short.fat.guy
92Distribution: world
93Sender: news@cygnus.com
94Approved: alt.buddha.short.fat.guy@cygnus.com
95
96 _Summum Bonum_
97
98 All the breath and the bloom of the
99 year in the bag of one bee:
100 All the wonder and wealth of the mine in
101 the heart of one gem:
102 In the core of one pearl all the shade and the
103 shine of the sea:
104 Breath and bloom, shade and shine, -- wonder,
105 wealth, and -- how far above them --
106 Truth, thats brighter than gem,
107 Trust, that's purer than pearl, --
108 Brightest truth, purest trust in the universe --
109 all were for me
110 In the kiss of one girl.
111 -- Robert Browning
112EOF
113
114# NOTE:
115# The input has lines wider than 80 characters, and is kept as a separate file.
116
117# location of external test files
118dir="$abs_top_srcdir/testsuite"
119
120
121sed -n -f distrib.sed < "$dir/distrib.inp" > distrib-out || fail=1
122remove_cr_inplace distrib-out
123compare distrib-exp distrib-out || fail=1
124
125
126Exit $fail
Note: See TracBrowser for help on using the repository browser.