Deleted Added
full compact
multi_test.sh (167552) multi_test.sh (167555)
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 167552 2007-03-14 13:05:45Z dds $
33# $FreeBSD: head/tools/regression/usr.bin/sed/multitest.t 167555 2007-03-14 13:38:23Z dds $
34#
35
36# sed Regression Tests
37#
38# The directory regress.test.out contains the expected test results
39#
40# These are the regression tests created during the development of the
41# BSD sed. The reference file naming scheme used in this script can't
42# handle gracefully the insertion of new tests between existing ones.
43# Therefore, either use the new m4-based regress.t framework, or add
44# tests after the last existing test.
45
46main()
47{
48 REGRESS=regress.multitest.out
49 DICT=/usr/share/dict/words
50
34#
35
36# sed Regression Tests
37#
38# The directory regress.test.out contains the expected test results
39#
40# These are the regression tests created during the development of the
41# BSD sed. The reference file naming scheme used in this script can't
42# handle gracefully the insertion of new tests between existing ones.
43# Therefore, either use the new m4-based regress.t framework, or add
44# tests after the last existing test.
45
46main()
47{
48 REGRESS=regress.multitest.out
49 DICT=/usr/share/dict/words
50
51 #test_error | more
52
53 awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1
54 awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2
55
51 awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1
52 awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2
53
56 echo "1..90"
54 echo "1..121"
57
58 exec 4>&1 5>&2
59 tests
60 exec 1>&4 2>&5
61
62 # Remove temporary files
63 rm -f current.out lines[1-4] script[1-2]
64}

--- 6 unchanged lines hidden (view full) ---

71 test_args
72 test_addr
73 test_group
74 test_acid
75 test_branch
76 test_pattern
77 test_print
78 test_subst
55
56 exec 4>&1 5>&2
57 tests
58 exec 1>&4 2>&5
59
60 # Remove temporary files
61 rm -f current.out lines[1-4] script[1-2]
62}

--- 6 unchanged lines hidden (view full) ---

69 test_args
70 test_addr
71 test_group
72 test_acid
73 test_branch
74 test_pattern
75 test_print
76 test_subst
77 test_error
79 # Handle the result of the last test
80 result
81}
82
83# Display a test's result
84result()
85{
86 if [ "$TODO" = '1' ] ; then
87 TODO='TODO '
88 else
89 TODO=''
90 fi
78 # Handle the result of the last test
79 result
80}
81
82# Display a test's result
83result()
84{
85 if [ "$TODO" = '1' ] ; then
86 TODO='TODO '
87 else
88 TODO=''
89 fi
90 if ! [ -r $REGRESS/${MARK}_${TESTNAME} ] ; then
91 echo "Seeding $REGRESS/${MARK}_${TESTNAME} with current result" 1>&2
92 cp current.out $REGRESS/${MARK}_${TESTNAME}
93 fi
91 if diff -c $REGRESS/${MARK}_${TESTNAME} current.out ; then
92 echo "ok $MARK $TESTNAME # $TODO$COMMENT"
93 else
94 echo "not ok $MARK $TESTNAME # $TODO$COMMENT"
95 fi 1>&4 2>&5
96}
97
98# Mark the beginning of each test

--- 328 unchanged lines hidden (view full) ---

427 '
428 # POSIX does not say that this should work,
429 # but it does for GNU, BSD, and SunOS
430 mark '8.17' ; $SED -e 's/[/]/Q/' lines1
431}
432
433test_error()
434{
94 if diff -c $REGRESS/${MARK}_${TESTNAME} current.out ; then
95 echo "ok $MARK $TESTNAME # $TODO$COMMENT"
96 else
97 echo "not ok $MARK $TESTNAME # $TODO$COMMENT"
98 fi 1>&4 2>&5
99}
100
101# Mark the beginning of each test

--- 328 unchanged lines hidden (view full) ---

