-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eserte
committed
Sep 1, 2006
1 parent
dec339c
commit b15fc45
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/perl -w | ||
# -*- perl -*- | ||
|
||
# | ||
# $Id: script.t,v 1.1 2006/09/01 20:04:23 eserte Exp $ | ||
# Author: Slaven Rezic | ||
# | ||
|
||
use strict; | ||
use File::Spec; | ||
use FindBin; | ||
|
||
BEGIN { | ||
if (!eval q{ | ||
use Test::More; | ||
use POSIX ":sys_wait_h"; | ||
1; | ||
}) { | ||
print "1..0 # skip: no Test::More module\n"; | ||
exit; | ||
} | ||
if ($ENV{BATCH} || $^O eq 'MSWin32') { | ||
print "1..0 # skip: not on Windows or in BATCH mode\n"; | ||
exit; | ||
} | ||
} | ||
|
||
my $DEBUG = 0; | ||
my $script = 'blib/script/tkxmlview'; | ||
|
||
use Getopt::Long; | ||
GetOptions("d" => \$DEBUG) | ||
or die "usage: $0 [-d]"; | ||
|
||
my @opt = ([], | ||
['-indent', 8], | ||
['-mainbg', 'blue'], | ||
['-loaddtd'], | ||
['-showxpath'], | ||
); | ||
|
||
plan tests => scalar @opt; | ||
|
||
OPT: | ||
for my $opt (@opt) { | ||
push @$opt, "$FindBin::RealBin/test.xml"; | ||
my $pid = fork; | ||
if ($pid == 0) { | ||
my @cmd = ($^X, "-Mblib", $script, @$opt); | ||
warn "@cmd\n" if $DEBUG; | ||
open(STDERR, ">" . File::Spec->devnull); | ||
exec @cmd; | ||
die $!; | ||
} | ||
if ($DEBUG) { | ||
sleep 2; | ||
} | ||
for (1..10) { | ||
select(undef,undef,undef,0.1); | ||
my $kid = waitpid($pid, WNOHANG); | ||
if ($kid) { | ||
is($?, 0, "Trying tkxmlview with @$opt"); | ||
next OPT; | ||
} | ||
} | ||
kill TERM => $pid; | ||
for (1..10) { | ||
select(undef,undef,undef,0.1); | ||
if (!kill 0 => $pid) { | ||
pass("Trying tkxmlview with @$opt"); | ||
next OPT; | ||
} | ||
} | ||
kill KILL => $pid; | ||
pass("Trying tkxmlview with @$opt"); | ||
} | ||
|
||
__END__ |