BEGIN { $| = 1;
print
"1..2\n"
; }
END {
print
"not ok 1\n"
unless
$loaded
;}
$loaded
= 1;
print
"ok 1\n"
;
$test
= 2;
sub
ok {
print
"ok $test\n"
;
++
$test
;
}
my
@input
=
qw(echo test send some text that we must catch)
;
my
$response
;
if
(
open
(FROMCHILD,
"-|"
)) {
undef
local
$/;
$response
= <FROMCHILD>;
close
FROMCHILD;
}
else
{
unless
(
open
STDERR,
'>&STDOUT'
) {
print
"can't dup STDERR to STDOUT: $!"
;
exit
;
}
exec
'./scripts/sc_sesswrap'
,
@input
or
die
"can't exec ./scripts/sc_sesswrap"
;
exit
0;
}
shift
@input
;
my
$expect
=
join
(
' '
,
@input
) .
"\n"
;
print
"sc_sesswrap wrapper failed\ngot: |$response|\nexp: |$expect|\nnot "
unless
$expect
eq
$response
;
&ok
;