OLD | NEW |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- | 2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- |
3 # vim: set ts=4 sw=4 et tw=80: | 3 # vim: set ts=4 sw=4 et tw=80: |
4 # ***** BEGIN LICENSE BLOCK ***** | 4 # ***** BEGIN LICENSE BLOCK ***** |
5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
6 # | 6 # |
7 # The contents of this file are subject to the Mozilla Public License Version | 7 # The contents of this file are subject to the Mozilla Public License Version |
8 # 1.1 (the "License"); you may not use this file except in compliance with | 8 # 1.1 (the "License"); you may not use this file except in compliance with |
9 # the License. You may obtain a copy of the License at | 9 # the License. You may obtain a copy of the License at |
10 # http://www.mozilla.org/MPL/ | 10 # http://www.mozilla.org/MPL/ |
(...skipping 25 matching lines...) Expand all Loading... |
36 # the provisions above, a recipient may use your version of this file under | 36 # the provisions above, a recipient may use your version of this file under |
37 # the terms of any one of the MPL, the GPL or the LGPL. | 37 # the terms of any one of the MPL, the GPL or the LGPL. |
38 # | 38 # |
39 # ***** END LICENSE BLOCK ***** | 39 # ***** END LICENSE BLOCK ***** |
40 | 40 |
41 # Second cut at runtests.pl script originally by | 41 # Second cut at runtests.pl script originally by |
42 # Christine Begle (cbegle@netscape.com) | 42 # Christine Begle (cbegle@netscape.com) |
43 # Branched 11/01/99 | 43 # Branched 11/01/99 |
44 | 44 |
45 use strict; | 45 use strict; |
46 use Getopt::Mixed "nextOption"; | |
47 use File::Temp qw/ tempfile tempdir /; | 46 use File::Temp qw/ tempfile tempdir /; |
48 use POSIX qw(sys_wait_h); | 47 use POSIX qw(sys_wait_h); |
49 | 48 |
50 my $os_type = &get_os_type; | 49 my $os_type = &get_os_type; |
51 my $unixish = (($os_type ne "WIN") && ($os_type ne "MAC")); | 50 my $unixish = (($os_type ne "WIN") && ($os_type ne "MAC")); |
52 my $path_sep = ($os_type eq "MAC") ? ":" : "/"; | 51 my $path_sep = ($os_type eq "MAC") ? ":" : "/"; |
53 my $win_sep = ($os_type eq "WIN")? &get_win_sep : ""; | 52 my $win_sep = ($os_type eq "WIN")? &get_win_sep : ""; |
54 my $redirect_command = ($os_type ne "MAC") ? " 2>&1" : ""; | 53 my $redirect_command = ($os_type ne "MAC") ? " 2>&1" : ""; |
55 | 54 |
56 # command line option defaults | 55 # command line option defaults |
(...skipping 20 matching lines...) Expand all Loading... |
77 my $opt_enable_narcissus = 0; | 76 my $opt_enable_narcissus = 0; |
78 my $opt_narcissus_path = ""; | 77 my $opt_narcissus_path = ""; |
79 my $opt_no_quit = 0; | 78 my $opt_no_quit = 0; |
80 my $opt_report_summarized_results = 0; | 79 my $opt_report_summarized_results = 0; |
81 | 80 |
82 # command line option definition | 81 # command line option definition |
83 my $options = "b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " . | 82 my $options = "b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " . |
84 "h help>h i j=s javapath>j k confail>k K linefail>K R report>R l=s list>l " . | 83 "h help>h i j=s javapath>j k confail>k K linefail>K R report>R l=s list>l " . |
85 "L=s neglist>L o=s opt>o p=s testpath>p s=s shellpath>s t trace>t " . | 84 "L=s neglist>L o=s opt>o p=s testpath>p s=s shellpath>s t trace>t " . |
86 "T=s timeout>T u=s lxrurl>u " . | 85 "T=s timeout>T u=s lxrurl>u " . |
87 "x noexitmunge>x n:s narcissus>n " . | 86 "x noexitmunge>x n=s narcissus>n " . |
88 "Q noquitinthandler>Q"; | 87 "Q noquitinthandler>Q"; |
89 | 88 |
| 89 my $last_option; |
| 90 |
90 if ($os_type eq "MAC") { | 91 if ($os_type eq "MAC") { |
91 $opt_suite_path = `directory`; | 92 $opt_suite_path = `directory`; |
92 $opt_suite_path =~ s/[\n\r]//g; | 93 $opt_suite_path =~ s/[\n\r]//g; |
93 $opt_suite_path .= ":"; | 94 $opt_suite_path .= ":"; |
94 } else { | 95 } else { |
95 $opt_suite_path = "./"; | 96 $opt_suite_path = "./"; |
96 } | 97 } |
97 | 98 |
98 &parse_args; | 99 &parse_args; |
99 | 100 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 close (OUTPUT); | 496 close (OUTPUT); |
496 | 497 |
497 &status ("Wrote results to '$opt_output_file'."); | 498 &status ("Wrote results to '$opt_output_file'."); |
498 | 499 |
499 if ($opt_console_failures) { | 500 if ($opt_console_failures) { |
500 &status ("$failures_reported test(s) failed"); | 501 &status ("$failures_reported test(s) failed"); |
501 } | 502 } |
502 | 503 |
503 } | 504 } |
504 | 505 |
| 506 sub next_option { |
| 507 my ($key, $val, $implied); |
| 508 |
| 509 return if @ARGV == 0; |
| 510 |
| 511 &dd ("ARGV is now: @ARGV\n"); |
| 512 |
| 513 $key = shift @ARGV; |
| 514 if ($key =~ s/^--?(.*)/$1/) { |
| 515 $implied = 0; |
| 516 } else { |
| 517 $implied = 1; |
| 518 $val = $key; |
| 519 $key = $last_option; |
| 520 } |
| 521 |
| 522 if ($key =~ /\w+/ and $options =~ /\b$key>(\w+)/) { |
| 523 $key = $1; |
| 524 } |
| 525 |
| 526 if ($options =~ /\b$key=s\b/) { |
| 527 if (!$implied) { |
| 528 die "option '$key' requires an argument" if @ARGV == 0; |
| 529 $val = shift @ARGV; |
| 530 } |
| 531 } elsif ($options =~ /(^|\s)$key(\s|$)/) { |
| 532 die "option '$key' doesn't take an argument" if $implied; |
| 533 $val = 1; |
| 534 } else { |
| 535 die "can't figure out option '$key'"; |
| 536 } |
| 537 $last_option = $key; |
| 538 return ($key, $val); |
| 539 } |
| 540 |
505 sub parse_args { | 541 sub parse_args { |
506 my ($option, $value, $lastopt); | 542 my ($option, $value, $lastopt); |
507 | 543 |
508 &dd ("checking command line options."); | 544 &dd ("checking command line options."); |
509 | 545 |
510 Getopt::Mixed::init ($options); | 546 while (($option, $value) = next_option()) { |
511 $Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER; | |
512 | |
513 while (($option, $value) = nextOption()) { | |
514 | 547 |
515 if ($option eq "b") { | 548 if ($option eq "b") { |
516 &dd ("opt: setting bugurl to '$value'."); | 549 &dd ("opt: setting bugurl to '$value'."); |
517 $opt_bug_url = $value; | 550 $opt_bug_url = $value; |
518 | 551 |
519 } elsif ($option eq "c") { | 552 } elsif ($option eq "c") { |
520 &dd ("opt: setting classpath to '$value'."); | 553 &dd ("opt: setting classpath to '$value'."); |
521 $opt_classpath = $value; | 554 $opt_classpath = $value; |
522 | 555 |
523 } elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) { | 556 } elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 651 |
619 } else { | 652 } else { |
620 &dd ("opt: unknown option $option '$value'."); | 653 &dd ("opt: unknown option $option '$value'."); |
621 &usage; | 654 &usage; |
622 } | 655 } |
623 | 656 |
624 $lastopt = $option; | 657 $lastopt = $option; |
625 | 658 |
626 } | 659 } |
627 | 660 |
628 Getopt::Mixed::cleanup(); | |
629 | |
630 if ($#opt_engine_list == -1) { | 661 if ($#opt_engine_list == -1) { |
631 die "You must select a shell to test in.\n"; | 662 die "You must select a shell to test in.\n"; |
632 } | 663 } |
633 | 664 |
634 } | 665 } |
635 | 666 |
636 # | 667 # |
637 # print the arguments that this script expects | 668 # print the arguments that this script expects |
638 # | 669 # |
639 sub usage { | 670 sub usage { |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 "bug: $bug_number " . | 1588 "bug: $bug_number " . |
1558 "result: $result " . | 1589 "result: $result " . |
1559 "type: shell " . | 1590 "type: shell " . |
1560 "description: $description " . | 1591 "description: $description " . |
1561 "expected: $expected " . | 1592 "expected: $expected " . |
1562 "actual: $actual " . | 1593 "actual: $actual " . |
1563 "reason: $reason" . | 1594 "reason: $reason" . |
1564 "\n"); | 1595 "\n"); |
1565 | 1596 |
1566 } | 1597 } |
OLD | NEW |