Changeset 27034 in webkit for trunk/JavaScriptCore/tests


Ignore:
Timestamp:
Oct 25, 2007, 4:36:25 AM (18 years ago)
Author:
[email protected]
Message:

Roll out r27033 as it broke the JavaScriptCore tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/tests/mozilla/jsDriver.pl

    r27033 r27034  
    4141
    4242my $os_type = &get_os_type;
    43 my $unixish = ($os_type ne "WIN");
    44 my $path_sep = "/";  # This script uses unix paths internally and converts to native when needed
     43my $unixish = (($os_type ne "WIN") && ($os_type ne "MAC"));
     44my $path_sep = ($os_type eq "MAC") ? ":" : "/";
    4545my $win_sep  = ($os_type eq "WIN")? &get_win_sep : "";
    46 my $redirect_command = " 2>&1";
     46my $redirect_command = ($os_type ne "MAC") ? " 2>&1" : "";
    4747
    4848# command line option defaults
    4949my $opt_suite_path;
    5050my $opt_trace = 0;
    51 my $opt_engine_type = "kjs";
     51my $opt_classpath = "";
     52my $opt_rhino_opt = 0;
     53my $opt_rhino_ms = 0;
     54my @opt_engine_list;
     55my $opt_engine_type = "";
    5256my $opt_engine_params = "";
    5357my $opt_user_output_file = 0;
     
    6064my $opt_console_failures = 0;
    6165my $opt_lxr_url = "./"; # "http://lxr.mozilla.org/mozilla/source/js/tests/";
     66my $opt_exit_munge = ($os_type ne "MAC") ? 1 : 0;
    6267
    6368# command line option definition
     
    6772"x noexitmunge>x";
    6873
    69 $opt_suite_path = "./";
     74if ($os_type eq "MAC") {
     75    $opt_suite_path = `directory`;
     76    $opt_suite_path =~ s/[\n\r]//g;
     77        $opt_suite_path .= ":";
     78} else {
     79    $opt_suite_path = "./";
     80}
    7081
    7182&parse_args;
     
    97108    my $start_time;
    98109   
    99     $engine_command = &get_engine_command;
    100     $html = "";
    101     @failed_tests = ();
    102     $failures_reported = 0;
    103     $tests_completed = 0;
    104     $start_time = time;
    105    
    106    
    107     &execute_tests (@test_list);
    108    
    109     my $exec_time = (time - $start_time);
    110     my $exec_hours = int($exec_time / 60 / 60);
    111     $exec_time -= $exec_hours * 60 * 60;
    112     my $exec_mins = int($exec_time / 60);
    113     $exec_time -= $exec_mins * 60;
    114     my $exec_secs = ($exec_time % 60);
    115    
    116     if ($exec_hours > 0) {
    117         $exec_time_string = "$exec_hours hours, $exec_mins minutes, " .
    118         "$exec_secs seconds";
    119     } elsif ($exec_mins > 0) {
    120         $exec_time_string = "$exec_mins minutes, $exec_secs seconds";
    121     } else {
    122         $exec_time_string = "$exec_secs seconds";
    123     }
    124    
    125     if (!$opt_user_output_file) {
    126         $opt_output_file = &get_tempfile_name;
    127     }
    128    
    129     &write_results;
     110    while ($opt_engine_type = pop (@opt_engine_list)) {
     111        dd ("Testing engine '$opt_engine_type'");
     112       
     113        $engine_command = &get_engine_command;
     114        $html = "";
     115        @failed_tests = ();
     116        $failures_reported = 0;
     117        $tests_completed = 0;
     118        $start_time = time;
     119       
     120       
     121        &execute_tests (@test_list);
     122       
     123        my $exec_time = (time - $start_time);
     124        my $exec_hours = int($exec_time / 60 / 60);
     125        $exec_time -= $exec_hours * 60 * 60;
     126        my $exec_mins = int($exec_time / 60);
     127        $exec_time -= $exec_mins * 60;
     128        my $exec_secs = ($exec_time % 60);
     129       
     130        if ($exec_hours > 0) {
     131            $exec_time_string = "$exec_hours hours, $exec_mins minutes, " .
     132            "$exec_secs seconds";
     133        } elsif ($exec_mins > 0) {
     134            $exec_time_string = "$exec_mins minutes, $exec_secs seconds";
     135        } else {
     136            $exec_time_string = "$exec_secs seconds";
     137        }
     138       
     139        if (!$opt_user_output_file) {
     140            $opt_output_file = &get_tempfile_name;
     141        }
     142       
     143        &write_results;
     144       
     145    }
    130146}
    131147
     
    186202        @output = grep (!/js\>/, @output);
    187203       
     204        if ($opt_exit_munge == 1) {
    188205# signal information in the lower 8 bits, exit code above that
    189         $got_exit = ($? >> 8);
    190         $exit_signal = ($? & 255);
     206            $got_exit = ($? >> 8);
     207            $exit_signal = ($? & 255);
     208        } else {
     209# user says not to munge the exit code
     210            $got_exit = $?;
     211            $exit_signal = 0;
     212        }
    191213       
    192214        $failure_lines = "";
     
    195217       
    196218        foreach $line (@output) {
     219           
    197220# watch for testcase to proclaim what exit code it expects to
    198221# produce (0 by default)
     
    355378            $opt_bug_url = $value;
    356379           
    357         }elsif ($option eq "f") {
     380        } elsif ($option eq "c") {
     381            &dd ("opt: setting classpath to '$value'.");
     382            $opt_classpath = $value;
     383           
     384        } elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) {
     385            &dd ("opt: adding engine $value.");
     386            push (@opt_engine_list, $value);
     387           
     388        } elsif ($option eq "f") {
    358389            if (!$value) {
    359390                die ("Output file cannot be null.\n");
     
    393424        } elsif ($option eq "p") {
    394425            $opt_suite_path = $value;
    395             if (!($opt_suite_path =~ /[\/\\]$/)) {
    396                 $opt_suite_path .= "/";
     426           
     427            if ($os_type eq "MAC") {
     428                if (!($opt_suite_path =~ /\:$/)) {
     429                    $opt_suite_path .= ":";
     430                }
     431            } else {
     432                if (!($opt_suite_path =~ /[\/\\]$/)) {
     433                    $opt_suite_path .= "/";
     434                }
    397435            }
    398436           
     
    412450            $opt_lxr_url = $value;
    413451           
     452        } elsif ($option eq "x") {
     453            &dd ("opt: turning off exit munging.");
     454            $opt_exit_munge = 0;
     455           
    414456        } else {
    415457            &usage;
     
    417459       
    418460        $lastopt = $option;
     461       
    419462    }
    420463   
    421464    Getopt::Mixed::cleanup();
     465   
     466    if ($#opt_engine_list == -1) {
     467        die "You must select a shell to test in.\n";
     468    }
     469   
    422470}
    423471
     
    430478     "(-b|--bugurl)             Bugzilla URL.\n" .
    431479     "                          (default is $opt_bug_url)\n" .
     480     "(-c|--classpath)          Classpath (Rhino only.)\n" .
     481     "(-e|--engine) <type> ...  Specify the type of engine(s) to test.\n" .
     482     "                          <type> is one or more of\n" .
     483     "                          (kjs|smopt|smdebug|lcopt|lcdebug|xpcshell|" .
     484     "rhino|rhinoi|rhinoms|rhinomsi|rhino9|rhinoms9).\n" .
    432485     "(-f|--file) <file>        Redirect output to file named <file>.\n" .
    433486     "                          (default is " .
     
    459512    my $retval;
    460513   
    461    if ($opt_engine_type eq "kjs") {
     514    if ($opt_engine_type eq "rhino") {
     515        &dd ("getting rhino engine command.");
     516        $opt_rhino_opt = 0;
     517        $opt_rhino_ms = 0;
     518        $retval = &get_rhino_engine_command;
     519    } elsif ($opt_engine_type eq "rhinoi") {
     520        &dd ("getting rhinoi engine command.");
     521        $opt_rhino_opt = -1;
     522        $opt_rhino_ms = 0;
     523        $retval = &get_rhino_engine_command;
     524    } elsif ($opt_engine_type eq "rhino9") {
     525        &dd ("getting rhino engine command.");
     526        $opt_rhino_opt = 9;
     527        $opt_rhino_ms = 0;
     528        $retval = &get_rhino_engine_command;
     529    } elsif ($opt_engine_type eq "rhinoms") {
     530        &dd ("getting rhinoms engine command.");
     531        $opt_rhino_opt = 0;
     532        $opt_rhino_ms = 1;
     533        $retval = &get_rhino_engine_command;
     534    } elsif ($opt_engine_type eq "rhinomsi") {
     535        &dd ("getting rhinomsi engine command.");
     536        $opt_rhino_opt = -1;
     537        $opt_rhino_ms = 1;
     538        $retval = &get_rhino_engine_command;
     539    } elsif ($opt_engine_type eq "rhinoms9") {
     540        &dd ("getting rhinomsi engine command.");
     541        $opt_rhino_opt = 9;
     542        $opt_rhino_ms = 1;
     543        $retval = &get_rhino_engine_command;
     544    } elsif ($opt_engine_type eq "xpcshell") {
     545        &dd ("getting xpcshell engine command.");
     546        $retval = &get_xpc_engine_command;
     547    } elsif ($opt_engine_type =~ /^lc(opt|debug)$/) {
     548        &dd ("getting liveconnect engine command.");
     549        $retval = &get_lc_engine_command;   
     550    } elsif ($opt_engine_type =~ /^sm(opt|debug)$/) {
     551        &dd ("getting spidermonkey engine command.");
     552        $retval = &get_sm_engine_command;
     553    }  elsif ($opt_engine_type =~ /^ep(opt|debug)$/) {
     554        &dd ("getting epimetheus engine command.");
     555        $retval = &get_ep_engine_command;
     556    } elsif ($opt_engine_type eq "kjs") {
    462557        &dd ("getting kjs engine command.");
    463558        $retval = &get_kjs_engine_command;
     559       
    464560    } else {
    465561        die ("Unknown engine type selected, '$opt_engine_type'.\n");
     
    471567   
    472568    return $retval;
     569   
     570}
     571
     572#
     573# get the shell command used to run rhino
     574#
     575sub get_rhino_engine_command {
     576    my $retval = $opt_java_path . ($opt_rhino_ms ? "jview " : "java ");
     577   
     578    if ($opt_shell_path) {
     579        $opt_classpath = ($opt_classpath) ?
     580        $opt_classpath . ":" . $opt_shell_path :
     581        $opt_shell_path;
     582    }
     583   
     584    if ($opt_classpath) {
     585        $retval .= ($opt_rhino_ms ? "/cp:p" : "-classpath") . " $opt_classpath ";
     586    }
     587   
     588    $retval .= "org.mozilla.javascript.tools.shell.Main";
     589   
     590    if ($opt_rhino_opt) {
     591        $retval .= " -opt $opt_rhino_opt";
     592    }
     593   
     594    return $retval;
     595   
     596}
     597
     598#
     599# get the shell command used to run xpcshell
     600#
     601sub get_xpc_engine_command {
     602    my $retval;
     603    my $m5_home = @ENV{"MOZILLA_FIVE_HOME"} ||
     604        die ("You must set MOZILLA_FIVE_HOME to use the xpcshell" ,
     605             (!$unixish) ? "." : ", also " .
     606             "setting LD_LIBRARY_PATH to the same directory may get rid of " .
     607             "any 'library not found' errors.\n");
     608   
     609    if (($unixish) && (!@ENV{"LD_LIBRARY_PATH"})) {
     610        print STDERR "-#- WARNING: LD_LIBRARY_PATH is not set, xpcshell may " .
     611        "not be able to find the required components.\n";
     612    }
     613   
     614    if (!($m5_home =~ /[\/\\]$/)) {
     615        $m5_home .= "/";
     616    }
     617   
     618    $retval = $m5_home . "xpcshell";
     619   
     620    if ($os_type eq "WIN") {
     621        $retval .= ".exe";
     622    }
     623   
     624    $retval = &xp_path($retval);
     625   
     626    if (($os_type ne "MAC") && !(-x $retval)) {
     627# mac doesn't seem to deal with -x correctly
     628        die ($retval . " is not a valid executable on this system.\n");
     629    }
     630   
     631    return $retval;
     632   
    473633}
    474634
     
    488648}
    489649
     650#
     651# get the shell command used to run spidermonkey
     652#
     653sub get_sm_engine_command {
     654    my $retval;
     655   
     656# Look for Makefile.ref style make first.
     657# (On Windows, spidermonkey can be made by two makefiles, each putting the
     658# executable in a diferent directory, under a different name.)
     659   
     660    if ($opt_shell_path) {
     661# if the user provided a path to the shell, return that.
     662        $retval = $opt_shell_path;
     663       
     664    } else {
     665       
     666        if ($os_type eq "MAC") {
     667            $retval = $opt_suite_path . ":src:macbuild:JS";
     668        } else {
     669            $retval = $opt_suite_path . "../src/";
     670            opendir (SRC_DIR_FILES, $retval);
     671            my @src_dir_files = readdir(SRC_DIR_FILES);
     672            closedir (SRC_DIR_FILES);
     673           
     674            my ($dir, $object_dir);
     675            my $pattern = ($opt_engine_type eq "smdebug") ?
     676                'DBG.OBJ' : 'OPT.OBJ';
     677           
     678# scan for the first directory matching
     679# the pattern expected to hold this type (debug or opt) of engine
     680            foreach $dir (@src_dir_files) {
     681                if ($dir =~ $pattern) {
     682                    $object_dir = $dir;
     683                    last;
     684                }
     685            }
     686           
     687            if (!$object_dir && $os_type ne "WIN") {
     688                die ("Could not locate an object directory in $retval " .
     689                     "matching the pattern *$pattern.  Have you built the " .
     690                     "engine?\n");
     691            }
     692           
     693            if (!(-x $retval . $object_dir . "/js.exe") && ($os_type eq "WIN")) {
     694# On windows, you can build with js.mak as well as Makefile.ref
     695# (Can you say WTF boys and girls?  I knew you could.)
     696# So, if the exe the would have been built by Makefile.ref isn't
     697# here, check for the js.mak version before dying.
     698                if ($opt_shell_path) {
     699                    $retval = $opt_shell_path;
     700                    if (!($retval =~ /[\/\\]$/)) {
     701                        $retval .= "/";
     702                    }
     703                } else {
     704                    if ($opt_engine_type eq "smopt") {
     705                        $retval = "../src/Release/";
     706                    } else {
     707                        $retval = "../src/Debug/";
     708                    }
     709                }
     710               
     711                $retval .= "jsshell.exe";
     712               
     713            } else {
     714                $retval .= $object_dir . "/js";
     715                if ($os_type eq "WIN") {
     716                    $retval .= ".exe";
     717                }
     718            }
     719        } # mac/ not mac
     720       
     721        $retval = &xp_path($retval);
     722       
     723    } # (user provided a path)
     724       
     725       
     726        if (($os_type ne "MAC") && !(-x $retval)) {
     727# mac doesn't seem to deal with -x correctly
     728            die ($retval . " is not a valid executable on this system.\n");
     729        }
     730   
     731    return $retval;
     732   
     733}
     734
     735#
     736# get the shell command used to run epimetheus
     737#
     738sub get_ep_engine_command {
     739    my $retval;
     740   
     741    if ($opt_shell_path) {
     742# if the user provided a path to the shell, return that -
     743        $retval = $opt_shell_path;
     744       
     745    } else {
     746        my $dir;
     747        my $os;
     748        my $debug;
     749        my $opt;
     750        my $exe;
     751       
     752        $dir = $opt_suite_path . "../../js2/src/";
     753       
     754        if ($os_type eq "MAC") {
     755#
     756# On the Mac, the debug and opt builds lie in the same directory -
     757#
     758            $os = "macbuild:";
     759            $debug = "";
     760            $opt = "";
     761            $exe = "JS2";
     762        } elsif ($os_type eq "WIN") {
     763            $os = "winbuild/Epimetheus/";
     764            $debug = "Debug/";
     765            $opt = "Release/";
     766            $exe = "Epimetheus.exe";
     767        } else {
     768            $os = "";
     769            $debug = "";
     770            $opt = "";    # <<<----- XXX THIS IS NOT RIGHT! CHANGE IT!
     771                $exe = "epimetheus";
     772        }
     773       
     774       
     775        if ($opt_engine_type eq "epdebug") {
     776            $retval = $dir . $os . $debug . $exe;
     777        } else {
     778            $retval = $dir . $os . $opt . $exe;
     779        }
     780       
     781        $retval = &xp_path($retval);
     782       
     783    }# (user provided a path)
     784       
     785       
     786        if (($os_type ne "MAC") && !(-x $retval)) {
     787# mac doesn't seem to deal with -x correctly
     788            die ($retval . " is not a valid executable on this system.\n");
     789        }
     790   
     791    return $retval;
     792}
     793
     794#
     795# get the shell command used to run the liveconnect shell
     796#
     797sub get_lc_engine_command {
     798    my $retval;
     799   
     800    if ($opt_shell_path) {
     801        $retval = $opt_shell_path;
     802    } else {
     803        if ($os_type eq "MAC") {
     804            die "Don't know how to run the lc shell on the mac yet.\n";
     805        } else {
     806            $retval = $opt_suite_path . "../src/liveconnect/";
     807            opendir (SRC_DIR_FILES, $retval);
     808            my @src_dir_files = readdir(SRC_DIR_FILES);
     809            closedir (SRC_DIR_FILES);
     810           
     811            my ($dir, $object_dir);
     812            my $pattern = ($opt_engine_type eq "lcdebug") ?
     813                'DBG.OBJ' : 'OPT.OBJ';
     814           
     815            foreach $dir (@src_dir_files) {
     816                if ($dir =~ $pattern) {
     817                    $object_dir = $dir;
     818                    last;
     819                }
     820            }
     821           
     822            if (!$object_dir) {
     823                die ("Could not locate an object directory in $retval " .
     824                     "matching the pattern *$pattern.  Have you built the " .
     825                     "engine?\n");
     826            }
     827           
     828            $retval .= $object_dir . "/";
     829           
     830            if ($os_type eq "WIN") {
     831                $retval .= "lcshell.exe";
     832            } else {
     833                $retval .= "lcshell";
     834            }
     835        } # mac/ not mac
     836       
     837        $retval = &xp_path($retval);
     838       
     839    } # (user provided a path)
     840       
     841       
     842        if (($os_type ne "MAC") && !(-x $retval)) {
     843# mac doesn't seem to deal with -x correctly
     844            die ("$retval is not a valid executable on this system.\n");
     845        }
     846   
     847    return $retval;
     848   
     849}
     850
    490851sub get_os_type {
     852   
     853    if ("\n" eq "\015") {
     854        return "MAC";
     855    }
     856   
    491857    my $uname = `uname -a`;
    492858   
     
    499865    &dd ("get_os_type returning '$uname'.");
    500866    return $uname;
     867   
    501868}
    502869
     
    538905        &dd ((($#neg_list + 1) - $actually_skipped) . " skip tests were " .
    539906             "not actually part of the test list.");
     907       
     908       
    540909    }
    541910   
    542911    return @test_list;
     912   
    543913}
    544914
     
    552922    my @retval = ();
    553923   
    554     # We will call expand_test_list_entry(), which does pattern-matching on $list_file.
    555     # This will make the pattern-matching the same as it would be on Linux/Windows -
    556     #
     924#
     925# Trim off the leading path separator that begins relative paths on the Mac.
     926# Each path will get concatenated with $opt_suite_path, which ends in one.
     927#
     928# Also note:
     929#
     930# We will call expand_test_list_entry(), which does pattern-matching on $list_file.
     931# This will make the pattern-matching the same as it would be on Linux/Windows -
     932#
     933    if ($os_type eq "MAC") {
     934        $list_file =~ s/^$path_sep//;
     935    }
     936   
    557937    if ($list_file =~ /\.js$/ || -d $opt_suite_path . $list_file) {
     938       
    558939        push (@retval, &expand_test_list_entry($list_file));
    559     } else {
     940       
     941    } else {
     942       
    560943        open (TESTLIST, $list_file) ||
    561944        die("Error opening test list file '$list_file': $!\n");
     
    570953       
    571954        close (TESTLIST);
     955       
    572956    }
    573957   
    574958    return @retval;
     959   
    575960}
    576961
     
    6311016 
    6321017 return @retval;
     1018 
    6331019}
    6341020
     
    6601046   
    6611047    return @retval;
     1048   
    6621049}
    6631050
     
    6681055    my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
    6691056    &get_padded_time (localtime);
    670     return "res-" . $year . $mon . $mday . $hour . $min . $sec . "-" . $opt_engine_type . ".html";
     1057    my $rv;
     1058   
     1059    if ($os_type ne "MAC") {
     1060        $rv = "results-" . $year . "-" . $mon . "-" . $mday . "-" . $hour .
     1061        $min . $sec . "-" . $opt_engine_type;
     1062    } else {
     1063        $rv = "res-" . $year . $mon . $mday . $hour . $min . $sec . "-" .
     1064        $opt_engine_type
     1065    }
     1066   
     1067    return $rv . ".html";
    6711068}
    6721069
     
    6831080   
    6841081    return ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
     1082   
    6851083}
    6861084
     
    7031101   
    7041102    return @whole;
     1103   
     1104}
     1105
     1106#
     1107# Convert unix path to mac style.
     1108#
     1109sub unix_to_mac {
     1110    my ($path) = @_;
     1111    my @path_elements = split ("/", $path);
     1112    my $rv = "";
     1113    my $i;
     1114   
     1115    foreach $i (0 .. $#path_elements) {
     1116        if ($path_elements[$i] eq ".") {
     1117            if (!($rv =~ /\:$/)) {
     1118                $rv .= ":";
     1119            }
     1120        } elsif ($path_elements[$i] eq "..") {
     1121            if (!($rv =~ /\:$/)) {
     1122                $rv .= "::";
     1123            } else {
     1124                $rv .= ":";
     1125            }
     1126        } elsif ($path_elements[$i] ne "") {
     1127            $rv .= $path_elements[$i] . ":";
     1128        }
     1129       
     1130    }
     1131   
     1132    $rv =~ s/\:$//;
     1133       
     1134        return $rv;
    7051135}
    7061136
     
    7341164    my ($path) = @_;
    7351165   
    736     if ($os_type eq "WIN") {
     1166    if ($os_type eq "MAC") {
     1167        return &unix_to_mac($path);
     1168    } elsif($os_type eq "WIN") {
    7371169        return &unix_to_win($path);
    7381170    } else {
     
    7491181
    7501182    while (@a && @b) {
    751     my $a = shift @a;
    752     my $b = shift @b;
     1183        my $a = shift @a;
     1184        my $b = shift @b;
    7531185        return $a <=> $b if $a =~ /^\d/ && $b =~ /^\d/ && $a != $b;
    7541186        return $a cmp $b if $a ne $b;
     
    7651197    my @subdirs;
    7661198   
    767     if (!($dir =~ /\/$/)) {
    768         $dir = $dir . "/";
     1199    if ($os_type ne "MAC") {
     1200        if (!($dir =~ /\/$/)) {
     1201            $dir = $dir . "/";
     1202        }
     1203    } else {
     1204        if (!($dir =~ /\:$/)) {
     1205            $dir = $dir . ":";
     1206        }
    7691207    }
    7701208    opendir (DIR, $dir) || die ("couldn't open directory $dir: $!");
     
    8551293
    8561294sub dd {
     1295   
    8571296    if ($opt_trace) {
    8581297        print ("-*- ", @_ , "\n");
    8591298    }
     1299   
    8601300}
    8611301
    8621302sub status {
     1303   
    8631304    print ("-#- ", @_ , "\n");
     1305   
    8641306}
    8651307
     
    8781320        $user_exit = 1;
    8791321    }
    880 }
     1322   
     1323}
Note: See TracChangeset for help on using the changeset viewer.