multi_test.sh (133385) | multi_test.sh (167544) |
---|---|
1#!/bin/sh - 2# 3# Copyright (c) 1992 Diomidis Spinellis. 4# Copyright (c) 1992, 1993 5# The Regents of the University of California. All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 25# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29# SUCH DAMAGE. 30# 31# @(#)sed.test 8.1 (Berkeley) 6/6/93 32# | 1#!/bin/sh - 2# 3# Copyright (c) 1992 Diomidis Spinellis. 4# Copyright (c) 1992, 1993 5# The Regents of the University of California. All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 25# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29# SUCH DAMAGE. 30# 31# @(#)sed.test 8.1 (Berkeley) 6/6/93 32# |
33# $FreeBSD: head/tools/regression/usr.bin/sed/multitest.t 133385 2004-08-09 15:29:41Z dds $ | 33# $FreeBSD: head/tools/regression/usr.bin/sed/multitest.t 167544 2007-03-14 09:05:41Z dds $ |
34# 35 36# sed Regression Tests 37# 38# The following files are created: 39# lines[1-4], script1, script2 40# Two directories *.out contain the test results 41 42main() 43{ | 34# 35 36# sed Regression Tests 37# 38# The following files are created: 39# lines[1-4], script1, script2 40# Two directories *.out contain the test results 41 42main() 43{ |
44 BASE=/usr/bin/sed | 44 #BASE=/usr/bin/sed 45 BASE=/usr/ports/textproc/gsed/work/sed-4.1.5/sed/sed |
45 BASELOG=sed.out | 46 BASELOG=sed.out |
46 TEST=`cd ..; make whereobj`/sed | 47 #TEST=`cd ..; make whereobj`/sed 48 TEST=/home/dds/src/fbsd-head/sed/sed |
47 TESTLOG=nsed.out 48 DICT=/usr/share/dict/words 49 50 test_error | more 51 52 awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1 53 awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2 54 55 exec 4>&1 5>&2 56 57 # Set these flags to get messages about known problems | 49 TESTLOG=nsed.out 50 DICT=/usr/share/dict/words 51 52 test_error | more 53 54 awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1 55 awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2 56 57 exec 4>&1 5>&2 58 59 # Set these flags to get messages about known problems |
58 BSD=1 59 GNU=0 | 60 BSD=0 61 GNU=1 |
60 SUN=0 61 tests $BASE $BASELOG 62 | 62 SUN=0 63 tests $BASE $BASELOG 64 |
63 BSD=0 | 65 BSD=1 |
64 GNU=0 65 SUN=0 66 tests $TEST $TESTLOG 67 exec 1>&4 2>&5 68 diff -c $BASELOG $TESTLOG | more 69} 70 71tests() --- 92 unchanged lines hidden (view full) --- 164 fi 165 mark '1.14' 166 if [ $SUN -eq 1 ] ; then 167 echo SunOS sed prints only with -n 168 else 169 $SED -f script1 -f script2 lines1 170 fi 171 mark '1.15' | 66 GNU=0 67 SUN=0 68 tests $TEST $TESTLOG 69 exec 1>&4 2>&5 70 diff -c $BASELOG $TESTLOG | more 71} 72 73tests() --- 92 unchanged lines hidden (view full) --- 166 fi 167 mark '1.14' 168 if [ $SUN -eq 1 ] ; then 169 echo SunOS sed prints only with -n 170 else 171 $SED -f script1 -f script2 lines1 172 fi 173 mark '1.15' |
172 if [ $GNU -eq 1 -o $SUN -eq 1 ] ; then 173 echo GNU and SunOS sed fail this following older POSIX draft | 174 if [ $SUN -eq 1 ] ; then 175 echo SunOS sed fails this following older POSIX draft |
174 else 175 $SED -e 's/^/e1_/p' -f script1 lines1 176 fi 177 mark '1.16' 178 if [ $SUN -eq 1 ] ; then 179 echo SunOS sed prints only with -n 180 else 181 $SED -e 's/^/e1_/p' lines1 lines1 --- 19 unchanged lines hidden (view full) --- 201 mark '2.5' ; $SED -n -e '$a\ 202hello' /dev/null 203 mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2 204 # Should not print anything 205 mark '2.7' ; $SED -n -e '20p' lines1 206 mark '2.8' ; $SED -n -e '0p' lines1 207 mark '2.9' ; $SED -n '/l1_7/p' lines1 208 mark '2.10' ; $SED -n ' /l1_7/ p' lines1 | 176 else 177 $SED -e 's/^/e1_/p' -f script1 lines1 178 fi 179 mark '1.16' 180 if [ $SUN -eq 1 ] ; then 181 echo SunOS sed prints only with -n 182 else 183 $SED -e 's/^/e1_/p' lines1 lines1 --- 19 unchanged lines hidden (view full) --- 203 mark '2.5' ; $SED -n -e '$a\ 204hello' /dev/null 205 mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2 206 # Should not print anything 207 mark '2.7' ; $SED -n -e '20p' lines1 208 mark '2.8' ; $SED -n -e '0p' lines1 209 mark '2.9' ; $SED -n '/l1_7/p' lines1 210 mark '2.10' ; $SED -n ' /l1_7/ p' lines1 |
209 mark '2.11' 210 if [ $BSD -eq 1 ] ; then 211 echo BSD sed fails this test 212 fi 213 if [ $GNU -eq 1 ] ; then 214 echo GNU sed fails this 215 fi 216 $SED -n '\_l1\_7_p' lines1 | 211 mark '2.11' ; $SED -n '\_l1\_7_p' lines1 |
217 mark '2.12' ; $SED -n '1,4p' lines1 218 mark '2.13' ; $SED -n '1,$p' lines1 lines2 219 mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2 220 mark '2.15' ; $SED -n '/4/,$p' lines1 lines2 221 mark '2.16' ; $SED -n '/4/,20p' lines1 lines2 222 mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2 223 mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2 | 212 mark '2.12' ; $SED -n '1,4p' lines1 213 mark '2.13' ; $SED -n '1,$p' lines1 lines2 214 mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2 215 mark '2.15' ; $SED -n '/4/,$p' lines1 lines2 216 mark '2.16' ; $SED -n '/4/,20p' lines1 lines2 217 mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2 218 mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2 |
224 mark '2.19' 225 if [ $GNU -eq 1 ] ; then 226 echo GNU sed fails this 227 fi 228 $SED -n '12,3p' lines1 lines2 229 mark '2.20' 230 if [ $GNU -eq 1 ] ; then 231 echo GNU sed fails this 232 fi 233 $SED -n '/l1_7/,3p' lines1 lines2 | 219 mark '2.19' ; $SED -n '12,3p' lines1 lines2 220 mark '2.20' ; $SED -n '/l1_7/,3p' lines1 lines2 |
234} 235 236test_group() 237{ 238 echo Brace and other grouping 239 mark '3.1' ; $SED -e ' 2404,12 { 241 s/^/^/ --- 31 unchanged lines hidden (view full) --- 273 mark '4.2' ; $SED -n -e ' 2745,12s/^/5-12/ 275s/^/before_a/p 276/5-12/a\ 277appended 278s/^/after_a/p 279' lines1 lines2 280 mark '4.3' | 221} 222 223test_group() 224{ 225 echo Brace and other grouping 226 mark '3.1' ; $SED -e ' 2274,12 { 228 s/^/^/ --- 31 unchanged lines hidden (view full) --- 260 mark '4.2' ; $SED -n -e ' 2615,12s/^/5-12/ 262s/^/before_a/p 263/5-12/a\ 264appended 265s/^/after_a/p 266' lines1 lines2 267 mark '4.3' |
281 if [ $GNU -eq 1 ] ; then 282 echo GNU sed fails this 283 fi | |
284 $SED -n -e ' 285s/^/^/p 286/l1_/a\ 287appended 2888,10N 289s/$/$/p 290' lines1 lines2 291 mark '4.4' ; $SED -n -e ' --- 31 unchanged lines hidden (view full) --- 323s/^/label1_/p 324b 325:label2 326s/^/label2_/p 327b label3 328:end 329' lines1 330 mark '5.2' | 268 $SED -n -e ' 269s/^/^/p 270/l1_/a\ 271appended 2728,10N 273s/$/$/p 274' lines1 lines2 275 mark '4.4' ; $SED -n -e ' --- 31 unchanged lines hidden (view full) --- 307s/^/label1_/p 308b 309:label2 310s/^/label2_/p 311b label3 312:end 313' lines1 314 mark '5.2' |
331 if [ $BSD -eq 1 ] ; then 332 echo BSD sed fails this test 333 fi | |
334 $SED -n -e ' 335s/l1_/l2_/ 336t ok 337b 338:ok 339s/^/tested /p 340' lines1 lines2 341# SunOS sed behaves differently here. Clarification needed. --- 13 unchanged lines hidden (view full) --- 355t l2 356s/$/$/p 357b 358:l2 359s/^/ERROR/ 360' lines1 361# Check that reading a line clears the substitution done flag 362 mark '5.5' | 315 $SED -n -e ' 316s/l1_/l2_/ 317t ok 318b 319:ok 320s/^/tested /p 321' lines1 lines2 322# SunOS sed behaves differently here. Clarification needed. --- 13 unchanged lines hidden (view full) --- 336t l2 337s/$/$/p 338b 339:l2 340s/^/ERROR/ 341' lines1 342# Check that reading a line clears the substitution done flag 343 mark '5.5' |
363 if [ $BSD -eq 1 ] ; then 364 echo BSD sed fails this test 365 fi | |
366 $SED -n -e ' 367t l2 3681,8s/^/^/p 3692,7N 370b 371:l2 372s/^/ERROR/p 373' lines1 --- 59 unchanged lines hidden (view full) --- 433 rm -f lines4 434 mark '7.3' ; $SED -e '3,12w lines4' lines1 435 echo w results 436 cat lines4 437 mark '7.4' ; $SED -e '4r lines2' lines1 438 mark '7.5' ; $SED -e '5r /dev/dds' lines1 439 mark '7.6' ; $SED -e '6r /dev/null' lines1 440 mark '7.7' | 344 $SED -n -e ' 345t l2 3461,8s/^/^/p 3472,7N 348b 349:l2 350s/^/ERROR/p 351' lines1 --- 59 unchanged lines hidden (view full) --- 411 rm -f lines4 412 mark '7.3' ; $SED -e '3,12w lines4' lines1 413 echo w results 414 cat lines4 415 mark '7.4' ; $SED -e '4r lines2' lines1 416 mark '7.5' ; $SED -e '5r /dev/dds' lines1 417 mark '7.6' ; $SED -e '6r /dev/null' lines1 418 mark '7.7' |
441 if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then 442 echo BSD, GNU and SunOS cannot pass this one 443 else 444 sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1 445 rm -rf tmpdir 446 mkdir tmpdir 447 $SED -f script1 lines1 448 cat tmpdir/* 449 rm -rf tmpdir 450 fi | 419 sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1 420 rm -rf tmpdir 421 mkdir tmpdir 422 $SED -f script1 lines1 423 cat tmpdir/* 424 rm -rf tmpdir |
451 mark '7.8' 452 if [ $BSD -eq 1 ] ; then | 425 mark '7.8' 426 if [ $BSD -eq 1 ] ; then |
453 echo BSD sed cannot pass 7.7 | 427 echo BSD sed cannot pass 7.8 |
454 else 455 echo line1 > lines3 456 echo "" >> lines3 457 $SED -n -e '$p' lines3 /dev/null 458 fi 459 460} 461 --- 95 unchanged lines hidden --- | 428 else 429 echo line1 > lines3 430 echo "" >> lines3 431 $SED -n -e '$p' lines3 /dev/null 432 fi 433 434} 435 --- 95 unchanged lines hidden --- |