1 # Testsuite makefile for GNU sed 2 3 SHELL = /bin/sh 4 5 # These are only fallback values. They are usually overridden by runtest. 6 srcdir = . 7 SED = ../sed/sed 8 9 TIME= 10 #TIME=time 11 12 SEDENV_2 = LC_ALL=C 13 SEDENV = $(SEDENV_2) $(TIME) 14 TR = $(SEDENV_2) tr 15 16 CMP=cmp 17 RM=rm -f 18 19 SKIP = :>$@.skip; exit 77 20 21 enable sep inclib 8bit 8to7 newjis xabcx dollar noeol bkslashes \ 22 numsub head madding mac-mf empty xbxcx xbxcx3 recall recall2 xemacs \ 23 appquit fasts uniq manis linecnt khadafy allsub flipcase space modulo \ 24 y-bracket y-newline insert brackets:: 25 $(SEDENV) $(SED) -f $(srcdir)/$@.sed \ 26 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 27 $(CMP) $(srcdir)/$@.good $@.out 28 @$(RM) $@.out 29 30 0range:: 31 $(SEDENV) $(SED) -s -f $(srcdir)/$@.sed \ 32 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 33 $(CMP) $(srcdir)/$@.good $@.out 34 @$(RM) $@.out 35 36 badenc:: 37 LANG=ru_RU.UTF-8 $(TIME) $(SED) -nf $(srcdir)/$@.sed \ 38 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 39 $(CMP) $(srcdir)/$@.good $@.out 40 LANG=it_IT.UTF-8 $(TIME) $(SED) -nf $(srcdir)/$@.sed \ 41 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 42 $(CMP) $(srcdir)/$@.good $@.out 43 LANG=en_US.UTF-8 $(TIME) $(SED) -nf $(srcdir)/$@.sed \ 44 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 45 $(CMP) $(srcdir)/$@.good $@.out 46 LANG=en_GB.UTF-8 $(TIME) $(SED) -nf $(srcdir)/$@.sed \ 47 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 48 $(CMP) $(srcdir)/$@.good $@.out 49 @$(RM) $@.out 50 51 # Try with ru_RU.UTF-8. If it is presumably not installed, see if the current 52 # locale is UTF-8 and run it in the current locale. 53 utf8-1 utf8-2 utf8-3 utf8-4:: 54 echo "LANG=ru_RU.UTF-8" \ 55 "$(TIME) $(SED) -f $(srcdir)/$@.sed" \ 56 "< $(srcdir)/$@.inp | $(TR) -d \\r > $@.out"; \ 57 LANG=ru_RU.UTF-8 \ 58 $(TIME) $(SED) -f $(srcdir)/$@.sed \ 59 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out; \ 60 $(CMP) $(srcdir)/$@.good $@.out && exit 0; \ 61 $(CMP) $(srcdir)/$@.inp $@.out || exit 1; \ 62 locale > $@.info 2>/dev/null || { rm $@.info; $(SKIP); }; \ 63 . $@.info; rm $@.info; \ 64 case "$$LC_CTYPE" in \ 65 *UTF-8 | *UTF8 | *utf8 | *utf-8) \ 66 echo "$(TIME) $(SED) -f $(srcdir)/$@.sed" \ 67 " < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out"; \ 68 $(TIME) $(SED) -f $(srcdir)/$@.sed \ 69 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out; \ 70 $(CMP) $(srcdir)/$@.good $@.out && exit 0; \ 71 $(CMP) $(srcdir)/$@.inp $@.out || exit 1 ;; \ 72 *) ;; \ 73 esac; \ 74 $(SKIP) 75 76 # This checks for a bug in 3.02 and 3.02.80 77 stdin:: 78 ($(SEDENV) $(SED) d; $(SEDENV) $(SED) G) < $(srcdir)/numsub.inp \ 79 | $(TR) -d \\r > $@.1out 80 $(SEDENV) cat $(srcdir)/numsub.inp \ 81 | ($(SEDENV) $(SED) d; $(SEDENV) $(SED) G) | $(TR) -d \\r > $@.2out 82 $(CMP) $@.1out $@.2out 83 @$(RM) $@.1out $@.2out 84 85 inplace-hold:: 86 echo x > $@.1out 87 echo y > $@.2out 88 echo > $@.out 89 $(SEDENV) $(SED) -i x $@.1out $@.2out 90 $(CMP) $@.1out $@.out 91 $(CMP) $@.2out $@.out 92 @$(RM) $@.1out $@.2out $@.out 93 94 cv-vars classes middle dc distrib factor numsub2 numsub3 numsub4 numsub5 \ 95 insens:: 96 $(SEDENV) $(SED) -n -f $(srcdir)/$@.sed \ 97 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 98 $(CMP) $(srcdir)/$@.good $@.out 99 @$(RM) $@.out 100 101 noeolw:: 102 $(SEDENV) $(SED) -n -f $(srcdir)/$@.sed \ 103 $(srcdir)/noeol.inp $(srcdir)/noeol.inp | $(TR) -d \\r > $@.out 104 $(CMP) $(srcdir)/$@.good $@.out 105 $(TR) -d \\r < $@.1out | $(CMP) $(srcdir)/$@.1good - 106 $(TR) -d \\r < $@.2out | $(CMP) $(srcdir)/$@.2good - 107 @$(RM) $@.1out $@.2out $@.out 108 109 subwrite:: 110 $(SEDENV) $(SED) -f $(srcdir)/$@.sed \ 111 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.1out 112 $(CMP) $(srcdir)/subwrt1.good $@.1out 113 $(TR) -d \\r < $@.wout | $(CMP) $(srcdir)/subwrt2.good - 114 @$(RM) $@.1out $@.wout 115 116 bsd:: 117 $(SEDENV_2) sh $(srcdir)/$@.sh '$(TIME) $(SED)' $@.out 118 $(TR) -d \\r < $@.out | $(CMP) $(srcdir)/$@.good - 119 @$(RM) $@.out 120 121 writeout:: 122 $(SEDENV) $(SED) -f $(srcdir)/$@.sed \ 123 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.1out 124 $(CMP) $(srcdir)/wrtout1.good $@.1out 125 $(TR) -d \\r < $@.wout | $(CMP) $(srcdir)/wrtout2.good - 126 @$(RM) $@.1out $@.wout 127 128 readin:: 129 echo MOO | $(SEDENV) $(SED) b > $@.in2 130 $(SEDENV) $(SED) -f $(srcdir)/$@.sed \ 131 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 132 $(CMP) $(srcdir)/$@.good $@.out 133 @$(RM) $@.out $@.in2 134 135 eval.in2: $(srcdir)/eval.inp 136 cat $(srcdir)/eval.inp > $@ 137 138 eval:: eval.in2 139 $(SEDENV) $(SED) -f $(srcdir)/$@.sed \ 140 < $(srcdir)/$@.inp | $(TR) -d \\r > $@.out 141 $(CMP) $(srcdir)/$@.good $@.out 142 @$(RM) $@.out 143 144 binary binary2 binary3:: 145 $(SEDENV) $(SED) -n -f $(srcdir)/$@.sed \ 146 < $(srcdir)/binary.inp | $(TR) -d \\r > $@.out 147 $(CMP) $(srcdir)/binary.good $@.out 148 @$(RM) $@.out 149 150 # 151 # cmdlines targets 152 # 153 154 help:: 155 $(SEDENV) $(SED) --help | grep E-mail > /dev/null 2>&1 156 $(SEDENV) $(SED) --help | $(SEDENV) $(SED) '1s/ [^ ]* / sed /; /^E-mail/,$$d' > $@.1out 157 $(SEDENV) $(SED) 2>&1 | $(SEDENV) $(SED) '1s/ [^ ]* / sed /' > $@.2out || : 158 $(CMP) $@.1out $@.2out 159 @$(RM) $@.1out $@.2out 160 161 version:: 162 $(SEDENV) $(SED) --version 2>&1 | $(TR) -d \\r > $@.out 163 $(CMP) $@.good $@.out 164 @$(RM) $@.out 165 166 file:: 167 $(SEDENV) $(SED) --file=$(srcdir)/newjis.sed \ 168 < $(srcdir)/newjis.inp | $(TR) -d \\r > $@.out 169 $(CMP) $(srcdir)/newjis.good $@.out 170 @$(RM) $@.out 171 172 quiet:: 173 $(SEDENV) $(SED) --quiet -f $(srcdir)/cv-vars.sed \ 174 < $(srcdir)/cv-vars.inp | $(TR) -d \\r > $@.out 175 $(CMP) $(srcdir)/cv-vars.good $@.out 176 @$(RM) $@.out 177 178 # The following target is not used in super sed builds (only GNU sed) 179 180 bug-regex7$(EXEEXT) bug-regex8$(EXEEXT) bug-regex9$(EXEEXT) \ 181 bug-regex10$(EXEEXT) bug-regex11$(EXEEXT) bug-regex12$(EXEEXT) \ 182 bug-regex13$(EXEEXT) bug-regex14$(EXEEXT) bug-regex15$(EXEEXT) bug-regex16$(EXEEXT) \ 183 bug-regex21$(EXEEXT) runtests$(EXEEXT) runptests$(EXEEXT):: 184 echo "$(SEDENV) ./$@ > `echo $@ | $(SED) s/$(EXEEXT)$$/.log/`" 185 @$(SEDENV) ./$@ > `echo $@ | $(SED) s/$(EXEEXT)$$/.log/` 186 187 tst-pcre$(EXEEXT):: 188 $(SEDENV) ./tst-pcre $(srcdir)/PCRE.tests > tst-pcre.log 189 190 tst-boost$(EXEEXT):: 191 $(SEDENV) ./tst-boost $(srcdir)/BOOST.tests > tst-boost.log 192 193 tst-rxspencer$(EXEEXT):: 194 $(SEDENV) ./tst-rxspencer $(srcdir)/SPENCER.tests > tst-spencer.log 195 196 tst-regex2$(EXEEXT):: 197 $(SEDENV) ./tst-regex2 $(srcdir)/tst-regex2.c > tst-regex2.log 198 199 # The following target is not used in GNU sed builds (only super-sed) 200 201 pcretest$(EXEEXT):: 202 $(SEDENV) ./pcretest $(srcdir)/pcre1.inp pcre1.out 203 $(CMP) $(srcdir)/pcre1.good pcre1.out 204 #$(SEDENV) ./pcretest -p $(srcdir)/pcre1.inp pcre1p.out 205 #$(CMP) $(srcdir)/pcre1p.good pcre1p.out 206 $(SEDENV) ./pcretest -P $(srcdir)/pcre2.inp pcre2.out 207 $(CMP) $(srcdir)/pcre2.good pcre2.out 208 $(SEDENV) ./pcretest -P -p $(srcdir)/pcre2.inp pcre2p.out 209 $(CMP) $(srcdir)/pcre2p.good pcre2p.out 210 $(SEDENV) ./pcretest $(srcdir)/pcre3.inp pcre3.out 211 $(CMP) $(srcdir)/pcre3.good pcre3.out 212 $(SEDENV) ./pcretest -p $(srcdir)/pcre3.inp pcre3p.out 213 $(CMP) $(srcdir)/pcre3p.good pcre3p.out 214 @$(RM) pcre*.out 215 216 .PHONY: \ 217 bug-regex7$(EXEEXT) bug-regex8$(EXEEXT) bug-regex9$(EXEEXT) \ 218 bug-regex10$(EXEEXT) bug-regex11$(EXEEXT) bug-regex12$(EXEEXT) \ 219 bug-regex13$(EXEEXT) bug-regex14$(EXEEXT) bug-regex15$(EXEEXT) bug-regex16$(EXEEXT) \ 220 bug-regex21$(EXEEXT) runtests$(EXEEXT) runptests$(EXEEXT) tst-regex2$(EXEEXT) \ 221 tst-pcre$(EXEEXT) tst-boost$(EXEEXT) tst-rxspencer$(EXEEXT) pcretest$(EXEEXT) 222