430 '
431 # POSIX does not say that this should work,
432 # but it does for GNU, BSD, and SunOS
433 mark '8.17' ; $SED -e 's/[/]/Q/' lines1
434}
435
436test_error()
437{
435 exec 0>&3 4>&1 5>&2
436 exec 0</dev/null
437 exec 2>&1
438 set -x
439 $TEST -x && exit 1
440 $TEST -f && exit 1
441 $TEST -e && exit 1
442 $TEST -f /dev/dds && exit 1
443 $TEST p /dev/dds && exit 1
444 $TEST -f /bin/sh && exit 1
445 $TEST '{' && exit 1
446 $TEST '{' && exit 1
447 $TEST '/hello/' && exit 1
448 $TEST '1,/hello/' && exit 1
449 $TEST -e '-5p' && exit 1
450 $TEST '/jj' && exit 1
451 $TEST 'a hello' && exit 1
452 $TEST 'a \ hello' && exit 1
453 $TEST 'b foo' && exit 1
454 $TEST 'd hello' && exit 1
455 $TEST 's/aa' && exit 1
456 $TEST 's/aa/' && exit 1
457 $TEST 's/a/b' && exit 1
458 $TEST 's/a/b/c/d' && exit 1
459 $TEST 's/a/b/ 1 2' && exit 1
460 $TEST 's/a/b/ 1 g' && exit 1
461 $TEST 's/a/b/w' && exit 1
462 $TEST 'y/aa' && exit 1
463 $TEST 'y/aa/b/' && exit 1
464 $TEST 'y/aa/' && exit 1
465 $TEST 'y/a/b' && exit 1
466 $TEST 'y/a/b/c/d' && exit 1
467 $TEST '!' && exit 1
468 $TEST supercalifrangolisticexprialidociussupercalifrangolisticexcius
469 set +x
470 exec 0>&3 1>&4 2>&5
438 COMMENT='Error cases'
439 mark '9.1' ; $SED -x 2>/dev/null ; echo $?
440 mark '9.2' ; $SED -f 2>/dev/null ; echo $?
441 mark '9.3' ; $SED -e 2>/dev/null ; echo $?
442 mark '9.4' ; $SED -f /dev/xyzzyxyzy 2>/dev/null ; echo $?
443 mark '9.5' ; $SED p /dev/xyzzyxyzy 2>/dev/null ; echo $?
444 mark '9.6' ; $SED -f /bin/sh 2>/dev/null ; echo $?
445 mark '9.7' ; $SED '{' 2>/dev/null ; echo $?
446 mark '9.8' ; $SED '{' 2>/dev/null ; echo $?
447 mark '9.9' ; $SED '/hello/' 2>/dev/null ; echo $?
448 mark '9.10' ; $SED '1,/hello/' 2>/dev/null ; echo $?
449 mark '9.11' ; $SED -e '-5p' 2>/dev/null ; echo $?
450 mark '9.12' ; $SED '/jj' 2>/dev/null ; echo $?
451 mark '9.13' ; $SED 'a hello' 2>/dev/null ; echo $?
452 mark '9.14' ; $SED 'a \ hello' 2>/dev/null ; echo $?
453 mark '9.15' ; $SED 'b foo' 2>/dev/null ; echo $?
454 mark '9.16' ; $SED 'd hello' 2>/dev/null ; echo $?
455 mark '9.17' ; $SED 's/aa' 2>/dev/null ; echo $?
456 mark '9.18' ; $SED 's/aa/' 2>/dev/null ; echo $?
457 mark '9.19' ; $SED 's/a/b' 2>/dev/null ; echo $?
458 mark '9.20' ; $SED 's/a/b/c/d' 2>/dev/null ; echo $?
459 mark '9.21' ; $SED 's/a/b/ 1 2' 2>/dev/null ; echo $?
460 mark '9.22' ; $SED 's/a/b/ 1 g' 2>/dev/null ; echo $?
461 mark '9.23' ; $SED 's/a/b/w' 2>/dev/null ; echo $?
462 mark '9.24' ; $SED 'y/aa' 2>/dev/null ; echo $?
463 mark '9.25' ; $SED 'y/aa/b/' 2>/dev/null ; echo $?
464 mark '9.26' ; $SED 'y/aa/' 2>/dev/null ; echo $?
465 mark '9.27' ; $SED 'y/a/b' 2>/dev/null ; echo $?
466 mark '9.28' ; $SED 'y/a/b/c/d' 2>/dev/null ; echo $?
467 mark '9.29' ; $SED '!' 2>/dev/null ; echo $?
468 mark '9.30' ; $SED supercalifrangolisticexprialidociussupercalifrangolisticexcius 2>/dev/null ; echo $?
469 mark '9.31' ; $SED '' /dev/null 2>/dev/null ; echo $?
471}
472
473main
470}
471
472main