Added Dmitry V. Levin's additional test cases for xargs, together with enhancements whioch ensure that xargs passes the extra tests

This commit is contained in:
James Youngman
2005-05-02 23:27:05 +00:00
parent 847fcc7b8e
commit 82d4c3a2ea
163 changed files with 610 additions and 51 deletions

View File

@@ -1,6 +1,6 @@
# -*- TCL -*-
# Test-specific TCL procedures required by DejaGNU.
# Copyright (C) 1994 Free Software Foundation, Inc.
# Copyright (C) 1994, 2005 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
@@ -17,7 +17,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
# Modified by David MacKenzie <djm@gnu.org> from the gcc files
# Modified by David MacKenzie <djm@gnu.ai.mit.edu> from the gcc files
# written by Rob Savoye <rob@cygnus.com>.
@@ -54,7 +54,7 @@ proc xargs_version {} {
# Run xargs and leave the output in $comp_output.
# Called by individual test scripts.
proc xargs_start { passfail options {infile ""}} {
proc xargs_start { passfail options {infile ""} {errh ""} } {
global verbose
global XARGS
global XARGSFLAGS
@@ -65,20 +65,34 @@ proc xargs_start { passfail options {infile ""}} {
exit 1
}
set fail_good [string match "f*" $passfail]
set scriptname [uplevel {info script}]
set testbase [file rootname $scriptname]
set testname [file tail $testbase]
if {[string match "\[0-9\]*" $passfail]} then {
set execrc "$passfail"
} elseif {[string match "p*" $passfail]} then {
set execrc "0"
} elseif {[string match "f*" $passfail]} then {
set execrc "1"
} else {
fail "$testname, failure in testing framework: passfail=$passfail"
return
}
set outfile "$testbase.xo"
set errfile "$testbase.xe"
if {$infile != ""} then {
set infile "[file dirname [file dirname $testbase]]/inputs/$infile"
} else {
set infile /dev/null
}
if {[string match "s*" $errh]} then {
set errfile ""
} else {
set errfile "$testbase.xe"
}
catch "exec rm -f xargs.out xargs.err"
set cmd "$XARGS $XARGSFLAGS $options < $infile > xargs.out 2> xargs.err"
@@ -87,25 +101,30 @@ proc xargs_start { passfail options {infile ""}} {
send_user "Spawning \"$cmd\"\n"
}
catch "exec $cmd" comp_output
if {$comp_output != ""} then {
# The command failed; if that was the desired effect, the
# test might still pass
send_log "$comp_output\n"
if $verbose>1 then {
send_user "$comp_output\n"
}
if $fail_good then {
# expected failure
pass "$testname"
set status 0
if {[catch "exec $cmd" comp_output]} then {
if {[lindex $::errorCode 0] == "CHILDSTATUS"} then {
set status [lindex $::errorCode 2]
} else {
# unexpected failure
fail "$testname, $comp_output"
fail "$testname, failure in testing framework, $comp_output"
return
}
}
catch "exec cat xargs.err" comp_error
if {$execrc != $status} then {
if {$status == 0} then {
fail "$testname, unexpected success"
} elseif {$execrc == 0} then {
fail "$testname, unexpected failure, $comp_output, $comp_error"
} else {
fail "$testname, expected exit code $execrc, but got exit code $status"
}
return
}
# ok, at least exit code match.
# The command succeeded, but that might not have been the expected result.
if [file exists $outfile] then {
set cmp_cmd "cmp xargs.out $outfile"
send_log "$cmp_cmd\n"
@@ -113,35 +132,34 @@ proc xargs_start { passfail options {infile ""}} {
if {$cmpout != ""} then {
# stdout is wrong.
catch "exec diff -u xargs.out $outfile" diffs
send_log "diffs: $diffs\n"
send_log "stdout diffs: $diffs\n"
fail "$testname, wrong stdout output: $cmpout"
return
}
} else {
if {[file size xargs.out] != 0} then {
fail "$testname, output on stdout should be empty"
return
}
} elseif {[file size xargs.out] != 0} then {
fail "$testname, output on stdout should be empty"
return
}
# If testname.xe exists, check the stderr result.
if [file exists $errfile] then {
set cmp_cmd "cmp xargs.err $errfile"
send_log "$cmp_cmd\n"
catch "exec $cmp_cmd" cmperr
if {$cmperr != ""} then {
# stderr is wrong.
catch "exec diff -u xargs.err $errfile" diffs
send_log "$diffs\n"
fail "$testname, wrong stderr output: $cmperr"
return
}
} else {
if {[file size xargs.err] != 0} then {
# if stderr check is enabled,
if {$errfile != ""} then {
if {[file exists $errfile]} then {
set cmp_cmd "cmp xargs.err $errfile"
send_log "$cmp_cmd\n"
catch "exec $cmp_cmd" cmperr
if {$cmperr != ""} then {
# stderr is wrong
catch "exec diff -ua xargs.err $errfile" diffs
send_log "stderr diffs: $diffs\n"
fail "$testname, wrong stderr output: $cmperr"
return
}
} elseif {[file size xargs.err] != 0} then {
fail "$testname, output on stderr should be empty"
return
}
}
pass "$testname"
}
@@ -150,5 +168,3 @@ proc xargs_start { passfail options {infile ""}} {
proc xargs_exit {} {
catch "exec rm -f xargs.out xargs.err"
}

View File

@@ -0,0 +1,5 @@
one
two
EOF
three
four

View File

@@ -0,0 +1,5 @@
one
two
bEOF
three
four

View File

@@ -0,0 +1,5 @@
one
two
EOFe
three
four

View File

@@ -0,0 +1,3 @@
sleep 2 && echo one
sleep 1 && echo two
echo three

Binary file not shown.

View File

@@ -0,0 +1,5 @@
one
two
_
three
four

View File

@@ -0,0 +1,3 @@
exit 255
echo 1
echo 2

View File

@@ -0,0 +1,3 @@
false
echo 1
echo 2

Binary file not shown.

View File

@@ -0,0 +1,8 @@
dumb
s s
f f
r

Binary file not shown.

View File

@@ -0,0 +1,9 @@
1 22 333 4444
55555 666666
7777777
88888888
999999999 1 22
333 4444 55555
666666 7777777
88888888
999999999

Binary file not shown.

View File

@@ -0,0 +1,10 @@
1 22 333 4444
55555 666666
7777777
88888888
999999999 1 22
333 4444 55555
666666 7777777
88888888

Binary file not shown.

View File

@@ -0,0 +1,2 @@
first
second

View File

@@ -0,0 +1,2 @@

Binary file not shown.

View File

@@ -0,0 +1,18 @@
1
22
333
4444
55555
666666
7777777
88888888
999999999
1
22
333
4444
55555
666666
7777777
88888888
999999999

Binary file not shown.

View File

@@ -0,0 +1,18 @@
999999999
88888888
7777777
666666
55555
4444
333
22
1
999999999
88888888
7777777
666666
55555
4444
333
22
1

View File

@@ -0,0 +1,3 @@
kill $$
echo 1
echo 2

View File

@@ -0,0 +1,3 @@
one
"two
three

View File

@@ -0,0 +1,2 @@
one
"two

View File

@@ -0,0 +1 @@
xargs_start p {-E_ -0} eof_-0.xi

View File

@@ -0,0 +1 @@
one two _ three four

View File

@@ -0,0 +1 @@
xargs_start p {-L2 -0} ldata-0.xi

View File

@@ -0,0 +1,5 @@
1 22 333 4444 55555 666666
7777777 88888888
999999999 1 22 333 4444 55555
666666 7777777 88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start p {-L2 -0} ldatab-0.xi

View File

@@ -0,0 +1,5 @@
1 22 333 4444
55555 666666 7777777
88888888 999999999 1 22
333 4444 55555 666666 7777777

View File

@@ -0,0 +1 @@
xargs_start p {-L3 -0} ldata-0.xi

View File

@@ -0,0 +1,3 @@
1 22 333 4444 55555 666666 7777777
88888888 999999999 1 22 333 4444 55555
666666 7777777 88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start p {-P3 -n1 -IARG sh -c ARG} Pdata.xi

View File

@@ -0,0 +1,3 @@
three
two
one

View File

@@ -0,0 +1 @@
xargs_start p {-r echo this plus that}

View File

@@ -0,0 +1 @@
xargs_start p {-r}

View File

@@ -0,0 +1 @@
xargs_start p {-i -0 echo from \{\} to x{}y} items-0.xi

View File

@@ -0,0 +1,20 @@
from one to xoney
from
to x
y
from dumb to xdumby
from s s to x s s y
from f f to x f f y
from
r
r
to x
r
r
y
from t t to x t t y
from v v to x v v y

View File

@@ -0,0 +1 @@
xargs_start f {-i -s26 -0 echo from \{\} to x{}y} items-0.xi skip

View File

@@ -0,0 +1 @@
from one to xoney

View File

@@ -0,0 +1 @@
xargs_start p {-l -0} ldata-0.xi

View File

@@ -0,0 +1,9 @@
1 22 333 4444
55555 666666
7777777
88888888
999999999 1 22
333 4444 55555
666666 7777777
88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start p {-l -0} ldatab-0.xi

View File

@@ -0,0 +1,10 @@
1 22 333 4444
55555 666666
7777777
88888888
999999999 1 22
333 4444 55555
666666 7777777
88888888

View File

@@ -0,0 +1 @@
xargs_start p {-n1 -0} stairs-0.xi

View File

@@ -0,0 +1,18 @@
1
22
333
4444
55555
666666
7777777
88888888
999999999
1
22
333
4444
55555
666666
7777777
88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start p {-n2 -0} stairs-0.xi

View File

@@ -0,0 +1,9 @@
1 22
333 4444
55555 666666
7777777 88888888
999999999 1
22 333
4444 55555
666666 7777777
88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start p {-n2 -s26 -0} stairs-0.xi

View File

@@ -0,0 +1,11 @@
1 22
333 4444
55555 666666
7777777
88888888
999999999 1
22 333
4444 55555
666666 7777777
88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start f {-n2 -s26 -x -0} stairs-0.xi skip

View File

@@ -0,0 +1,3 @@
1 22
333 4444
55555 666666

View File

@@ -0,0 +1 @@
xargs_start p {-n3 -0} stairs2-0.xi

View File

@@ -0,0 +1,6 @@
999999999 88888888 7777777
666666 55555 4444
333 22 1
999999999 88888888 7777777
666666 55555 4444
333 22 1

View File

@@ -0,0 +1 @@
xargs_start p {-n3 -s36 -0} stairs2-0.xi

View File

@@ -0,0 +1,7 @@
999999999 88888888
7777777 666666 55555
4444 333 22
1 999999999 88888888
7777777 666666 55555
4444 333 22
1

View File

@@ -0,0 +1 @@
xargs_start p {-0} noeof-0.xi

View File

@@ -0,0 +1 @@
first second

View File

@@ -0,0 +1 @@
xargs_start p {-0 -s118} stairs-0.xi

View File

@@ -0,0 +1 @@
1 22 333 4444 55555 666666 7777777 88888888 999999999 1 22 333 4444 55555 666666 7777777 88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start f {-0 -s19} stairs-0.xi skip

View File

@@ -0,0 +1,6 @@
1 22 333
4444
55555
666666
7777777
88888888

View File

@@ -0,0 +1 @@
xargs_start f {-0 -s19} stairs2-0.xi skip

View File

@@ -0,0 +1 @@
xargs_start p {-0 -s20} stairs-0.xi

View File

@@ -0,0 +1,14 @@
1 22 333
4444
55555
666666
7777777
88888888
999999999
1 22 333
4444
55555
666666
7777777
88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start p {-0 -s30} stairs-0.xi

View File

@@ -0,0 +1,6 @@
1 22 333 4444 55555
666666 7777777
88888888 999999999
1 22 333 4444 55555
666666 7777777
88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start p {-0 echo this plus that} space.xi

View File

@@ -0,0 +1,3 @@
this plus that

View File

@@ -0,0 +1 @@
xargs_start p {-r echo this plus that} space.xi

View File

@@ -0,0 +1 @@
xargs_start p {-t -0 echo this plus that} space.xi

View File

@@ -0,0 +1,3 @@
echo this plus that

View File

@@ -0,0 +1,3 @@
this plus that

View File

@@ -0,0 +1 @@
xargs_start p {-E EOF} EOF.xi

View File

@@ -0,0 +1 @@
one two

View File

@@ -0,0 +1 @@
xargs_start p {-E EOF} EOFb.xi

View File

@@ -0,0 +1 @@
one two bEOF three four

View File

@@ -0,0 +1 @@
xargs_start p {-E EOF} EOFe.xi

View File

@@ -0,0 +1 @@
one two EOFe three four

View File

@@ -0,0 +1 @@
xargs_start p {-E_ -IARG echo from ARG to xARGy} eof_.xi

View File

@@ -0,0 +1,2 @@
from one to xoney
from two to xtwoy

View File

@@ -0,0 +1 @@
xargs_start p {-E_} eof_.xi

View File

@@ -0,0 +1 @@
one two

View File

@@ -0,0 +1 @@
xargs_start p {-IARG echo from ARG to xARGy -E_} eof_.xi

View File

@@ -0,0 +1,5 @@
from one to xoney -E_
from two to xtwoy -E_
from _ to x_y -E_
from three to xthreey -E_
from four to xfoury -E_

View File

@@ -0,0 +1 @@
xargs_start p {-IARG -s15 echo ARG} stairs.xi

View File

@@ -0,0 +1,18 @@
1
22
333
4444
55555
666666
7777777
88888888
999999999
1
22
333
4444
55555
666666
7777777
88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start p {-IARG echo from ARG to xARGy} items.xi

View File

@@ -0,0 +1,6 @@
from dumb to xdumby
from s s to xs s y
from f f to xf f y
from r
r

View File

@@ -0,0 +1 @@
xargs_start p {-L2 -n2} ldata.xi

View File

@@ -0,0 +1,9 @@
1 22
333 4444
55555 666666
7777777 88888888
999999999 1
22 333
4444 55555
666666 7777777
88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start p {-L2} ldata.xi

View File

@@ -0,0 +1,5 @@
1 22 333 4444 55555 666666
7777777 88888888
999999999 1 22 333 4444 55555
666666 7777777 88888888
999999999

View File

@@ -0,0 +1 @@
xargs_start p {-L2} ldatab.xi

View File

@@ -0,0 +1,3 @@
1 22 333 4444 55555 666666 7777777 88888888 999999999 1 22
333 4444 55555 666666 7777777
88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start p {-L3} ldata.xi

View File

@@ -0,0 +1,3 @@
1 22 333 4444 55555 666666 7777777
88888888 999999999 1 22 333 4444 55555
666666 7777777 88888888 999999999

View File

@@ -0,0 +1 @@
xargs_start p {echo this plus that}

View File

@@ -0,0 +1 @@
this plus that

Some files were not shown because too many files have changed in this diff Show More