[Bug 418304] Backing out the patch as it depends on Getopt::Long feature that is not widely available.

This commit is contained in:
igor@mir2.org 2008-04-21 10:28:36 -07:00
Родитель ee81ec416a
Коммит e5c8696e93
1 изменённых файлов: 124 добавлений и 38 удалений

Просмотреть файл

@ -43,6 +43,7 @@
# Branched 11/01/99 # Branched 11/01/99
use strict; use strict;
use Getopt::Mixed "nextOption";
use File::Temp qw/ tempfile tempdir /; use File::Temp qw/ tempfile tempdir /;
use POSIX qw(sys_wait_h); use POSIX qw(sys_wait_h);
@ -78,6 +79,14 @@ my $opt_narcissus_path = "";
my $opt_no_quit = 0; my $opt_no_quit = 0;
my $opt_report_summarized_results = 0; my $opt_report_summarized_results = 0;
# command line option definition
my $options = "b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " .
"h help>h i j=s javapath>j k confail>k K linefail>K R report>R l=s list>l " .
"L=s neglist>L o=s opt>o p=s testpath>p s=s shellpath>s t trace>t " .
"T=s timeout>T u=s lxrurl>u " .
"x noexitmunge>x n:s narcissus>n " .
"Q noquitinthandler>Q";
if ($os_type eq "MAC") { if ($os_type eq "MAC") {
$opt_suite_path = `directory`; $opt_suite_path = `directory`;
$opt_suite_path =~ s/[\n\r]//g; $opt_suite_path =~ s/[\n\r]//g;
@ -494,31 +503,75 @@ sub write_results {
} }
sub parse_args { sub parse_args {
my ($option, $value, $lastopt);
&dd ("checking command line options."); &dd ("checking command line options.");
use Getopt::Long; Getopt::Mixed::init ($options);
Getopt::Long::Configure(qw(no_getopt_compat no_ignore_case)); $Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER;
Getopt::Long::GetOptions (
"bugurl|b=s" => \$opt_bug_url, while (($option, $value) = nextOption()) {
"classpath|c=s" => \$opt_classpath,
"engine|e=s{1,}" => \@opt_engine_list, if ($option eq "b") {
"file|f=s" => sub { &dd ("opt: setting bugurl to '$value'.");
$opt_bug_url = $value;
} elsif ($option eq "c") {
&dd ("opt: setting classpath to '$value'.");
$opt_classpath = $value;
} elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) {
&dd ("opt: adding engine $value.");
push (@opt_engine_list, $value);
} elsif ($option eq "f") {
if (!$value) {
die ("Output file cannot be null.\n");
}
&dd ("opt: setting output file to '$value'.");
$opt_user_output_file = 1; $opt_user_output_file = 1;
$opt_output_file = $_[1]; $opt_output_file = $value;
},
"help|h" => \&usage, } elsif ($option eq "h") {
"javapath|j=s" => sub { &usage;
$opt_java_path = $_[1];
$opt_java_path .= "/" if (!($_[1] =~ /[\/\\]$/)); } elsif ($option eq "j") {
}, if (!($value =~ /[\/\\]$/)) {
"confail|k" => \$opt_console_failures, $value .= "/";
"linefail|K" => \$opt_console_failures_line, }
"report|R!" => \$opt_report_summarized_results, &dd ("opt: setting java path to '$value'.");
"list|l=s{1,}" => \@opt_test_list_files, $opt_java_path = $value;
"neglist|L=s{1,}" => \@opt_neg_list_files,
"opt|o=s" => \$opt_engine_params, } elsif ($option eq "k") {
"testpath|p=s" => sub { &dd ("opt: displaying failures on console.");
$opt_suite_path = $_[1]; $opt_console_failures=1;
} elsif ($option eq "K") {
&dd ("opt: displaying failures on console as single line.");
$opt_console_failures=1;
$opt_console_failures_line=1;
} elsif ($option eq "R") {
&dd ("opt: Report summarized test results.");
$opt_report_summarized_results=1;
} elsif ($option eq "l" || (($option eq "") && ($lastopt eq "l"))) {
$option = "l";
&dd ("opt: adding test list '$value'.");
push (@opt_test_list_files, $value);
} elsif ($option eq "L" || (($option eq "") && ($lastopt eq "L"))) {
$option = "L";
&dd ("opt: adding negative list '$value'.");
push (@opt_neg_list_files, $value);
} elsif ($option eq "o") {
$opt_engine_params = $value;
&dd ("opt: setting engine params to '$opt_engine_params'.");
} elsif ($option eq "p") {
$opt_suite_path = $value;
if ($os_type eq "MAC") { if ($os_type eq "MAC") {
if (!($opt_suite_path =~ /\:$/)) { if (!($opt_suite_path =~ /\:$/)) {
$opt_suite_path .= ":"; $opt_suite_path .= ":";
@ -528,23 +581,56 @@ sub parse_args {
$opt_suite_path .= "/"; $opt_suite_path .= "/";
} }
} }
},
"shellpath|s=s" => \$opt_shell_path, &dd ("opt: setting suite path to '$opt_suite_path'.");
"trace|t" => \$opt_trace,
"lxrurl|u=s" => \$opt_lxr_url, } elsif ($option eq "s") {
"timeout|T=s" => \$opt_timeout, $opt_shell_path = $value;
"noexitmunge|x" => sub { $opt_exit_munge = 0; }, &dd ("opt: setting shell path to '$opt_shell_path'.");
"narcissus|n:s" => sub {
} elsif ($option eq "t") {
&dd ("opt: tracing output. (console failures at no extra charge.)");
$opt_console_failures = 1;
$opt_trace = 1;
} elsif ($option eq "u") {
&dd ("opt: setting lxr url to '$value'.");
$opt_lxr_url = $value;
} elsif ($option eq "x") {
&dd ("opt: turning off exit munging.");
$opt_exit_munge = 0;
} elsif ($option eq "T") {
$opt_timeout = $value;
&dd ("opt: setting timeout to $opt_timeout.");
} elsif ($option eq "n") {
&dd ("opt: enabling narcissus.");
$opt_enable_narcissus = 1; $opt_enable_narcissus = 1;
$opt_narcissus_path = $_[1] if ($_[1] ne ""); if ($value) {
}, $opt_narcissus_path = $value;
"noquitinthandler|Q" => $opt_no_quit); }
$opt_console_failures = 1 if ($opt_console_failures_line != 0 || } elsif ($option eq "Q") {
$opt_trace != 0); &dd ("opt: disabling interrupt handler.");
$opt_no_quit = 1;
die "You must select a shell to test in.\n" if (@opt_engine_list == 0);
die "Unsupported standalone argument.\n" if (@ARGV != 0); } else {
&dd ("opt: unknown option $option '$value'.");
&usage;
}
$lastopt = $option;
}
Getopt::Mixed::cleanup();
if ($#opt_engine_list == -1) {
die "You must select a shell to test in.\n";
}
} }
# #