diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
commit | 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch) | |
tree | 4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebKitTools/Scripts | |
parent | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff) | |
download | external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebKitTools/Scripts')
40 files changed, 1706 insertions, 873 deletions
diff --git a/WebKitTools/Scripts/VCSUtils.pm b/WebKitTools/Scripts/VCSUtils.pm index 26401f4..e09d331 100644 --- a/WebKitTools/Scripts/VCSUtils.pm +++ b/WebKitTools/Scripts/VCSUtils.pm @@ -111,11 +111,9 @@ sub makeFilePathRelative($) return $path unless isGit(); unless (defined $gitRoot) { - chomp($gitRoot = `git rev-parse --git-dir`); - $gitRoot =~ s/\.git$//; + chomp($gitRoot = `git rev-parse --show-cdup`); } - my $result = File::Spec->abs2rel(File::Spec->rel2abs($path, $gitRoot)); - return $result; + return $gitRoot . $path; } 1; diff --git a/WebKitTools/Scripts/bisect-builds b/WebKitTools/Scripts/bisect-builds index 43e3889..f77f81f 100755 --- a/WebKitTools/Scripts/bisect-builds +++ b/WebKitTools/Scripts/bisect-builds @@ -42,7 +42,7 @@ use strict; use File::Basename; use File::Path; use File::Spec; -use File::Temp; +use File::Temp qw(tempfile); use Getopt::Long; use Time::HiRes qw(usleep); @@ -204,13 +204,12 @@ sub createTempFile($) return undef if !$url; - my $fh = new File::Temp( + my ($fh, $tempFile) = tempfile( + basename($0) . "-XXXXXXXX", DIR => ($ENV{'TMPDIR'} || "/tmp"), SUFFIX => ".html", - TEMPLATE => basename($0) . "-XXXXXXXX", UNLINK => 0, ); - my $tempFile = $fh->filename(); print $fh "<meta http-equiv=\"refresh\" content=\"0; $url\">\n"; close($fh); @@ -319,7 +318,9 @@ sub makeNightlyList($$$$) } if (eval "v$macOSXVersion" ge v10.5) { - if (eval "v$safariVersion" ge v3.0) { + if (eval "v$safariVersion" ge v3.1) { + @files = grep { $_->{rev} >= 29711 } @files; + } elsif (eval "v$safariVersion" ge v3.0) { @files = grep { $_->{rev} >= 25124 } @files; } elsif (eval "v$safariVersion" ge v2.0) { @files = grep { $_->{rev} >= 19594 } @files; @@ -327,7 +328,9 @@ sub makeNightlyList($$$$) die "Requires Safari 2.0 or newer"; } } elsif (eval "v$macOSXVersion" ge v10.4) { - if (eval "v$safariVersion" ge v3.0) { + if (eval "v$safariVersion" ge v3.1) { + @files = grep { $_->{rev} >= 29711 } @files; + } elsif (eval "v$safariVersion" ge v3.0) { @files = grep { $_->{rev} >= 19992 } @files; } elsif (eval "v$safariVersion" ge v2.0) { @files = grep { $_->{rev} >= 11976 } @files; diff --git a/WebKitTools/Scripts/build-drosera b/WebKitTools/Scripts/build-drosera deleted file mode 100755 index f3b1144..0000000 --- a/WebKitTools/Scripts/build-drosera +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (C) 2006 Apple Computer, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of -# its contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Simplified build script for Web Kit Open Source Project. -# Modified copy of build-webkit. Perhaps these could share code. -# Currently only works for the Deployment build style. - -use strict; -use FindBin; -use lib $FindBin::Bin; -use webkitdirs; -use POSIX; - -checkRequiredSystemConfig(); -setConfiguration(); -chdirWebKit(); -my @options = XcodeOptions(); - -# Build -chdir "WebKitTools/Drosera/mac" or die; -my $result; -if (isOSX()) { - print "xcodebuild -project Drosera.xcodeproj ", join(" ", @options), "\n"; - $result = system "xcodebuild", "-project", "Drosera.xcodeproj", @options; -} else { - die "Building not defined for this platform!\n"; -} -exit exitStatus($result); diff --git a/WebKitTools/Scripts/build-dumprendertree b/WebKitTools/Scripts/build-dumprendertree index 7f48a59..a11481b 100755 --- a/WebKitTools/Scripts/build-dumprendertree +++ b/WebKitTools/Scripts/build-dumprendertree @@ -42,7 +42,7 @@ my @options = XcodeOptions(); chdir "WebKitTools/DumpRenderTree" or die; my $result; if (isOSX()) { - $result = system "xcodebuild", "-project", "DumpRenderTree.xcodeproj", @options; + $result = system "xcodebuild", "-project", "DumpRenderTree.xcodeproj", @options, @ARGV; } elsif (isCygwin()) { $result = buildVisualStudioProject("DumpRenderTree.sln"); } elsif (isQt() || isGtk()) { diff --git a/WebKitTools/Scripts/build-testkjs b/WebKitTools/Scripts/build-jsc index 5dc28ad..f258ea5 100755 --- a/WebKitTools/Scripts/build-testkjs +++ b/WebKitTools/Scripts/build-jsc @@ -42,7 +42,7 @@ my @options = XcodeOptions(); chdir "JavaScriptCore" or die "Can't find JavaScriptCore directory to build from"; my $result; if (isOSX()) { - $result = system "sh", "-c", 'xcodebuild -project JavaScriptCore.xcodeproj -target testkjs "$@" | grep -v setenv && exit ${PIPESTATUS[0]}', "xcodebuild", @options, @ARGV; + $result = system "sh", "-c", 'xcodebuild -project JavaScriptCore.xcodeproj -target jsc "$@" | grep -v setenv && exit ${PIPESTATUS[0]}', "xcodebuild", @options, @ARGV; } elsif (isCygwin()) { $result = buildVisualStudioProject("JavaScriptCore.vcproj/JavaScriptCore.sln"); } elsif (isQt() or isGtk() or isWx()) { diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit index 4cd8817..6ed3ddc 100755 --- a/WebKitTools/Scripts/build-webkit +++ b/WebKitTools/Scripts/build-webkit @@ -26,7 +26,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Simplified build script for Web Kit Open Source Project. +# Simplified build script for WebKit Open Source Project. use strict; use File::Basename; @@ -40,10 +40,12 @@ use POSIX; my $originalWorkingDirectory = getcwd(); my $databaseSupport = 1; +my $domStorageSupport = 1; my $iconDatabaseSupport = 1; +my $offlineWebApplicationSupport = 1; my $svgSupport = 1; my $svgExperimentalSupport = 0; -my $svgAnimationSupport = $svgExperimentalSupport; +my $svgAnimationSupport = 1; my $svgFiltersSupport = $svgExperimentalSupport; my $svgForeignObjectSupport = 1; my $svgUseSupport = 1; @@ -52,22 +54,30 @@ my $svgAsImageSupport = 1; my $xpathSupport = 1; my $xsltSupport = 1; my $coverageSupport = 0; -my $videoSupport = isOSX() || isCygwin(); # Enable by default on OSX and Windows +my $videoSupport = (isOSX() || isCygwin()); # Enable by default on OSX and Windows my $showHelp = 0; my $clean = 0; +my $buildUniversal = 0; +my $buildSixtyFourBit = 0; my $programName = basename($0); my $usage = <<EOF; Usage: $programName [options] [options to pass to build system] --help Show this help message + --cairo-win32 Build using Cairo (rather than CoreGraphics) on Windows + --clean Cleanup the build directory + --universal Build 2-way universal (PPC and Intel 32-bit) + --64-bit Build 64-bit, combine with --universal to build 4-way universal + --[no-]offline-web-applications Toggle Offline Web Application Support (default : $offlineWebApplicationSupport) --[no-]database Toggle Database Support (default: $databaseSupport) + --[no-]dom-storage Toggle DOM Storage Support (default: $domStorageSupport) --[no-]icon-database Toggle Icon database support (default: $iconDatabaseSupport) --[no-]svg Toggle SVG support (default: $svgSupport) --[no-]svg-experimental Toggle SVG experimental features support (default: $svgExperimentalSupport, implies SVG Support) --[no-]svg-animation Toggle SVG animation support (default: $svgAnimationSupport, implies SVG Support) --[no-]svg-filters Toggle SVG filters support (default: $svgFiltersSupport, implies SVG Support) - --[no-]svg-foreign-object Toggle SVG forgeing object support (default: $svgForeignObjectSupport, implies SVG Support) + --[no-]svg-foreign-object Toggle SVG foreign object support (default: $svgForeignObjectSupport, implies SVG Support) --[no-]svg-fonts Toggle SVG fonts support (default: $svgFontsSupport, implies SVG Support) --[no-]svg-as-image Toggle SVG as Image support (default: $svgAsImageSupport, implies SVG Support) --[no-]svg-use Toggle SVG use element support (default: $svgUseSupport, implies SVG Support) @@ -78,7 +88,9 @@ Usage: $programName [options] [options to pass to build system] EOF GetOptions('database!' => \$databaseSupport, + 'dom-storage!' => \$domStorageSupport, 'icon-database!' => \$iconDatabaseSupport, + 'offline-web-applications!' => \$offlineWebApplicationSupport, 'svg!' => \$svgSupport, 'svg-experimental!' => \$svgExperimentalSupport, 'svg-animation!' => \$svgAnimationSupport, @@ -92,6 +104,8 @@ GetOptions('database!' => \$databaseSupport, 'video!' => \$videoSupport, 'coverage!' => \$coverageSupport, 'help' => \$showHelp, + 'universal' => \$buildUniversal, + '64-bit' => \$buildSixtyFourBit, 'clean' => \$clean); if ($showHelp) { @@ -141,17 +155,19 @@ my $productDir = productDir(); my @overrideFeatureDefinesOption = (); push @overrideFeatureDefinesOption, "ENABLE_DATABASE" if $databaseSupport; +push @overrideFeatureDefinesOption, "ENABLE_DOM_STORAGE" if $domStorageSupport; push @overrideFeatureDefinesOption, "ENABLE_ICONDATABASE" if $iconDatabaseSupport; +push @overrideFeatureDefinesOption, "ENABLE_OFFLINE_WEB_APPLICATIONS" if $offlineWebApplicationSupport; push @overrideFeatureDefinesOption, "ENABLE_SVG" if $svgSupport; push @overrideFeatureDefinesOption, "ENABLE_SVG_ANIMATION" if $svgAnimationSupport; +push @overrideFeatureDefinesOption, "ENABLE_SVG_AS_IMAGE" if $svgAsImageSupport; push @overrideFeatureDefinesOption, "ENABLE_SVG_FILTERS" if $svgFiltersSupport; -push @overrideFeatureDefinesOption, "ENABLE_SVG_FOREIGN_OBJECT" if $svgForeignObjectSupport; push @overrideFeatureDefinesOption, "ENABLE_SVG_FONTS" if $svgFontsSupport; -push @overrideFeatureDefinesOption, "ENABLE_SVG_AS_IMAGE" if $svgAsImageSupport; +push @overrideFeatureDefinesOption, "ENABLE_SVG_FOREIGN_OBJECT" if $svgForeignObjectSupport; push @overrideFeatureDefinesOption, "ENABLE_SVG_USE" if $svgUseSupport; +push @overrideFeatureDefinesOption, "ENABLE_VIDEO" if $videoSupport; push @overrideFeatureDefinesOption, "ENABLE_XPATH" if $xpathSupport; push @overrideFeatureDefinesOption, "ENABLE_XSLT" if $xsltSupport; -push @overrideFeatureDefinesOption, "ENABLE_VIDEO" if $videoSupport; my $overrideFeatureDefinesString = "FEATURE_DEFINES=" . join(" ", @overrideFeatureDefinesOption); my @coverageSupportOption = (); @@ -179,10 +195,27 @@ if ($clean && isOSX()) { push(@options, "clean"); } +if ($buildSixtyFourBit && isOSX()) { + my $cpuVendor = `sysctl -n machdep.cpu.vendor`; + chomp $cpuVendor; + + if ($buildUniversal) { + push(@options, "ARCHS=ppc ppc64 i386 x86_64"); + } elsif ($cpuVendor eq "GenuineIntel") { + push(@options, "ARCHS=i386 x86_64"); + } else { + push(@options, "ARCHS=ppc ppc64"); + } +} elsif ($buildUniversal && isOSX()) { + push(@options, "ARCHS=ppc i386"); +} + # enable autotool options accordingly -if ($ENV{WEBKITAUTOTOOLS}) { +if (isGtk()) { push @options, autotoolsFlag($databaseSupport, "database"); + push @options, autotoolsFlag($domStorageSupport, "dom-storage"); push @options, autotoolsFlag($iconDatabaseSupport, "icon-database"); + push @options, autotoolsFlag($offlineWebApplicationSupport, "offline-web-applications"); push @options, autotoolsFlag($svgSupport, "svg"); push @options, autotoolsFlag($svgAnimationSupport, "svg-animation"); push @options, autotoolsFlag($svgFiltersSupport, "svg-filters"); @@ -241,12 +274,6 @@ if (isOSX()) { } } -if (isGtk() && isDarwin() && !$ENV{WEBKITAUTOTOOLS} && !$ENV{QMAKESPEC}) { - # The qmake from Trolltech's binary "QT for Mac" distribution tries to - # create xcode projects, not Makefiles - $ENV{QMAKESPEC} = "macx-g++"; -} - if (isCygwin()) { # Copy WebKitSupportLibrary to the correct location in WebKitLibraries so it can be found. # Will fail if WebKitSupportLibrary.zip is not in source root. @@ -266,7 +293,7 @@ for my $dir (@projects) { chdir ".." or die; next; } - + $result = buildGtkProject($dir, $clean, @options); } elsif (isQt()) { if ($dir ne "WebKit") { @@ -312,8 +339,7 @@ if ($svgSupport) { print " $launcherName will have SVG viewing capabilities.\n"; } if ($svgAnimationSupport or $svgFiltersSupport or $svgForeignObjectSupport or $svgFontsSupport or $svgAsImageSupport or $svgUseSupport) { - print "\n NOTE: WebKit has been built with experimental SVG features enabled.\n"; - print " Your build supports: \n"; + print " Your build supports the following (optional) SVG features: \n"; print " * Basic SVG animation.\n" if $svgAnimationSupport; print " * SVG filters.\n" if $svgFiltersSupport; print " * SVG foreign object.\n" if $svgForeignObjectSupport; diff --git a/WebKitTools/Scripts/check-for-global-initializers b/WebKitTools/Scripts/check-for-global-initializers index c73b8cc..493b40c 100755 --- a/WebKitTools/Scripts/check-for-global-initializers +++ b/WebKitTools/Scripts/check-for-global-initializers @@ -26,7 +26,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# "check-for-global-initializers" script for Web Kit Open Source Project +# "check-for-global-initializers" script for WebKit Open Source Project # Intended to be invoked from an Xcode build step to check if there are # any global initializers in a target. @@ -92,22 +92,26 @@ for my $file (sort @files) { $shortName =~ s/.*\///; # Special cases for files that have initializers in debug builds. - if ($configuration eq "Debug" or $debugRoot ) { + if ($configuration eq "Debug" or $variant eq "debug" or $debugRoot) { if ($target eq "JavaScriptCore") { - next if $shortName eq "nodes.o"; next if $shortName eq "AllInOneFile.o"; + next if $shortName eq "Opcode.o"; + next if $shortName eq "StructureID.o"; + next if $shortName eq "nodes.o"; } if ($target eq "WebCore") { next if $shortName eq "CachedPage.o"; + next if $shortName eq "CachedResource.o"; next if $shortName eq "Frame.o"; next if $shortName eq "JSCustomSQLTransactionCallback.o"; + next if $shortName eq "JSEventListener.o"; next if $shortName eq "Node.o"; next if $shortName eq "Page.o"; next if $shortName eq "Range.o"; next if $shortName eq "RenderObject.o"; next if $shortName eq "SubresourceLoader.o"; + next if $shortName eq "SVGElementInstance.o"; next if $shortName eq "bidi.o"; - next if $shortName eq "kjs_events.o"; } } diff --git a/WebKitTools/Scripts/check-for-weak-vtables b/WebKitTools/Scripts/check-for-weak-vtables new file mode 100755 index 0000000..d274b01 --- /dev/null +++ b/WebKitTools/Scripts/check-for-weak-vtables @@ -0,0 +1,101 @@ +#!/usr/bin/perl + +# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of +# its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# "check-for-weak-vtables" script for WebKit Open Source Project + +# Intended to be invoked from an Xcode build step to check if there are +# any weak vtables in a target. + +use warnings; +use strict; + +use File::Basename; + +sub touch($); + +my $arch = $ENV{'CURRENT_ARCH'}; +my $configuration = $ENV{'CONFIGURATION'}; +my $target = $ENV{'TARGET_NAME'}; +my $variant = $ENV{'CURRENT_VARIANT'}; +my $coverageBuild = $ENV{'WEBKIT_COVERAGE_BUILD'}; +my $debugRoot = $ENV{'WEBKIT_DEBUG_ROOT'}; + +$arch = $ENV{'NATIVE_ARCH'} if !$arch; # for Xcode 2.1, which does not have CURRENT_ARCH +$variant = "normal" if !$variant; # for Xcode 2.1, which does not have CURRENT_VARIANT + +my $executablePath = "$ENV{'TARGET_BUILD_DIR'}/$ENV{'EXECUTABLE_PATH'}"; + +my $buildTimestampPath = $ENV{'TARGET_TEMP_DIR'} . "/" . basename($0) . ".timestamp"; +my $buildTimestampAge = -M $buildTimestampPath; +my $executablePathAge = -M $executablePath; + +my $sawError = 0; + +if (!defined $executablePathAge || !defined $buildTimestampAge || $executablePathAge > $buildTimestampAge) { + if (!open NM, "(nm -m '$executablePath' | c++filt | sed 's/^/STDOUT:/') 2>&1 |") { + print "Could not open $executablePath\n"; + $sawError = 1; + next; + } + my @weakVTableClasses = (); + while (<NM>) { + if (/^STDOUT:/) { + push @weakVTableClasses, $1 if /weak external vtable for (.*)$/; + } else { + print STDERR if $_ ne "nm: no name list\n"; + } + } + close NM; + if (@weakVTableClasses) { + my $shortName = $executablePath; + $shortName =~ s/.*\///; + + print "$shortName has a weak vtable in it ($executablePath)\n"; + print "Fix by making sure the first virtual function in each of these classes is not an inline:\n"; + for my $class (sort @weakVTableClasses) { + print " $class\n"; + } + $sawError = 1; + } +} + +if ($sawError and !$coverageBuild) { + unlink $executablePath; + exit 1; +} + +touch($buildTimestampPath); + +exit 0; + +sub touch($) +{ + my ($path) = @_; + open(TOUCH, ">", $path) or die "$!"; + close(TOUCH); +} diff --git a/WebKitTools/Scripts/commit-log-editor b/WebKitTools/Scripts/commit-log-editor index e7ee5155..939b28c 100755 --- a/WebKitTools/Scripts/commit-log-editor +++ b/WebKitTools/Scripts/commit-log-editor @@ -96,8 +96,8 @@ for my $changeLog (@changeLogs) { while (<CHANGELOG>) { if (/^\S/) { last if $contents; - next; - } elsif (/\S/) { + } + if (/\S/) { $contents .= $blankLines if $contents; $blankLines = ""; $contents .= $_; diff --git a/WebKitTools/Scripts/create-exports b/WebKitTools/Scripts/create-exports new file mode 100755 index 0000000..c645d55 --- /dev/null +++ b/WebKitTools/Scripts/create-exports @@ -0,0 +1,5 @@ +#!/usr/bin/perl -w + +while (<>) { + print "$1\n" if /^\s*\"(.+)\", referenced from:$/; +} diff --git a/WebKitTools/Scripts/do-file-rename b/WebKitTools/Scripts/do-file-rename index 23a460c..ac5099e 100755 --- a/WebKitTools/Scripts/do-file-rename +++ b/WebKitTools/Scripts/do-file-rename @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# Copyright (C) 2006 Apple Computer, Inc. All rights reserved. +# Copyright (C) 2006, 2008 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -42,7 +42,10 @@ my %words; # find all files we want to process my @paths; +find(\&wanted, "JavaScriptCore"); +find(\&wanted, "JavaScriptGlue"); find(\&wanted, "WebCore"); +find(\&wanted, "WebKit"); sub wanted { @@ -65,7 +68,9 @@ sub wanted } my %renames = ( - "xxx.mm" => "yyy.mm", +); + +my %renamesContemplatedForTheFuture = ( ); # rename files @@ -99,7 +104,7 @@ for my $file (sort @paths) { my $newContents = $contents; for my $from (keys %renames) { - $newContents =~ s/\b\Q$from\E(?!["\w])/$renames{$from}/g; # this " unconfuses Xcode syntax highlighting + $newContents =~ s/\b\Q$from\E(?!\w)/$renames{$from}/g; # this " unconfuses Xcode syntax highlighting } if ($newContents ne $contents) { diff --git a/WebKitTools/Scripts/do-webcore-rename b/WebKitTools/Scripts/do-webcore-rename index 24b14a3..edfe2dc 100755 --- a/WebKitTools/Scripts/do-webcore-rename +++ b/WebKitTools/Scripts/do-webcore-rename @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# Copyright (C) 2006, 2007 Apple Inc. All rights reserved. +# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -43,6 +43,7 @@ my %words; my @paths; find(\&wanted, "JavaScriptCore"); +find(\&wanted, "JavaScriptGlue"); find(\&wanted, "WebCore"); find(\&wanted, "WebKit"); @@ -67,224 +68,91 @@ sub wanted } my %renames = ( - "ArrayInstance" => "JSArray", - "ActivationImp" => "Activation", - "ActivationImpData" => "ActivationData", - "ArrayObjectImp" => "ArrayConstructor", - "ArrayProtoFuncConcat" => "ArrayFunctionConcat", - "ArrayProtoFuncEvery" => "ArrayFunctionEvery", - "ArrayProtoFuncFilter" => "ArrayFunctionFilter", - "ArrayProtoFuncForEach" => "ArrayFunctionForEach", - "ArrayProtoFuncIndexOf" => "ArrayFunctionIndexOf", - "ArrayProtoFuncJoin" => "ArrayFunctionJoin", - "ArrayProtoFuncLastIndexOf" => "ArrayFunctionLastIndexOf", - "ArrayProtoFuncMap" => "ArrayFunctionMap", - "ArrayProtoFuncPop" => "ArrayFunctionPop", - "ArrayProtoFuncPush" => "ArrayFunctionPush", - "ArrayProtoFuncReverse" => "ArrayFunctionReverse", - "ArrayProtoFuncShift" => "ArrayFunctionShift", - "ArrayProtoFuncSlice" => "ArrayFunctionSlice", - "ArrayProtoFuncSome" => "ArrayFunctionSome", - "ArrayProtoFuncSort" => "ArrayFunctionSort", - "ArrayProtoFuncSplice" => "ArrayFunctionSplice", - "ArrayProtoFuncToLocaleString" => "ArrayFunctionToLocaleString", - "ArrayProtoFuncToString" => "ArrayFunctionToString", - "ArrayProtoFuncUnShift" => "ArrayFunctionUnshift", - "BooleanInstance" => "BooleanObject", - "BooleanObjectImp" => "BooleanConstructor", - "BooleanProtoFunc" => "BooleanFunction", - "DateObjectFuncImp" => "DateFunction", - "DateObjectImp" => "DateConstructor", - "DateProtoFuncGetDate" => "DateFunctionGetDate", - "DateProtoFuncGetDay" => "DateFunctionGetDay", - "DateProtoFuncGetFullYear" => "DateFunctionGetFullYear", - "DateProtoFuncGetHours" => "DateFunctionGetHours", - "DateProtoFuncGetMilliSeconds" => "DateFunctionGetMilliSeconds", - "DateProtoFuncGetMinutes" => "DateFunctionGetMinutes", - "DateProtoFuncGetMonth" => "DateFunctionGetMonth", - "DateProtoFuncGetSeconds" => "DateFunctionGetSeconds", - "DateProtoFuncGetTime" => "DateFunctionGetTime", - "DateProtoFuncGetTimezoneOffset" => "DateFunctionGetTimezoneOffset", - "DateProtoFuncGetUTCDate" => "DateFunctionGetUTCDate", - "DateProtoFuncGetUTCDay" => "DateFunctionGetUTCDay", - "DateProtoFuncGetUTCFullYear" => "DateFunctionGetUTCFullYear", - "DateProtoFuncGetUTCHours" => "DateFunctionGetUTCHours", - "DateProtoFuncGetUTCMilliseconds" => "DateFunctionGetUTCMilliseconds", - "DateProtoFuncGetUTCMinutes" => "DateFunctionGetUTCMinutes", - "DateProtoFuncGetUTCMonth" => "DateFunctionGetUTCMonth", - "DateProtoFuncGetUTCSeconds" => "DateFunctionGetUTCSeconds", - "DateProtoFuncGetYear" => "DateFunctionGetYear", - "DateProtoFuncSetDate" => "DateFunctionSetDate", - "DateProtoFuncSetFullYear" => "DateFunctionSetFullYear", - "DateProtoFuncSetHours" => "DateFunctionSetHours", - "DateProtoFuncSetMilliSeconds" => "DateFunctionSetMilliSeconds", - "DateProtoFuncSetMinutes" => "DateFunctionSetMinutes", - "DateProtoFuncSetMonth" => "DateFunctionSetMonth", - "DateProtoFuncSetSeconds" => "DateFunctionSetSeconds", - "DateProtoFuncSetTime" => "DateFunctionSetTime", - "DateProtoFuncSetUTCDate" => "DateFunctionSetUTCDate", - "DateProtoFuncSetUTCFullYear" => "DateFunctionSetUTCFullYear", - "DateProtoFuncSetUTCHours" => "DateFunctionSetUTCHours", - "DateProtoFuncSetUTCMilliseconds" => "DateFunctionSetUTCMilliseconds", - "DateProtoFuncSetUTCMinutes" => "DateFunctionSetUTCMinutes", - "DateProtoFuncSetUTCMonth" => "DateFunctionSetUTCMonth", - "DateProtoFuncSetUTCSeconds" => "DateFunctionSetUTCSeconds", - "DateProtoFuncSetYear" => "DateFunctionSetYear", - "DateProtoFuncToDateString" => "DateFunctionToDateString", - "DateProtoFuncToGMTString" => "DateFunctionToGMTString", - "DateProtoFuncToLocaleDateString" => "DateFunctionToLocaleDateString", - "DateProtoFuncToLocaleString" => "DateFunctionToLocaleString", - "DateProtoFuncToLocaleTimeString" => "DateFunctionToLocaleTimeString", - "DateProtoFuncToString" => "DateFunctionToString", - "DateProtoFuncToTimeString" => "DateFunctionToTimeString", - "DateProtoFuncToUTCString" => "DateFunctionToUTCString", - "DateProtoFuncValueOf" => "DateFunctionValueOf", - "DebuggerImp" => "DebuggerData", - "ErrorObjectImp" => "ErrorConstructor", - "ErrorProtoFuncToString" => "ErrorFunction", - "FRAMES_ON_STACK" => "numFramesOnStack", - "FunctionImp" => "Function", - "FunctionObjectImp" => "FunctionConstructor", - "FunctionProtoFunc" => "FunctionFunction", - "GetterSetterImp" => "GetterSetter", - "GlobalFuncImp" => "GlobalFunction", - "GlobalImp" => "TestGlobalObject", - "HTMLGenericFormElement" => "HTMLFormControlElement", - "HTMLGenericFormElement_h" => "HTMLFormControlElement_h", +); + +my %renamesContemplatedForTheFuture = ( + "StructureID" => "Structure", + "StructureIDChain" => "StructureChain", + "StructureIDs" => "Structures", + "StructureID_h" => "Structure_h", + "StructureIDChain_h" => "StructureChain_h", + "activationStructureID" => "activationStructure", + "createStructureID" => "createStructure", + "currStructureID" => "currStructure", + "derefStructureIDs" => "derefStructures", + "liveStructureIDSet" => "liveStructureSet", + "m_structureID" => "mm_structure", + "newStructureID" => "newStructureID", + "numberStructureID" => "numberStructure", + "oldStructureID" => "oldStructure", + "printStructureIDs" => "printStructures", + "refStructureIDs" => "refStructures", + "repatchGetByIdDefaultStructureID" => "repatchGetByIdDefaultStructure", + "repatchOffsetGetByIdStructureID" => "repatchOffsetGetByIdStructure", + "repatchOffsetPutByIdStructureID" => "repatchOffsetPutByIdStructure", + "sIDC" => "chain", + "setCachedStructureID" => "setCachedStructureID", + "staticScopeStructureID" => "staticScopeStructure", + "stringStructureID" => "stringStructure", + "structureID" => "structure", + "structureIDAddr" => "structureAddress", + "structureIDChain" => "structureChain", + "structureIDCounter" => "structureCounter", + "structureIDInstructionIndex" => "structureInstructionIndex", + "structureIDInstructions" => "structureInstructions", + + "DOMObject" => "JSDOMObject", + + "runtimeObjectGetter" => "pluginElementGetter", + "runtimeObjectPropertyGetter" => "pluginElementPropertyGetter", + "runtimeObjectCustomGetOwnPropertySlot" => "pluginElementCustomGetOwnPropertySlot", + "runtimeObjectCustomPut" => "pluginElementCustomPut", + "runtimeObjectImplementsCall" => "pluginElementImplementsCall", + "runtimeObjectCallAsFunction" => "pluginElementCallAsFunction", + + "CLONE_CONTENTS" => "Clone", + "DELETE_CONTENTS" => "Delete", + "EXTRACT_CONTENTS" => "Extract", + + "DateInstance" => "JSDate", + "ErrorInstance" => "JSError", + "ImageConstructorImp" => "JSImageConstructor", - "InternalFunctionImp" => "InternalFunction", - "JSXMLHttpRequestConstructorImp" => "JSXMLHttpRequestConstructor", + "Navigator" => "JSNavigator", + + "JSHTMLOptionElementConstructor" => "JSOptionConstructor", + "XSLTProcessorPrototypeTable" => "JSXSLTProcessorPrototypeTable", + "KURL" => "URL", "KURLCFNet" => "URLCF", + "KURLHash" => "URLHash", "KURLMac" => "URLMac", "KURL_H_" => "URL_h", - "List" => "ArgumentList", - "MathObjectImp" => "MathObject", - "MathProtoFuncACos" => "MathFunctionACos", - "MathProtoFuncASin" => "MathFunctionASin", - "MathProtoFuncATan" => "MathFunctionATan", - "MathProtoFuncATan2" => "MathFunctionATan2", - "MathProtoFuncAbs" => "MathFunctionAbs", - "MathProtoFuncCeil" => "MathFunctionCeil", - "MathProtoFuncCos" => "MathFunctionCos", - "MathProtoFuncExp" => "MathFunctionExp", - "MathProtoFuncFloor" => "MathFunctionFloor", - "MathProtoFuncLog" => "MathFunctionLog", - "MathProtoFuncMax" => "MathFunctionMax", - "MathProtoFuncMin" => "MathFunctionMin", - "MathProtoFuncPow" => "MathFunctionPow", - "MathProtoFuncRandom" => "MathFunctionRandom", - "MathProtoFuncRound" => "MathFunctionRound", - "MathProtoFuncSin" => "MathFunctionSin", - "MathProtoFuncSqrt" => "MathFunctionSqrt", - "MathProtoFuncTan" => "MathFunctionTan", - "NativeErrorImp" => "NativeErrorConstructor", - "Navigator" => "JSNavigator", - "NumberImp" => "JSNumberCell", - "NumberInstance" => "NumberObject", - "NumberObjectImp" => "NumberConstructor", - "NumberProtoFunc" => "NumberFunction", + + "ThreadSafeShared" => "ThreadSafeRefCounted", + "TreeShared" => "TreeRefCounted", + + "StringImpl" => "SharedString", + + "RenderView" => "RenderViewport", + "ObjcFallbackObjectImp" => "ObjCFallbackObject", - "ObjectObjectImp" => "ObjectConstructor", - "ObjectProtoFunc" => "ObjectFunction", - "RECURSIVE_MATCH_STARTNG_NEW_GROUP" => "RECURSIVE_MATCH_NEW_GROUP", - "RegExpImp" => "RegExpObject", - "RegExpObjectImp" => "RegExpConstructor", - "RegExpObjectImpPrivate" => "RegExpConstructorPrivate", - "RegExpProtoFunc" => "RegExpFunction", "RuntimeObjectImp" => "ForeignObject", - "StringImp" => "JSString", - "StringImpl" => "SharedString", - "StringInstance" => "StringObject", - "StringInstanceThatMasqueradesAsUndefined" => "StringObjectThatMasqueradesAsUndefined", - "StringObjectFuncImp" => "StringConstructorFunction", - "StringObjectImp" => "StringConstructor", - "StringProtoFuncAnchor" => "StringFunctionAnchor", - "StringProtoFuncBig" => "StringFunctionBig", - "StringProtoFuncBlink" => "StringFunctionBlink", - "StringProtoFuncBold" => "StringFunctionBold", - "StringProtoFuncCharAt" => "StringFunctionCharAt", - "StringProtoFuncCharCodeAt" => "StringFunctionCharCodeAt", - "StringProtoFuncConcat" => "StringFunctionConcat", - "StringProtoFuncFixed" => "StringFunctionFixed", - "StringProtoFuncFontcolor" => "StringFunctionFontcolor", - "StringProtoFuncFontsize" => "StringFunctionFontsize", - "StringProtoFuncIndexOf" => "StringFunctionIndexOf", - "StringProtoFuncItalics" => "StringFunctionItalics", - "StringProtoFuncLastIndexOf" => "StringFunctionLastIndexOf", - "StringProtoFuncLink" => "StringFunctionLink", - "StringProtoFuncLocaleCompare" => "StringFunctionLocaleCompare", - "StringProtoFuncMatch" => "StringFunctionMatch", - "StringProtoFuncReplace" => "StringFunctionReplace", - "StringProtoFuncSearch" => "StringFunctionSearch", - "StringProtoFuncSlice" => "StringFunctionSlice", - "StringProtoFuncSmall" => "StringFunctionSmall", - "StringProtoFuncSplit" => "StringFunctionSplit", - "StringProtoFuncStrike" => "StringFunctionStrike", - "StringProtoFuncSub" => "StringFunctionSub", - "StringProtoFuncSubstr" => "StringFunctionSubstr", - "StringProtoFuncSubstring" => "StringFunctionSubstring", - "StringProtoFuncSup" => "StringFunctionSup", - "StringProtoFuncToLocaleLowerCase" => "StringFunctionToLocaleLowerCase", - "StringProtoFuncToLocaleUpperCase" => "StringFunctionToLocaleUpperCase", - "StringProtoFuncToLowerCase" => "StringFunctionToLowerCase", - "StringProtoFuncToString" => "StringFunctionToString", - "StringProtoFuncToUpperCase" => "StringFunctionToUpperCase", - "StringProtoFuncValueOf" => "StringFunctionValueOf", - "TestFunctionImp" => "TestFunction", - "ThreadSafeShared" => "ThreadSafeRefCounted", - "XSLTProcessorConstructorImp" => "JSXSLTProcessorConstructor", - "XSLTProcessorPrototype" => "JSXSLTProcessorPrototype", - "animationController" => "animation", - "branchfirstbyte" => "branchFirstByte", - "branchreqbyte" => "branchReqByte", - "class_charcount" => "classCharCount", - "class_lastchar" => "classLastChar", - "codeptr" => "codePtr", - "domString" => "string", + "equalIgnoringCase" => "equalFoldingCase", - "errorcodeptr" => "errorCodePtr", - "errorptr" => "errorPtr", - "first_byte" => "firstByte", - "first_byte_caseless" => "firstByteIsCaseless", - "first_char" => "firstChar", - "firstbyte" => "firstByte", - "groupsetfirstbyte" => "didGroupSetFirstByte", - "is_quantifier" => "isQuantifier", - "isclass" => "isClass", - "kjs_binding" => "JSDOMBinding", - "kjs_binding_h" => "JSDOMBinding_h", - "kjs_css" => "JSRGBColor", - "kjs_css_h" => "JSRGBColor_h", - "kjs_proxy" => "ScriptController", - "kjs_proxy_h" => "ScriptController_h", - "last_branch" => "lastBranch", - "mclength" => "mcLength", - "negate_class" => "negateClass", - "offsetcount" => "offsetCount", - "op_type" => "opType", - "prev_length" => "prevLength", - "ptrptr" => "ptrPtr", - "repeat_min" => "repeatMin", - "repeat_type" => "repeatType", - "req_byte" => "reqByte", - "req_byte2" => "reqByte2", - "req_byte_caseless" => "reqByteIsCaseless", - "req_caseopt" => "reqCaseOpt", - "req_varyopt" => "reqVaryOpt", - "reqbyte" => "reqByte", - "resetcount" => "resetCount", - "scriptProxy" => "script", - "selectionController" => "selection", - "should_flip_negation" => "shouldFlipNegation", - "skipbytes" => "skipBytes", - "subfirstbyte" => "subFirstByte", - "subreqbyte" => "subReqByte", - "top_backref" => "topBackref", - "top_bracket" => "topBracket", - "using_temporary_offsets" => "usingTemporaryOffsets", - "zerofirstbyte" => "zeroFirstByte", - "zeroreqbyte" => "zeroReqByte", + + "FTPDirectoryTokenizer" => "FTPDirectoryDocumentBuilder", + "HTMLTokenizer" => "HTMLDocumentBuilder", + "ImageTokenizer" => "ImageDocumentBuilder", + "PluginTokenizer" => "PluginDocumentBuilder", + "TextTokenizer" => "TextDocumentBuilder", + "Tokenizer" => "DocumentBuilder", + "Tokenizer_h" => "DocumentBuilder_h", + "XMLTokenizer" => "XMLDocumentBuilder", + "isHTMLTokenizer" => "isHTMLDocumentBuilder", + "m_tokenizer" => "m_builder", + "createTokenizer" => "createBuilder", + "tokenizerProcessedData" => "documentBuilderProcessedData", ); # rename files diff --git a/WebKitTools/Scripts/extract-localizable-strings b/WebKitTools/Scripts/extract-localizable-strings index 15d6782..420624b 100755 --- a/WebKitTools/Scripts/extract-localizable-strings +++ b/WebKitTools/Scripts/extract-localizable-strings @@ -44,14 +44,16 @@ use strict; -my $stringsFile = "English.lproj/Localizable.strings"; -my %isDebugMacro = ( ASSERT_WITH_MESSAGE => 1, LOG_ERROR => 1, ERROR => 1, NSURL_ERROR => 1, FATAL => 1, LOG => 1, dprintf => 1, NSException => 1, NSLog => 1, printf => 1 ); +my %isDebugMacro = ( ASSERT_WITH_MESSAGE => 1, LOG_ERROR => 1, ERROR => 1, NSURL_ERROR => 1, FATAL => 1, LOG => 1, LOG_WARNING => 1, UI_STRING_LOCALIZE_LATER => 1, LPCTSTR_UI_STRING_LOCALIZE_LATER => 1, UNLOCALIZED_STRING => 1, UNLOCALIZED_LPCTSTR => 1, dprintf => 1, NSException => 1, NSLog => 1, printf => 1 ); @ARGV >= 1 or die "Usage: extract-localizable-strings <exceptions file> [ directory... ]\nDid you mean to run extract-webkit-localizable-strings instead?\n"; my $exceptionsFile = shift @ARGV; -f $exceptionsFile or die "Couldn't find exceptions file $exceptionsFile\n"; +my $fileToUpdate = shift @ARGV; +-f $fileToUpdate or die "Couldn't find file to update $fileToUpdate\n"; + my @directories = (); my @directoriesToSkip = (); if (@ARGV < 1) { @@ -164,7 +166,7 @@ handleString: # FIXME: Validate UTF-8 here? $UIString = $string; $expected = ","; - } elsif (($macro eq "UI_STRING_KEY" or $macro eq "LPCTSTR_UI_STRING_KEY") and !defined $key) { + } elsif (($macro =~ /UI_STRING_KEY$/) and !defined $key) { # FIXME: Validate UTF-8 here? $key = $string; $expected = ","; @@ -223,7 +225,7 @@ handleString: $sawError = 1; $expected = ""; } - if ($token eq "UI_STRING" or $token eq "UI_STRING_KEY" or $token eq "LPCTSTR_UI_STRING" or $token eq "LPCTSTR_UI_STRING_KEY") { + if ($token =~ /UI_STRING(_KEY)?$/) { $expected = "("; $macro = $token; $UIString = undef; @@ -325,7 +327,7 @@ print "$NSLocalizeCount uses of NSLocalize\n" if $NSLocalizeCount; print scalar(@unusedExceptions), " unused exceptions\n" if @unusedExceptions; if ($sawError) { - print "\nErrors encountered. Exiting without writing a $stringsFile file.\n"; + print "\nErrors encountered. Exiting without writing to $fileToUpdate.\n"; exit 1; } @@ -338,22 +340,12 @@ for my $key (sort keys %commentByKey) { # Write out the strings file in UTF-16 with a BOM. utf8::decode($localizedStrings) if $^V ge chr(5).chr(8); my $output = pack "n*", (0xFEFF, unpack "U*", $localizedStrings); -foreach my $directory (@directories) { - if (-e "$directory/mac/$stringsFile") { - open STRINGS, ">", "$directory/mac/$stringsFile" or die; - print STRINGS $output; - close STRINGS; - } - - if (-e "$directory/win/$stringsFile") { - open STRINGS, ">", "$directory/win/$stringsFile" or die; - print STRINGS $output; - close STRINGS; - } - if (-e "$directory/$stringsFile") { - open STRINGS, ">", "$directory/$stringsFile" or die; - print STRINGS $output; - close STRINGS; - } +if (-e "$fileToUpdate") { + open STRINGS, ">", "$fileToUpdate" or die; + print STRINGS $output; + close STRINGS; +} else { + print "$fileToUpdate does not exist\n"; + exit 1; } diff --git a/WebKitTools/Scripts/gdb-drosera b/WebKitTools/Scripts/gdb-drosera deleted file mode 100644 index fcde476..0000000 --- a/WebKitTools/Scripts/gdb-drosera +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (C) 2007 Apple Computer, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of -# its contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Simplified "run under gdb" script for Web Kit Open Source Project. - -use strict; -use Getopt::Long; -use FindBin; -use lib $FindBin::Bin; -use webkitdirs; -use File::Temp qw/:mktemp/; - -setConfiguration(); -my $productDir = productDir(); -my $droseraPath = "$productDir/Drosera.app/Contents/MacOS/Drosera"; - -# Check to see that gdb is in the usual place. -my $gdbPath = "/usr/bin/gdb"; -die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath; - -# Check to see that all the frameworks are built. -checkFrameworks(); - -# Put a command to set DYLD_FRAMEWORK_PATH in a temp file. -my ($fh, $path) = mkstemp("/tmp/gdb-drosera-XXXX"); -print $fh "set env DYLD_FRAMEWORK_PATH $productDir\n"; - -# Start up Drosera. -print "Start Drosera under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; -exec $gdbPath, "-x", $path, $droseraPath or die; - -# Delete the temporary file. -unlink0($fh, $path) or die "Error unlinking file $path safely"; - diff --git a/WebKitTools/Scripts/gdb-safari b/WebKitTools/Scripts/gdb-safari index 026856c..f87f965 100755 --- a/WebKitTools/Scripts/gdb-safari +++ b/WebKitTools/Scripts/gdb-safari @@ -26,15 +26,36 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Simplified "run under gdb" script for Web Kit Open Source Project. +# Simplified "run under gdb" script for WebKit Open Source Project. use strict; -use Getopt::Long; +use File::Temp qw/:mktemp/; use FindBin; +use Getopt::Long; use lib $FindBin::Bin; use webkitdirs; -use File::Temp qw/:mktemp/; +my $programName = basename($0); +my $showHelp = 0; +my $run64Bit; + +my $usage = <<EOF; +Usage: $programName [options] + --help Show this help message + --64-bit Run in 64-bit mode +EOF + +my $getOptionsResult = GetOptions( + 'help' => \$showHelp, + '64-bit!' => \$run64Bit +); + +if (!$getOptionsResult || $showHelp) { + print STDERR $usage; + exit 1; +} + +setRun64Bit($run64Bit); setConfiguration(); my $productDir = productDir(); my $safariPath = safariPath(); @@ -47,12 +68,16 @@ die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath; checkFrameworks(); # Put a command to set DYLD_FRAMEWORK_PATH in a temp file. +# Also set WEBKIT_UNSET_DYLD_FRAMEWORK_PATH to YES in this environment, so that +# executables launched by Safari don't inherit using the new frameworks. my ($fh, $path) = mkstemp("/tmp/gdb-safari-XXXX"); print $fh "set env DYLD_FRAMEWORK_PATH $productDir\n"; +print $fh "set env WEBKIT_UNSET_DYLD_FRAMEWORK_PATH YES\n"; +my @architectureFlags = ("-arch", preferredArchitecture()) if isOSX(); # Start up Safari. print "Start Safari under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; -exec $gdbPath, "-x", $path, $safariPath or die; +exec $gdbPath, "-x", $path, @architectureFlags, $safariPath or die; # Delete the temporary file. unlink0($fh, $path) or die "Error unlinking file $path safely"; diff --git a/WebKitTools/Scripts/make-js-test-wrappers b/WebKitTools/Scripts/make-js-test-wrappers index b58978f..4ac21ea 100755 --- a/WebKitTools/Scripts/make-js-test-wrappers +++ b/WebKitTools/Scripts/make-js-test-wrappers @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# Copyright (C) 2006 Apple Computer, Inc. All rights reserved. +# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,23 +29,38 @@ # Script to generate HTML wrappers for JavaScript tests from templates use strict; + use FindBin; use lib $FindBin::Bin; + +use File::Basename; +use File::Find; +use Getopt::Long; use webkitdirs; +sub directoryFilter; +sub findTemplateFiles(@); + +my $showHelp; + +my $result = GetOptions( + "help" => \$showHelp, +); + +if (!$result || $showHelp) { + print STDERR basename($0) . " [-h|--help] [path ...]\n"; + exit 1; +} + setConfiguration(); my $productDir = productDir(); -use strict; - chdirWebKit(); -my @templates = `find LayoutTests -name "TEMPLATE.html"`; +my @templates = findTemplateFiles(@ARGV); for my $tfile (@templates) { - chomp $tfile; - my $tpath = $tfile; $tpath =~ s:/resources/TEMPLATE.html$::; @@ -54,7 +69,11 @@ for my $tfile (@templates) { chdirWebKit(); chdir($tpath); - my @files = `find resources -name "*.js"`; + my @files; + my $fileFilter = sub { + push @files, $File::Find::name if substr($_, -3) eq ".js"; + }; + find({ preprocess => \&directoryFilter, wanted => $fileFilter }, "resources"); open TEMPLATE, "<resources/TEMPLATE.html"; my $template = do { local $/; <TEMPLATE> }; @@ -68,19 +87,31 @@ for my $tfile (@templates) { } for my $file (@files) { - chomp $file; next if $file =~ /js-test-.*\.js$/; next if $file =~ /SVGTestCase\.js/; + + next if $file =~ m:resources/NSResolver-exceptions\.js$:; next if $file =~ m:resources/attr-case-sensitivity\.js$:; + next if $file =~ m:resources/codegen-temporaries-multiple-global-blocks-1\.js$:; + next if $file =~ m:resources/codegen-temporaries-multiple-global-blocks-2\.js$:; + next if $file =~ m:resources/constructors-cached-navigate\.js$:; next if $file =~ m:resources/frame-loading-via-document-write\.js$:; + next if $file =~ m:resources/id-fastpath-almost-strict\.js$:; + next if $file =~ m:resources/id-fastpath-strict\.js$:; next if $file =~ m:resources/intersectsNode\.js$:; + next if $file =~ m:resources/p-in-scope\.js$:; next if $file =~ m:resources/script-element-gc\.js$:; next if $file =~ m:resources/script-element-gc\.js$:; next if $file =~ m:resources/script3\.js$:; next if $file =~ m:resources/script4\.js$:; next if $file =~ m:resources/script5\.js$:; next if $file =~ m:resources/select-options-remove\.js$:; + next if $file =~ m:resources/shadow-offset\.js$:; + next if $file =~ m:resources/tabindex-focus-blur-all\.js$:; + next if $file =~ m:resources/use-instanceRoot-event-bubbling\.js$:; + next if $file =~ m:resources/use-instanceRoot-event-listeners\.js$:; next if $file =~ m:resources/wrapper-identity-base\.js$:; + next if $file =~ m:resources/xhtml-scripts\.js$:; my $html = $file; $html =~ s:resources/(.*)\.js:$1.html:; @@ -101,3 +132,28 @@ for my $tfile (@templates) { close HTML; } } + +exit 0; + +sub directoryFilter +{ + return () if basename($File::Find::dir) eq ".svn"; + return @_; +} + +sub findTemplateFiles(@) { + my @args = @_; + my @templateFiles; + + push @args, "LayoutTests" if scalar(@args) == 0; + + my @paths = map { -f $_ ? dirname($_) : $_ } @args; + + my $fileFilter = sub { + push @templateFiles, $File::Find::name if $_ eq "TEMPLATE.html"; + }; + + find({ preprocess => \&directoryFilter, wanted => $fileFilter }, @paths); + + return @templateFiles; +} diff --git a/WebKitTools/Scripts/pdevenv b/WebKitTools/Scripts/pdevenv index 8072adf..1931211 100755 --- a/WebKitTools/Scripts/pdevenv +++ b/WebKitTools/Scripts/pdevenv @@ -13,7 +13,8 @@ chomp(my $vcBin = `cygpath -w "$FindBin::Bin/../vcbin"`); print $fh "\@echo off\n\n"; print $fh "call \"\%VS80COMNTOOLS\%\\vsvars32.bat\"\n\n"; print $fh "set PATH=$vcBin;\%PATH\%\n\n"; -print $fh "devenv.com /useenv " . join(" ", @ARGV) . "\n"; +print $fh "IF EXIST \"\%VSINSTALLDIR\%\\Common7\\IDE\\devenv.com\" (devenv.com /useenv " . join(" ", @ARGV) . ") ELSE "; +print $fh "VCExpress.exe /useenv " . join(" ", @ARGV) . "\n"; close $fh; diff --git a/WebKitTools/Scripts/prepare-ChangeLog b/WebKitTools/Scripts/prepare-ChangeLog index 913eea5..ff4ce80 100755 --- a/WebKitTools/Scripts/prepare-ChangeLog +++ b/WebKitTools/Scripts/prepare-ChangeLog @@ -82,6 +82,7 @@ sub testListForChangeLog(@); sub get_function_line_ranges($$); sub get_function_line_ranges_for_c($$); sub get_function_line_ranges_for_java($$); +sub get_function_line_ranges_for_javascript($$); sub method_decl_to_selector($); sub processPaths(\@); sub reviewerAndDescriptionForGitCommit($); @@ -174,8 +175,8 @@ if (@changed_files) { if (%changed_line_ranges) { print STDERR " Extracting affected function names from source files.\n"; foreach my $file (keys %changed_line_ranges) { - # Only look for function names in .c files. - next unless $file =~ /\.(c|cpp|m|mm|h|java)/; + # Only look for function names in certain source files. + next unless $file =~ /\.(c|cpp|m|mm|h|java|js)/; # Find all the functions in the file. open SOURCE, $file or next; @@ -386,6 +387,8 @@ sub get_function_line_ranges($$) return get_function_line_ranges_for_c ($file_handle, $file_name); } elsif ($file_name =~ /\.java$/) { return get_function_line_ranges_for_java ($file_handle, $file_name); + } elsif ($file_name =~ /\.js$/) { + return get_function_line_ranges_for_javascript ($file_handle, $file_name); } return (); } @@ -893,6 +896,190 @@ sub get_function_line_ranges_for_java($$) return @ranges; } + + +# Read a file and get all the line ranges of the things that look like +# JavaScript functions. +# +# A function name is the word that immediately follows `function' when +# followed by an open curly brace. It can appear at the top level, or +# inside other functions. +# +# An anonymous function name is the identifier chain immediately before +# an assignment with the equals operator or object notation that has a +# value starting with `function' followed by an open curly brace. +# +# A getter or setter name is the word that immediately follows `get' or +# `set' when followed by an open curly brace . +# +# Comment handling is simple-minded but will work for all but pathological cases. +# +# Result is a list of triples: [ start_line, end_line, function_name ]. + +sub get_function_line_ranges_for_javascript($$) +{ + my ($fileHandle, $fileName) = @_; + + my @currentScopes; + my @currentIdentifiers; + my @currentFunctionNames; + my @currentFunctionDepths; + my @currentFunctionStartLines; + + my @ranges; + + my $inComment = 0; + my $parenthesesDepth = 0; + my $bracesDepth = 0; + + my $functionJustSeen = 0; + my $getterJustSeen = 0; + my $setterJustSeen = 0; + my $assignmentJustSeen = 0; + + my $word = ""; + + while (<$fileHandle>) { + # Handle continued multi-line comment. + if ($inComment) { + next unless s-.*\*/--; + $inComment = 0; + } + + # Handle comments and quoted text. + while (m-(/\*|//|\'|\")-) { # \' and \" keep emacs perl mode happy + my $match = $1; + if ($match eq '/*') { + if (!s-/\*.*?\*/--) { + s-/\*.*--; + $inComment = 1; + } + } elsif ($match eq '//') { + s-//.*--; + } else { # ' or " + if (!s-$match([^\\]|\\.)*?$match--) { + warn "mismatched quotes at line $. in $fileName\n"; + s-$match.*--; + } + } + } + + # Find function names. + while (m-(\w+|[(){}=:;])-g) { + # Open parenthesis. + if ($1 eq '(') { + $parenthesesDepth++; + next; + } + + # Close parenthesis. + if ($1 eq ')') { + $parenthesesDepth--; + next; + } + + # Open brace. + if ($1 eq '{') { + push(@currentScopes, join(".", @currentIdentifiers)); + @currentIdentifiers = (); + + $bracesDepth++; + next; + } + + # Close brace. + if ($1 eq '}') { + $bracesDepth--; + + if (@currentFunctionDepths and $bracesDepth == $currentFunctionDepths[$#currentFunctionDepths]) { + pop(@currentFunctionDepths); + + my $currentFunction = pop(@currentFunctionNames); + my $start = pop(@currentFunctionStartLines); + + push(@ranges, [$start, $., $currentFunction]); + } + + pop(@currentScopes); + @currentIdentifiers = (); + + next; + } + + # Semicolon. + if ($1 eq ';') { + @currentIdentifiers = (); + next; + } + + # Function. + if ($1 eq 'function') { + $functionJustSeen = 1; + + if ($assignmentJustSeen) { + my $currentFunction = join('.', (@currentScopes, @currentIdentifiers)); + $currentFunction =~ s/\.{2,}/\./g; # Removes consecutive periods. + + push(@currentFunctionNames, $currentFunction); + push(@currentFunctionDepths, $bracesDepth); + push(@currentFunctionStartLines, $.); + } + + next; + } + + # Getter prefix. + if ($1 eq 'get') { + $getterJustSeen = 1; + next; + } + + # Setter prefix. + if ($1 eq 'set') { + $setterJustSeen = 1; + next; + } + + # Assignment operator. + if ($1 eq '=' or $1 eq ':') { + $assignmentJustSeen = 1; + next; + } + + next if $parenthesesDepth; + + # Word. + $word = $1; + $word = "get $word" if $getterJustSeen; + $word = "set $word" if $setterJustSeen; + + if (($functionJustSeen and !$assignmentJustSeen) or $getterJustSeen or $setterJustSeen) { + push(@currentIdentifiers, $word); + + my $currentFunction = join('.', (@currentScopes, @currentIdentifiers)); + $currentFunction =~ s/\.{2,}/\./g; # Removes consecutive periods. + + push(@currentFunctionNames, $currentFunction); + push(@currentFunctionDepths, $bracesDepth); + push(@currentFunctionStartLines, $.); + } elsif ($word ne 'if' and $word ne 'for' and $word ne 'do' and $word ne 'while' and $word ne 'which' and $word ne 'var') { + push(@currentIdentifiers, $word); + } + + $functionJustSeen = 0; + $getterJustSeen = 0; + $setterJustSeen = 0; + $assignmentJustSeen = 0; + } + } + + warn "mismatched braces in $fileName\n" if $bracesDepth; + warn "mismatched parentheses in $fileName\n" if $parenthesesDepth; + + return @ranges; +} + + sub processPaths(\@) { my ($paths) = @_; @@ -947,7 +1134,7 @@ sub diffCommand(@) if ($isSVN) { $command = "$SVN diff --diff-cmd diff -x -N $pathsString"; } elsif ($isGit) { - $command = "$GIT diff " . diffFromToString(); + $command = "$GIT diff -U0 " . diffFromToString(); $command .= " -- $pathsString" unless $gitCommit; } @@ -1065,8 +1252,10 @@ sub generateFileList(\@\@\%) } elsif (isConflictStatus($status)) { push @{$conflictFiles}, $file; } - my $description = statusDescription($status, $original); - $functionLists->{$file} = $description if defined $description; + if (basename($file) ne "ChangeLog") { + my $description = statusDescription($status, $original); + $functionLists->{$file} = $description if defined $description; + } } close STAT; } @@ -1156,18 +1345,9 @@ sub extractLineRange($) if ($isSVN && $string =~ /^\d+(,\d+)?[acd](\d+)(,(\d+))?/) { $start = $2; $end = $4 || $2; - } elsif ($isGit && $string =~ /^@@ -\d+,\d+ \+(\d+),(\d+) @@/) { - $start = $1; - $end = $1 + $2 - 1; - - # git-diff shows 3 lines of context above and below the actual changes, - # so we need to subtract that context to find the actual changed range. - - # FIXME: This won't work if there's a change at the very beginning or - # very end of a file. - - $start += 3; - $end -= 6; + } elsif ($isGit && $string =~ /^@@ -\d+(,\d+)? \+(\d+)(,(\d+))? @@/) { + $start = $2; + $end = defined($4) ? $4 + $2 - 1 : $2; } return ($start, $end); diff --git a/WebKitTools/Scripts/print-msvc-project-dependencies b/WebKitTools/Scripts/print-msvc-project-dependencies new file mode 100755 index 0000000..dbc8402 --- /dev/null +++ b/WebKitTools/Scripts/print-msvc-project-dependencies @@ -0,0 +1,143 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2008 Apple Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +use strict; +use File::Basename; + +sub printDependencyTree($); + +my $basename = basename($0); +@ARGV or die "Usage: $basename sln1 [sln2 sln3...]"; + +foreach my $sln (@ARGV) { + printDependencyTree($sln); +} + +exit; + +sub printDependencyTree($) +{ + my ($sln) = @_; + + unless (-f $sln) { + warn "Warning: Can't find $sln; skipping\n"; + return; + } + + unless (open SLN, "<", $sln) { + warn "Warning: Can't open $sln; skipping\n"; + return; + } + + my %projectsByUUID = (); + my $currentProject; + + my $state = "initial"; + foreach my $line (<SLN>) { + if ($state eq "initial") { + if ($line =~ /^Project\([^\)]+\) = "([^"]+)", "[^"]+", "([^"]+)"\r?$/) { + my $name = $1; + my $uuid = $2; + if (exists $projectsByUUID{$uuid}) { + warn "Warning: Project $name appears more than once in $sln; using first definition\n"; + next; + } + $currentProject = { + name => $name, + uuid => $uuid, + dependencies => {}, + }; + $projectsByUUID{$uuid} = $currentProject; + + $state = "inProject"; + } + + next; + } + + if ($state eq "inProject") { + defined($currentProject) or die; + + if ($line =~ /^\s*ProjectSection\(ProjectDependencies\) = postProject\r?$/) { + $state = "inDependencies"; + } elsif ($line =~ /^EndProject\r?$/) { + $currentProject = undef; + $state = "initial"; + } + + next; + } + + if ($state eq "inDependencies") { + defined($currentProject) or die; + + if ($line =~ /^\s*({[^}]+}) = ({[^}]+})\r?$/) { + my $uuid1 = $1; + my $uuid2 = $2; + if (exists $currentProject->{dependencies}->{$uuid1}) { + warn "Warning: UUID $uuid1 listed more than once as dependency of project ", $currentProject->{name}, "\n"; + next; + } + + $uuid1 eq $uuid2 or warn "Warning: UUIDs in depedency section of project ", $currentProject->{name}, " don't match: $uuid1 $uuid2; using first UUID\n"; + + $currentProject->{dependencies}->{$uuid1} = 1; + } elsif ($line =~ /^\s*EndProjectSection\r?$/) { + $state = "inProject"; + } + + next; + } + } + + close SLN or warn "Warning: Can't close $sln\n"; + + my %projectsNotDependedUpon = %projectsByUUID; + CANDIDATE: foreach my $candidateUUID (keys %projectsByUUID) { + foreach my $projectUUID (keys %projectsByUUID) { + next if $candidateUUID eq $projectUUID; + foreach my $dependencyUUID (keys %{$projectsByUUID{$projectUUID}->{dependencies}}) { + if ($candidateUUID eq $dependencyUUID) { + delete $projectsNotDependedUpon{$candidateUUID}; + next CANDIDATE; + } + } + } + } + + foreach my $project (values %projectsNotDependedUpon) { + printProjectAndDependencies($project, 0, \%projectsByUUID); + } +} + +sub printProjectAndDependencies +{ + my ($project, $indentLevel, $projectsByUUID) = @_; + + print " " x $indentLevel, $project->{name}, "\n"; + foreach my $dependencyUUID (keys %{$project->{dependencies}}) { + printProjectAndDependencies($projectsByUUID->{$dependencyUUID}, $indentLevel + 1, $projectsByUUID); + } +} diff --git a/WebKitTools/Scripts/resolve-ChangeLogs b/WebKitTools/Scripts/resolve-ChangeLogs index fa01243..58471ec 100755 --- a/WebKitTools/Scripts/resolve-ChangeLogs +++ b/WebKitTools/Scripts/resolve-ChangeLogs @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# Copyright (C) 2007 Apple Inc. All rights reserved. +# Copyright (C) 2007, 2008 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -34,73 +34,82 @@ use FindBin; use lib $FindBin::Bin; use File::Basename; +use File::Path; use File::Spec; use Getopt::Long; +use POSIX; use VCSUtils; sub conflictFiles($); +sub findChangeLog($); sub fixChangeLogPatch($); +sub fixMergedChangeLogs($;@); +sub fixOneMergedChangeLog($); sub mergeChanges($$$); +sub parseFixMerged($$;$); +sub removeChangeLogArguments(); +sub resolveChangeLog($); sub resolveConflict($); sub showStatus($;$); +sub usageAndExit(); my $SVN = "svn"; my $GIT = "git"; +my $fixMerged; my $printWarnings = 1; my $showHelp; my $getOptionsResult = GetOptions( + 'f|fix-merged:s' => \&parseFixMerged, 'h|help' => \$showHelp, 'w|warnings!' => \$printWarnings, ); -sub findChangeLog { - return $_ if basename($_) eq "ChangeLog"; +my @changeLogFiles = removeChangeLogArguments(); - my $file = File::Spec->catfile($_, "ChangeLog"); - return $file if -d $_ and -e $file; - - return undef; -} - -my @changeLogFiles = grep { defined $_ } map { findChangeLog($_) } @ARGV; - -if (scalar(@changeLogFiles) != scalar(@ARGV)) { +if (scalar(@ARGV) > 0) { print STDERR "ERROR: Files listed on command-line that are not ChangeLogs.\n"; undef $getOptionsResult; -} elsif (scalar(@changeLogFiles) == 0) { +} elsif (!defined $fixMerged && scalar(@changeLogFiles) == 0) { print STDERR "ERROR: No ChangeLog files listed on command-line.\n"; undef $getOptionsResult; +} elsif (defined $fixMerged && !isGit()) { + print STDERR "ERROR: --fix-merged may only be used with a git repository\n"; + undef $getOptionsResult; } -if (!$getOptionsResult || $showHelp) { +sub usageAndExit() +{ print STDERR <<__END__; Usage: @{[ basename($0) ]} [options] path/to/ChangeLog [path/to/another/ChangeLog ...] - -h|--help show this help message - -w|--[no-]warnings show or suppress warnings (default: show warnings) + -f|--fix-merged [revision-range] fix git-merged ChangeLog entries; if a revision-range + is specified, run git filter-branch on the range + -h|--help show this help message + -w|--[no-]warnings show or suppress warnings (default: show warnings) __END__ exit 1; } -for my $file (@changeLogFiles) { - my ($fileMine, $fileOlder, $fileNewer) = conflictFiles($file); - if (!$fileMine || !$fileOlder || !$fileNewer) { - next; - } - if (mergeChanges($fileMine, $fileOlder, $fileNewer)) { - if ($file ne $fileNewer) { - unlink($file); - rename($fileNewer, $file) || die; +if (!$getOptionsResult || $showHelp) { + usageAndExit(); +} + +if (defined $fixMerged && length($fixMerged) > 0) { + my $commitRange = $fixMerged; + $commitRange = $commitRange . "..HEAD" if index($commitRange, "..") < 0; + fixMergedChangeLogs($commitRange, @changeLogFiles); +} elsif (@changeLogFiles) { + for my $file (@changeLogFiles) { + if (defined $fixMerged) { + fixOneMergedChangeLog($file); + } else { + resolveChangeLog($file); } - unlink($fileMine, $fileOlder); - resolveConflict($file); - showStatus($file, 1); - } else { - showStatus($file); - print STDERR "WARNING: ${file} could not be merged using fuzz level 3.\n" if $printWarnings; - unlink($fileMine, $fileOlder, $fileNewer) if isGit(); } +} else { + print STDERR "ERROR: Unknown combination of switches and arguments.\n"; + usageAndExit(); } exit 0; @@ -176,6 +185,15 @@ sub conflictFiles($) return ($fileMine, $fileOlder, $fileNewer); } +sub findChangeLog($) { + return $_[0] if basename($_[0]) eq "ChangeLog"; + + my $file = File::Spec->catfile($_[0], "ChangeLog"); + return $file if -d $_[0] and -e $file; + + return undef; +} + sub fixChangeLogPatch($) { my $patch = shift; @@ -227,6 +245,96 @@ sub fixChangeLogPatch($) return $newPatch; } +sub fixMergedChangeLogs($;@) +{ + my $revisionRange = shift; + my @changedFiles = @_; + + if (scalar(@changedFiles) < 1) { + # Read in list of files changed in $revisionRange + open GIT, "-|", $GIT, "diff", "--name-only", $revisionRange || die; + push @changedFiles, <GIT>; + close GIT || die; + die "No changed files in $revisionRange" if scalar(@changedFiles) < 1; + chomp @changedFiles; + } + + my @changeLogs = grep { defined $_ } map { findChangeLog($_) } @changedFiles; + die "No changed ChangeLog files in $revisionRange" if scalar(@changeLogs) < 1; + + system("$GIT filter-branch --tree-filter 'PREVIOUS_COMMIT=\`$GIT rev-parse \$GIT_COMMIT^\` && MAPPED_PREVIOUS_COMMIT=\`map \$PREVIOUS_COMMIT\` $0 -f \"" . join('" "', @changeLogs) . "\"' $revisionRange"); + + # On success, remove the backup refs directory + if (WEXITSTATUS($?) == 0) { + rmtree(qw(.git/refs/original)); + } +} + +sub fixOneMergedChangeLog($) +{ + my $file = shift; + my $patch; + + # Read in patch for incorrectly merged ChangeLog entry + { + local $/ = undef; + open GIT, "-|", $GIT, "diff", ($ENV{GIT_COMMIT} || "HEAD") . "^", $file || die; + $patch = <GIT>; + close GIT || die; + } + + # Always checkout the previous commit's copy of the ChangeLog + system($GIT, "checkout", $ENV{MAPPED_PREVIOUS_COMMIT} || "HEAD^", $file); + + # The patch must have 0 or more lines of context, then 1 or more lines + # of additions, and then 1 or more lines of context. If not, we skip it. + if ($patch =~ /\n@@ -(\d+),(\d+) \+(\d+),(\d+) @@\n( .*\n)*((\+.*\n)+)( .*\n)+$/m) { + # Copy the header from the original patch. + my $newPatch = substr($patch, 0, index($patch, "@@ -${1},${2} +${3},${4} @@")); + + # Generate a new set of line numbers and patch lengths. Our new + # patch will start with the lines for the fixed ChangeLog entry, + # then have 3 lines of context from the top of the current file to + # make the patch apply cleanly. + $newPatch .= "@@ -1,3 +1," . ($4 - $2 + 3) . " @@\n"; + + # We assume that top few lines of the ChangeLog entry are actually + # at the bottom of the list of added lines (due to the way the patch + # algorithm works), so we simply search through the lines until we + # find the date line, then move the rest of the lines to the top. + my @patchLines = map { $_ . "\n" } split(/\n/, $6); + foreach my $i (0 .. $#patchLines) { + if ($patchLines[$i] =~ /^\+\d{4}-\d{2}-\d{2} /) { + unshift(@patchLines, splice(@patchLines, $i, scalar(@patchLines) - $i)); + last; + } + } + + $newPatch .= join("", @patchLines); + + # Add 3 lines of context to the end + open FILE, "<", $file || die; + for (my $i = 0; $i < 3; $i++) { + $newPatch .= " " . <FILE>; + } + close FILE; + + # Apply the new patch + open(PATCH, "| patch -p1 $file > /dev/null") || die; + print PATCH $newPatch; + close(PATCH) || die; + + # Run "git add" on the fixed ChangeLog file + system($GIT, "add", $file); + + showStatus($file, 1); + } elsif ($patch) { + # Restore the current copy of the ChangeLog file since we can't repatch it + system($GIT, "checkout", $ENV{GIT_COMMIT} || "HEAD", $file); + print STDERR "WARNING: Last change to ${file} could not be fixed and re-merged.\n" if $printWarnings; + } +} + sub mergeChanges($$$) { my ($fileMine, $fileOlder, $fileNewer) = @_; @@ -276,6 +384,61 @@ sub mergeChanges($$$) return $result; } +sub parseFixMerged($$;$) +{ + my ($switchName, $key, $value) = @_; + if (defined $key) { + if (defined findChangeLog($key)) { + unshift(@ARGV, $key); + $fixMerged = ""; + } else { + $fixMerged = $key; + } + } else { + $fixMerged = ""; + } +} + +sub removeChangeLogArguments() +{ + my @results = (); + + for (my $i = 0; $i < scalar(@ARGV); ) { + my $file = findChangeLog($ARGV[$i]); + if (defined $file) { + splice(@ARGV, $i, 1); + push @results, $file; + } else { + $i++; + } + } + + return @results; +} + +sub resolveChangeLog($) +{ + my ($file) = @_; + + my ($fileMine, $fileOlder, $fileNewer) = conflictFiles($file); + + return unless $fileMine && $fileOlder && $fileNewer; + + if (mergeChanges($fileMine, $fileOlder, $fileNewer)) { + if ($file ne $fileNewer) { + unlink($file); + rename($fileNewer, $file) || die; + } + unlink($fileMine, $fileOlder); + resolveConflict($file); + showStatus($file, 1); + } else { + showStatus($file); + print STDERR "WARNING: ${file} could not be merged using fuzz level 3.\n" if $printWarnings; + unlink($fileMine, $fileOlder, $fileNewer) if isGit(); + } +} + sub resolveConflict($) { my ($file) = @_; diff --git a/WebKitTools/Scripts/run-drosera b/WebKitTools/Scripts/run-drosera deleted file mode 100644 index 925293c..0000000 --- a/WebKitTools/Scripts/run-drosera +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (C) 2005, 2007 Apple Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of -# its contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Simplified "run" script for Web Kit Open Source Project. - -use strict; -use FindBin; -use lib $FindBin::Bin; -use webkitdirs; - -setConfiguration(); - -# Check to see that all the frameworks are built. -checkFrameworks(); - -exit exitStatus(runDrosera()); diff --git a/WebKitTools/Scripts/run-drosera-nightly.cmd b/WebKitTools/Scripts/run-drosera-nightly.cmd deleted file mode 100644 index 4f547fb..0000000 --- a/WebKitTools/Scripts/run-drosera-nightly.cmd +++ /dev/null @@ -1,12 +0,0 @@ -@echo off -set script="%TMP%\run-drosera-nightly2.cmd" -set vsvars="%VS80COMNTOOLS%\vsvars32.bat" -if exist %vsvars% ( - copy %vsvars% "%script%" -) else ( - del "%script%" -) - -FindSafari.exe %1 /printSafariEnvironment >> "%script%" -echo Drosera.exe >> "%script%" -call %script% diff --git a/WebKitTools/Scripts/run-drosera.cmd b/WebKitTools/Scripts/run-drosera.cmd deleted file mode 100755 index 3b6e1f0..0000000 --- a/WebKitTools/Scripts/run-drosera.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -set script="%TMP%\run-drosera2.cmd" -FindSafari.exe %1 /printSafariEnvironment > "%script%" -call %script% -Drosera.exe diff --git a/WebKitTools/Scripts/run-iexploder-tests b/WebKitTools/Scripts/run-iexploder-tests index 6acff18..f5e8a6c 100755 --- a/WebKitTools/Scripts/run-iexploder-tests +++ b/WebKitTools/Scripts/run-iexploder-tests @@ -41,7 +41,7 @@ use webkitdirs; sub openHTTPDIfNeeded(); sub closeHTTPD(); -sub runSafari(); +sub runSafariWithIExploder(); # Argument handling my $guardMalloc = ''; @@ -69,7 +69,7 @@ if ($downloadTest) { system "/usr/bin/curl -o ~/Desktop/iexploder$downloadTest.html \"http://127.0.0.1:$httpdPort/iexploder.cgi?lookup=1&test=$downloadTest\""; print "Saved the test as iexploder$downloadTest.html on the desktop\n"; } else { - runSafari(); + runSafariWithIExploder(); print "Last generated tests:\n"; system "grep 'iexploder.cgi' /tmp/WebKit/access_log.txt | tail -n -5 | awk -F'[ =&\\?]' '{if (\$8 == \"lookup\") print \$11; else print \$9}'"; } @@ -77,7 +77,7 @@ if ($downloadTest) { closeHTTPD(); -sub runSafari() +sub runSafariWithIExploder() { my $redirectTo; if (@ARGV) { @@ -134,6 +134,7 @@ sub openHTTPDIfNeeded() $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|; my $documentRoot = "$iExploderDirectory/htdocs"; my $typesConfig = "$testDirectory/http/conf/mime.types"; + my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem"; my $listen = "127.0.0.1:$httpdPort"; open2(\*HTTPDIN, \*HTTPDOUT, $httpdPath, @@ -143,6 +144,7 @@ sub openHTTPDIfNeeded() "-c", "TypesConfig \"$typesConfig\"", "-c", "CustomLog \"/tmp/WebKit/access_log.txt\" common", "-c", "ErrorLog \"/tmp/WebKit/error_log.txt\"", + "-c", "SSLCertificateFile \"$sslCertificate\"", # Apache wouldn't run CGIs with permissions==700 otherwise "-c", "User \"#$<\""); diff --git a/WebKitTools/Scripts/run-javascriptcore-tests b/WebKitTools/Scripts/run-javascriptcore-tests index b47d630..afd0ab4 100755 --- a/WebKitTools/Scripts/run-javascriptcore-tests +++ b/WebKitTools/Scripts/run-javascriptcore-tests @@ -56,16 +56,20 @@ $configuration = configuration(); my @jsArgs; my @xcodeArgs; my $root; +my $run64Bit; # pre-evaluate arguments. jsDriver args have - preceding, xcode args do not. # special arguments # --root=<path to webkit root> use pre-built root # --gtk build gtk +# --no-64-bit or --64-bit foreach my $arg(@ARGV) { print $arg."\n"; if( $arg =~ /root=(.*)/ ){ $root = $1; } elsif( $arg =~ /^--gtk$/i || $arg =~ /^--qt$/i || $arg =~ /^--wx$/i ){ + } elsif( $arg =~ /(no-)?64-bit/ ) { + $run64Bit = !defined($1); } elsif( $arg =~ /^-/ or !($arg =~/=/)){ push( @jsArgs, $arg ); } else { @@ -75,19 +79,30 @@ foreach my $arg(@ARGV) { setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root)); +if (isOSX() && !isTiger()) { + my $preferredArch = preferredArchitecture("JavaScriptCore"); + setRun64Bit($run64Bit); + my $arch = preferredArchitecture("JavaScriptCore"); + if ($arch ne $preferredArch) { + push(@jsArgs, "-a", $arch); + } +} + if(!defined($root)){ chdirWebKit(); - my @args; - push(@args, "--" . $configuration); + push(@xcodeArgs, "--" . $configuration); # FIXME: These should be stored per-config and ignored here push(@xcodeArgs, "--qt") if isQt(); push(@xcodeArgs, "--gtk") if isGtk(); push(@xcodeArgs, "--wx") if isWx(); - my $buildResult = system "perl", "WebKitTools/Scripts/build-testkjs", @xcodeArgs; + my $arch = preferredArchitecture("JavaScriptCore"); + push(@xcodeArgs, "ARCHS=$arch") if (isOSX()); + + my $buildResult = system "perl", "WebKitTools/Scripts/build-jsc", @xcodeArgs; if ($buildResult) { - print STDERR "Compiling testkjs failed!\n"; + print STDERR "Compiling jsc failed!\n"; exit exitStatus($buildResult); } } @@ -98,20 +113,20 @@ chdir("JavaScriptCore"); my $productDir = productDir(); chdir "tests/mozilla" or die; - -$productDir .= "/JavaScriptCore" if (isQt() or isGtk()); +$productDir .= "/JavaScriptCore" if isQt(); +$productDir .= "/Programs" if isGtk(); $ENV{DYLD_FRAMEWORK_PATH} = $productDir; setPathForRunningWebKitApp(\%ENV) if isCygwin(); -sub testKJSPath($) +sub jscPath($) { my ($productDir) = @_; - my $testkjsName = "testkjs"; - $testkjsName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); - return "$productDir/$testkjsName"; + my $jscName = "jsc"; + $jscName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); + return "$productDir/$jscName"; } -my $result = system "perl", "jsDriver.pl", "-e", "kjs", "-s", testKJSPath($productDir), "-f", "actual.html", @jsArgs; +my $result = system "perl", "jsDriver.pl", "-e", "squirrelfish", "-s", jscPath($productDir), "-f", "actual.html", @jsArgs; exit exitStatus($result) if $result; my %failures; diff --git a/WebKitTools/Scripts/run-testkjs b/WebKitTools/Scripts/run-jsc index 5610bad..20dc5e8 100755 --- a/WebKitTools/Scripts/run-testkjs +++ b/WebKitTools/Scripts/run-jsc @@ -26,7 +26,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# This script runs a list of scripts through testkjs a specified number of times. +# This script runs a list of scripts through jsc a specified number of times. use strict; use warnings; @@ -35,7 +35,7 @@ use lib $FindBin::Bin; use Getopt::Long; use webkitdirs; -my $usage = "Usage: run-testkjs [--count run_count] [--verbose] shell_file [file2...]"; +my $usage = "Usage: run-jsc [--count run_count] [--verbose] shell_file [file2...]"; my $count = 1; my $verbose = 0; @@ -43,15 +43,15 @@ GetOptions("count|c=i" => \$count, "verbose|v" => \$verbose); die "$usage\n" if (@ARGV < 1); -my $testkjs = productDir() . "/testkjs @ARGV"; -$testkjs .= " 2> /dev/null" unless $verbose; +my $jsc = productDir() . "/jsc @ARGV"; +$jsc .= " 2> /dev/null" unless $verbose; my $dyld = productDir(); $ENV{"DYLD_FRAMEWORK_PATH"} = $dyld; -print STDERR "Running $count time(s): DYLD_FRAMEWORK_PATH=$dyld $testkjs\n"; +print STDERR "Running $count time(s): DYLD_FRAMEWORK_PATH=$dyld $jsc\n"; while ($count--) { - if (system("$testkjs") != 0) { + if (system("$jsc") != 0) { last; } } diff --git a/WebKitTools/Scripts/run-launcher b/WebKitTools/Scripts/run-launcher index 60f3c86..f2b58cb 100755 --- a/WebKitTools/Scripts/run-launcher +++ b/WebKitTools/Scripts/run-launcher @@ -27,7 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Simplified "run" script for Web Kit Open Source Project. +# Simplified "run" script for WebKit Open Source Project. use strict; use File::Spec::Functions qw/catdir/; @@ -45,26 +45,21 @@ my @args = @ARGV; checkFrameworks(); # Set paths according to the build system used -if (!$ENV{WEBKITAUTOTOOLS}) { +if (isQt()) { my $libDir = catdir(productDir(), 'lib'); - - if (isGtk()) { - $launcherPath = catdir($launcherPath, "WebKitTools", "GtkLauncher", "GtkLauncher"); - # Strip --gtk from the arg-list, since otherwise GtkLauncher will try to - # interpret it as a URL. - @args = grep(!/^(--gtk)$/, @args); - } elsif (isQt()) { - $launcherPath = catdir($launcherPath, "bin", "QtLauncher"); - } + $launcherPath = catdir($launcherPath, "bin", "QtLauncher"); # Set up LD_LIBRARY_PATH to point to the product directory. print "Starting webkit launcher with LD_LIBRARY_PATH set to point to built WebKit in $libDir.\n"; - + $ENV{LD_LIBRARY_PATH} = $ENV{LD_LIBRARY_PATH} ? "$libDir:$ENV{LD_LIBRARY_PATH}" : $libDir; + $ENV{DYLD_LIBRARY_PATH} = $ENV{DYLD_LIBRARY_PATH} ? "$libDir:$ENV{DYLD_LIBRARY_PATH}" : $libDir; } else { if (isGtk()) { $launcherPath = catdir($launcherPath, "Programs", "GtkLauncher"); + # Strip --gtk from the arg-list, since otherwise GtkLauncher will try to + # interpret it as a URL. @args = grep(!/^(--gtk)$/, @args); } diff --git a/WebKitTools/Scripts/run-mangleme-tests b/WebKitTools/Scripts/run-mangleme-tests index 78b5d14..93b7894 100755 --- a/WebKitTools/Scripts/run-mangleme-tests +++ b/WebKitTools/Scripts/run-mangleme-tests @@ -41,7 +41,7 @@ use webkitdirs; sub openHTTPDIfNeeded(); sub closeHTTPD(); -sub runSafari(); +sub runSafariWithMangleme(); # Argument handling my $guardMalloc = ''; @@ -72,7 +72,7 @@ if ($downloadTest) { system "/usr/bin/curl -o ~/Desktop/mangleme$downloadTest.html http://127.0.0.1:$httpdPort/remangle.cgi?$downloadTest"; print "Saved the test as mangleme$downloadTest.html on the desktop\n"; } else { - runSafari(); + runSafariWithMangleme(); print "Last generated tests:\n"; system "grep 'Mangle attempt' /tmp/WebKit/error_log.txt | tail -n -5 | awk ' {print \$4}'"; } @@ -80,7 +80,7 @@ if ($downloadTest) { closeHTTPD(); -sub runSafari() +sub runSafariWithMangleme() { my $redirectTo; if (@ARGV) { @@ -137,6 +137,7 @@ sub openHTTPDIfNeeded() $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|; my $documentRoot = "$manglemeDirectory"; my $typesConfig = "$testDirectory/http/conf/mime.types"; + my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem"; my $listen = "127.0.0.1:$httpdPort"; open2(\*HTTPDIN, \*HTTPDOUT, $httpdPath, @@ -146,6 +147,7 @@ sub openHTTPDIfNeeded() "-c", "TypesConfig \"$typesConfig\"", "-c", "CustomLog \"/tmp/WebKit/access_log.txt\" common", "-c", "ErrorLog \"/tmp/WebKit/error_log.txt\"", + "-c", "SSLCertificateFile \"$sslCertificate\"", # Apache wouldn't run CGIs with permissions==700 otherwise "-c", "User \"#$<\""); diff --git a/WebKitTools/Scripts/run-safari b/WebKitTools/Scripts/run-safari index 4474b69..f31fed3 100755 --- a/WebKitTools/Scripts/run-safari +++ b/WebKitTools/Scripts/run-safari @@ -26,13 +26,35 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Simplified "run" script for Web Kit Open Source Project. +# Simplified "run" script for WebKit Open Source Project. use strict; use FindBin; +use Getopt::Long qw(:config pass_through); use lib $FindBin::Bin; use webkitdirs; +my $programName = basename($0); +my $showHelp = 0; +my $run64Bit; + +my $usage = <<EOF; +Usage: $programName [options] + --help Show this help message + --64-bit Run in 64-bit mode +EOF + +my $getOptionsResult = GetOptions( + 'help' => \$showHelp, + '64-bit!' => \$run64Bit +); + +if (!$getOptionsResult || $showHelp) { + print STDERR $usage; + exit 1; +} + +setRun64Bit($run64Bit); setConfiguration(); # Check to see that all the frameworks are built. diff --git a/WebKitTools/Scripts/run-sunspider b/WebKitTools/Scripts/run-sunspider index 8dfeabb..2e58418 100755 --- a/WebKitTools/Scripts/run-sunspider +++ b/WebKitTools/Scripts/run-sunspider @@ -41,6 +41,8 @@ my $testRuns = 10; # This number may be different from what sunspider defaults t my $runShark = 0; my $runShark20 = 0; my $runSharkCache = 0; +my $ubench = 0; +my $v8 = 0; my $setBaseline = 0; my $showHelp = 0; my $testsPattern; @@ -56,14 +58,18 @@ Usage: $programName [options] [options to pass to build system] --shark Sample with the Mac OS X "Shark" performance testing tool (implies --runs=1) --shark20 Like --shark, but with a 20 microsecond sampling interval --shark-cache Like --shark, but performs a L2 cache-miss sample instead of time sample + --ubench Use microbenchmark suite instead of regular tests (to check for core execution regressions) + --v8 Use the V8 benchmark suite. EOF -GetOptions('root=s' => sub { my ($value) = @_; $root = $value; setConfigurationProductDir(Cwd::abs_path($root)); }, +GetOptions('root=s' => sub { my ($x, $value) = @_; $root = $value; setConfigurationProductDir(Cwd::abs_path($root)); }, 'runs=i' => \$testRuns, 'set-baseline' => \$setBaseline, 'shark' => \$runShark, 'shark20' => \$runShark20, 'shark-cache' => \$runSharkCache, + 'ubench' => \$ubench, + 'v8' => \$v8, 'tests=s' => \$testsPattern, 'help' => \$showHelp); @@ -72,15 +78,15 @@ if ($showHelp) { exit 1; } -sub buildTestKJS +sub buildJSC { if (!defined($root)){ push(@ARGV, "--" . $configuration); chdirWebKit(); - my $buildResult = system "WebKitTools/Scripts/build-testkjs", @ARGV; + my $buildResult = system "WebKitTools/Scripts/build-jsc", @ARGV; if ($buildResult) { - print STDERR "Compiling testkjs failed!\n"; + print STDERR "Compiling jsc failed!\n"; exit exitStatus($buildResult); } } @@ -94,15 +100,15 @@ sub setupEnvironmentForExecution($) # FIXME: Other platforms may wish to augment this method to use LD_LIBRARY_PATH, etc. } -sub testKJSPath($) +sub jscPath($) { my ($productDir) = @_; - my $testkjsName = "testkjs"; - $testkjsName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); - return "$productDir/$testkjsName"; + my $jscName = "jsc"; + $jscName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); + return "$productDir/$jscName"; } -buildTestKJS(); +buildJSC(); chdirWebKit(); chdir("SunSpider"); @@ -112,12 +118,14 @@ my $productDir = productDir(); $productDir .= "/JavaScriptCore" if (isQt() or isGtk()); setupEnvironmentForExecution($productDir); -my @args = ("--shell", testKJSPath($productDir), "--runs", $testRuns); +my @args = ("--shell", jscPath($productDir), "--runs", $testRuns); # This code could be removed if we chose to pass extra args to sunspider instead of Xcode push @args, "--set-baseline" if $setBaseline; push @args, "--shark" if $runShark; push @args, "--shark20" if $runShark20; push @args, "--shark-cache" if $runSharkCache; +push @args, "--ubench" if $ubench; +push @args, "--v8" if $v8; push @args, "--tests", $testsPattern if $testsPattern; exec "./sunspider", @args; diff --git a/WebKitTools/Scripts/run-webkit-tests b/WebKitTools/Scripts/run-webkit-tests index 3b6bbb3..4f129b7 100755 --- a/WebKitTools/Scripts/run-webkit-tests +++ b/WebKitTools/Scripts/run-webkit-tests @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Script to run the Web Kit Open Source Project layout tests. +# Script to run the WebKit Open Source Project layout tests. # Run all the tests passed in on the command line. # If no tests are passed, find all the .html, .shtml, .xml, .xhtml, .pl, .php (and svg) files in the test directory. @@ -48,6 +48,7 @@ use strict; use warnings; use Cwd; +use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); use File::Basename; use File::Copy; use File::Find; @@ -58,7 +59,7 @@ use FindBin; use Getopt::Long; use IPC::Open2; use IPC::Open3; -use Time::HiRes qw(time); +use Time::HiRes qw(time usleep); use List::Util 'shuffle'; @@ -81,20 +82,27 @@ sub splitpath($); sub stripExtension($); sub isTextOnlyTest($); sub expectedDirectoryForTest($;$;$); +sub countFinishedTest($$$$); +sub testCrashedOrTimedOut($$$$$); +sub sampleDumpTool(); sub printFailureMessageForTest($$); sub toURL($); sub toWindowsPath($); sub closeCygpaths(); sub validateSkippedArg($$;$); -sub htmlForExpectedAndActualResults($); +sub htmlForResultsSection(\@$&); sub deleteExpectedAndActualResults($); sub recordActualResultsAndDiff($$); sub buildPlatformHierarchy(); sub epiloguesAndPrologues($$); sub parseLeaksandPrintUniqueLeaks(); +sub readFromDumpToolWithTimer(*;$); +sub setFileHandleNonBlocking(*$); +sub writeToFile($$); # Argument handling my $addPlatformExceptions = 0; +my $complexText = 0; my $configuration = configuration(); my $guardMalloc = ''; my $httpdPort = 8000; @@ -104,29 +112,29 @@ my $launchSafari = 1; my $platform; my $pixelTests = ''; my $quiet = ''; -my $repaintSweepHorizontally = ''; -my $repaintTests = ''; my $report10Slowest = 0; my $resetResults = 0; my $shouldCheckLeaks = 0; my $showHelp = 0; -my $testsPerDumpTool = 1000; +my $testsPerDumpTool; my $testHTTP = 1; my $testMedia = 1; my $testResultsDirectory = "/tmp/layout-test-results"; my $threaded = 0; -my $threshold = 0; +my $tolerance = 0; my $treatSkipped = "default"; my $verbose = 0; my $useValgrind = 0; my $strictTesting = 0; my $generateNewResults = 1; my $stripEditingCallbacks = isCygwin(); +my $runSample = 1; my $root; my $reverseTests = 0; my $randomizeTests = 0; my $mergeDepth; my @leaksFilenames; +my $run64Bit; # Default to --no-http for Qt, Gtk and wx for now. $testHTTP = 0 if (isQt() || isGtk() || isWx()); @@ -140,6 +148,8 @@ if (isTiger()) { $platform = "mac-tiger"; } elsif (isLeopard()) { $platform = "mac-leopard"; +} elsif (isSnowLeopard()) { + $platform = "mac-snowleopard"; } elsif (isOSX()) { $platform = "mac"; } elsif (isQt()) { @@ -158,30 +168,32 @@ if (!defined($platform)) { my $programName = basename($0); my $launchSafariDefault = $launchSafari ? "launch" : "do not launch"; my $httpDefault = $testHTTP ? "run" : "do not run"; +my $sampleDefault = $runSample ? "run" : "do not run"; # FIXME: "--strict" should be renamed to qt-mac-comparison, or something along those lines. my $usage = <<EOF; Usage: $programName [options] [testdir|testpath ...] --add-platform-exceptions Put new results for non-platform-specific failing tests into the platform-specific results directory + --complex-text Use the complex text code path for all text (Mac OS X and Windows only) -c|--configuration config Set DumpRenderTree build configuration -g|--guard-malloc Enable malloc guard --help Show this help message - -h|--horizontal-sweep Change repaint to sweep horizontally instead of vertically (implies --repaint-tests) --[no-]http Run (or do not run) http tests (default: $httpDefault) -i|--ignore-tests Comma-separated list of directories or tests to ignore --[no-]launch-safari Launch (or do not launch) Safari to display test results (default: $launchSafariDefault) -l|--leaks Enable leaks checking --[no-]new-test-results Generate results for new tests -p|--pixel-tests Enable pixel tests + --tolerance t Ignore image differences less than this percentage (implies --pixel-tests) --platform Override the detected platform to use for tests and results (default: $platform) --port Web server port to use with http tests -q|--quiet Less verbose output - -r|--repaint-tests Run repaint tests (implies --pixel-tests) --reset-results Reset ALL results (including pixel tests if --pixel-tests is set) -o|--results-directory Output results directory (default: $testResultsDirectory) --random Run the tests in a random order --reverse Run the tests in reverse alphabetical order --root Path to root tools build + --[no-]sample-on-timeout Run sample on timeout (default: $sampleDefault) (Mac OS X only) -1|--singly Isolate each test case run (implies --verbose) --skipped=[default|ignore|only] Specifies how to treat the Skipped file default: Tests/directories listed in the Skipped file are not tested @@ -191,18 +203,20 @@ Usage: $programName [options] [testdir|testpath ...] --strict Do a comparison with the output on Mac (Qt only) --[no-]strip-editing-callbacks Remove editing callbacks from expected results -t|--threaded Run a concurrent JavaScript thead with each test - --threshold t Ignore pixel value deviations less than or equal to t --valgrind Run DumpRenderTree inside valgrind (Qt/Linux only) -v|--verbose More verbose output (overrides --quiet) -m|--merge-leak-depth arg Merges leak callStacks and prints the number of unique leaks beneath a callstack depth of arg. Defaults to 5. + --64-bit run in 64bit mode EOF +# Process @ARGV for configuration switches before calling GetOptions() +$configuration = passedConfiguration() || configuration(); + my $getOptionsResult = GetOptions( + 'complex-text' => \$complexText, 'c|configuration=s' => \$configuration, - 'debug|devel' => sub { $configuration = "Debug" }, 'guard-malloc|g' => \$guardMalloc, 'help' => \$showHelp, - 'horizontal-sweep|h' => \$repaintSweepHorizontally, 'http!' => \$testHTTP, 'ignore-tests|i=s' => \$ignoreTests, 'launch-safari!' => \$launchSafari, @@ -211,8 +225,6 @@ my $getOptionsResult = GetOptions( 'platform=s' => \$platform, 'port=i' => \$httpdPort, 'quiet|q' => \$quiet, - 'release|deploy' => sub { $configuration = "Release" }, - 'repaint-tests|r' => \$repaintTests, 'reset-results' => \$resetResults, 'new-test-results!' => \$generateNewResults, 'results-directory|o=s' => \$testResultsDirectory, @@ -221,9 +233,10 @@ my $getOptionsResult = GetOptions( 'skipped=s' => \&validateSkippedArg, 'slowest' => \$report10Slowest, 'threaded|t' => \$threaded, - 'threshold=i' => \$threshold, + 'tolerance=f' => \$tolerance, 'verbose|v' => \$verbose, 'valgrind' => \$useValgrind, + 'sample-on-timeout!' => \$runSample, 'strict' => \$strictTesting, 'strip-editing-callbacks!' => \$stripEditingCallbacks, 'random' => \$randomizeTests, @@ -231,6 +244,7 @@ my $getOptionsResult = GetOptions( 'root=s' => \$root, 'add-platform-exceptions' => \$addPlatformExceptions, 'merge-leak-depth|m:5' => \$mergeDepth, + '64-bit!' => \$run64Bit ); if (!$getOptionsResult || $showHelp) { @@ -247,10 +261,9 @@ setConfiguration($configuration); my $configurationOption = "--" . lc($configuration); -$repaintTests = 1 if $repaintSweepHorizontally; +$pixelTests = 1 if $tolerance > 0; -$pixelTests = 1 if $repaintTests; -$pixelTests = 1 if $threshold > 0; +$testsPerDumpTool = 1000 if !$testsPerDumpTool; $verbose = 1 if $testsPerDumpTool == 1; @@ -263,25 +276,24 @@ $testMedia = 0 if $shouldCheckLeaks && isTiger(); setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root)); my $productDir = productDir(); -$productDir .= "/bin" if (isQt()); - -if (isGtk()) { - if ($ENV{WEBKITAUTOTOOLS}) { - $productDir .= "/Programs"; - } else { - $productDir .= "/WebKitTools/DumpRenderTree/gtk"; - } -} +$productDir .= "/bin" if isQt(); +$productDir .= "/Programs" if isGtk(); +setRun64Bit($run64Bit); chdirWebKit(); -if(!defined($root)){ +if (!defined($root)) { # Push the parameters to build-dumprendertree as an array my @args; - push(@args, "--" . $configuration); + push(@args, $configurationOption); push(@args, "--qt") if isQt(); push(@args, "--gtk") if isGtk(); + if (isOSX()) { + my $arch = preferredArchitecture(); + push(@args, "ARCHS=$arch"); + } + my $buildResult = system "WebKitTools/Scripts/build-dumprendertree", @args; if ($buildResult) { print STDERR "Compiling DumpRenderTree failed!\n"; @@ -295,6 +307,7 @@ my $dumpTool = "$productDir/$dumpToolName"; die "can't find executable $dumpToolName (looked in $productDir)\n" unless -x $dumpTool; my $imageDiffTool = "$productDir/ImageDiff"; +$imageDiffTool .= "_debug" if isCygwin() && $configuration ne "Release"; die "can't find executable $imageDiffTool (looked in $productDir)\n" if $pixelTests && !-x $imageDiffTool; checkFrameworks() unless isCygwin(); @@ -434,15 +447,13 @@ my $leaksOutputFileNumber = 1; my $totalLeaks = 0; my @toolArgs = (); -push @toolArgs, "--dump-all-pixels" if $pixelTests && $resetResults; push @toolArgs, "--pixel-tests" if $pixelTests; -push @toolArgs, "--repaint" if $repaintTests; -push @toolArgs, "--horizontal-sweep" if $repaintSweepHorizontally; push @toolArgs, "--threaded" if $threaded; +push @toolArgs, "--complex-text" if $complexText; push @toolArgs, "-"; my @diffToolArgs = (); -push @diffToolArgs, "--threshold", $threshold; +push @diffToolArgs, "--tolerance", $tolerance; $| = 1; @@ -451,6 +462,7 @@ if ($pixelTests) { local %ENV; $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks; $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, @diffToolArgs) or die "unable to open $imageDiffTool\n"; + $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks; } my $dumpToolPID; @@ -468,7 +480,7 @@ $SIG{"PIPE"} = "catch_pipe"; print "Testing ", scalar @tests, " test cases.\n"; my $overallStartTime = time; -my %expectedResultDirectory; +my %expectedResultPaths; # Reverse the tests @tests = reverse @tests if $reverseTests; @@ -483,6 +495,7 @@ for my $test (@tests) { openDumpTool(); my $base = stripExtension($test); + my $expectedExtension = ".txt"; my $dir = $base; $dir =~ s|/[^/]+$||; @@ -498,7 +511,11 @@ for my $test (@tests) { print "running epilogue or prologue $logue\n"; } print OUT "$logue\n"; - # Discard the output. + # Throw away output from DumpRenderTree. + # Once for the test output and once for pixel results (empty) + while (<IN>) { + last if /#EOF/; + } while (<IN>) { last if /#EOF/; } @@ -523,6 +540,20 @@ for my $test (@tests) { my $startTime = time if $report10Slowest; + # Try to read expected hash file for pixel tests + my $suffixExpectedHash = ""; + if ($pixelTests && !$resetResults) { + my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); + if (open EXPECTEDHASH, "$expectedPixelDir/$base-$expectedTag.checksum") { + my $expectedHash = <EXPECTEDHASH>; + chomp($expectedHash); + close EXPECTEDHASH; + + # Format expected hash into a suffix string that is appended to the path / URL passed to DRT + $suffixExpectedHash = "'$expectedHash"; + } + } + if ($test !~ /^http\//) { my $testPath = "$testDirectory/$test"; if (isCygwin()) { @@ -530,17 +561,17 @@ for my $test (@tests) { } else { $testPath = canonpath($testPath); } - print OUT "$testPath\n"; + print OUT "$testPath$suffixExpectedHash\n"; } else { openHTTPDIfNeeded(); if ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\// && $test !~ /^http\/tests\/media\//) { my $path = canonpath($test); $path =~ s/^http\/tests\///; - print OUT "http://127.0.0.1:$httpdPort/$path\n"; + print OUT "http://127.0.0.1:$httpdPort/$path$suffixExpectedHash\n"; } elsif ($test =~ /^http\/tests\/ssl\//) { my $path = canonpath($test); $path =~ s/^http\/tests\///; - print OUT "https://127.0.0.1:$httpdSSLPort/$path\n"; + print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixExpectedHash\n"; } else { my $testPath = "$testDirectory/$test"; if (isCygwin()) { @@ -548,25 +579,42 @@ for my $test (@tests) { } else { $testPath = canonpath($testPath); } - print OUT "$testPath\n"; + print OUT "$testPath$suffixExpectedHash\n"; } } - my $actual = ""; - while (<IN>) { - last if /#EOF/; - $actual .= $_; - } + # DumpRenderTree is expected to dump two "blocks" to stdout for each test. + # Each block is terminated by a #EOF on a line by itself. + # The first block is the output of the test (in text, RenderTree or other formats). + # The second block is for optional pixel data in PNG format, and may be empty if + # pixel tests are not being run, or the test does not dump pixels (e.g. text tests). + + my $actualRead = readFromDumpToolWithTimer(IN); + my $errorRead = readFromDumpToolWithTimer(ERROR, $actualRead->{status} eq "timedOut"); + + my $actual = $actualRead->{output}; + my $error = $errorRead->{output}; + + $expectedExtension = $actualRead->{extension}; + my $expectedFileName = "$base-$expectedTag.$expectedExtension"; my $isText = isTextOnlyTest($actual); + my $expectedDir = expectedDirectoryForTest($base, $isText, $expectedExtension); + $expectedResultPaths{$base} = "$expectedDir/$expectedFileName"; + + unless ($actualRead->{status} eq "success" && $errorRead->{status} eq "success") { + my $crashed = $actualRead->{status} eq "crashed" || $errorRead->{status} eq "crashed"; + testCrashedOrTimedOut($test, $base, $crashed, $actual, $error); + countFinishedTest($test, $base, $crashed ? "crash" : "timedout", 0); + next; + } + $durations{$test} = time - $startTime if $report10Slowest; my $expected; - my $expectedDir = expectedDirectoryForTest($base, $isText, 0); - $expectedResultDirectory{$base} = $expectedDir; - if (!$resetResults && open EXPECTED, "<", "$expectedDir/$base-$expectedTag.txt") { + if (!$resetResults && open EXPECTED, "<", "$expectedDir/$expectedFileName") { $expected = ""; while (<EXPECTED>) { next if $stripEditingCallbacks && $_ =~ /^EDITING DELEGATE:/; @@ -576,7 +624,7 @@ for my $test (@tests) { } my $expectedMac; if (!isOSX() && $strictTesting && !$isText) { - if (!$resetResults && open EXPECTED, "<", "$testDirectory/platform/mac/$base-$expectedTag.txt") { + if (!$resetResults && open EXPECTED, "<", "$testDirectory/platform/mac/$expectedFileName") { $expectedMac = ""; while (<EXPECTED>) { $expectedMac .= $_; @@ -593,64 +641,77 @@ for my $test (@tests) { my $diffPNG = ""; my $diffPercentage = ""; my $diffResult = "passed"; - - if ($pixelTests) { - my $expectedPixelDir = expectedDirectoryForTest($base, $isText, 1); - - my $actualHash = ""; - my $expectedHash = ""; - my $actualPNGSize = 0; - - while (<IN>) { - last if /#EOF/; - if (/ActualHash: ([a-f0-9]{32})/) { - $actualHash = $1; - } elsif (/BaselineHash: ([a-f0-9]{32})/) { - $expectedHash = $1; - } elsif (/Content-length: (\d+)\s*/) { - $actualPNGSize = $1; - read(IN, $actualPNG, $actualPNGSize); - } + + my $actualHash = ""; + my $expectedHash = ""; + my $actualPNGSize = 0; + + while (<IN>) { + last if /#EOF/; + if (/ActualHash: ([a-f0-9]{32})/) { + $actualHash = $1; + } elsif (/ExpectedHash: ([a-f0-9]{32})/) { + $expectedHash = $1; + } elsif (/Content-Length: (\d+)\s*/) { + $actualPNGSize = $1; + read(IN, $actualPNG, $actualPNGSize); } + } + + if ($verbose && $pixelTests && !$resetResults && $actualPNGSize) { + if ($actualHash eq "" && $expectedHash eq "") { + printFailureMessageForTest($test, "WARNING: actual & expected pixel hashes are missing!"); + } elsif ($actualHash eq "") { + printFailureMessageForTest($test, "WARNING: actual pixel hash is missing!"); + } elsif ($expectedHash eq "") { + printFailureMessageForTest($test, "WARNING: expected pixel hash is missing!"); + } + } - if ($expectedHash ne $actualHash && -f "$expectedPixelDir/$base-$expectedTag.png") { - my $expectedPNGSize = -s "$expectedPixelDir/$base-$expectedTag.png"; - my $expectedPNG = ""; - open EXPECTEDPNG, "$expectedPixelDir/$base-$expectedTag.png"; - read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize); + if ($actualPNGSize > 0) { + my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); - print DIFFOUT "Content-length: $actualPNGSize\n"; - print DIFFOUT $actualPNG; + if (!$resetResults && ($expectedHash ne $actualHash || ($actualHash eq "" && $expectedHash eq ""))) { + if (-f "$expectedPixelDir/$base-$expectedTag.png") { + my $expectedPNGSize = -s "$expectedPixelDir/$base-$expectedTag.png"; + my $expectedPNG = ""; + open EXPECTEDPNG, "$expectedPixelDir/$base-$expectedTag.png"; + read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize); - print DIFFOUT "Content-length: $expectedPNGSize\n"; - print DIFFOUT $expectedPNG; + print DIFFOUT "Content-Length: $actualPNGSize\n"; + print DIFFOUT $actualPNG; - while (<DIFFIN>) { - last if /^error/ || /^diff:/; - if (/Content-length: (\d+)\s*/) { - read(DIFFIN, $diffPNG, $1); + print DIFFOUT "Content-Length: $expectedPNGSize\n"; + print DIFFOUT $expectedPNG; + + while (<DIFFIN>) { + last if /^error/ || /^diff:/; + if (/Content-Length: (\d+)\s*/) { + read(DIFFIN, $diffPNG, $1); + } } - } - if (/^diff: (.+)% (passed|failed)/) { - $diffPercentage = $1; - $imageDifferences{$base} = $diffPercentage; - $diffResult = $2; + if (/^diff: (.+)% (passed|failed)/) { + $diffPercentage = $1; + $imageDifferences{$base} = $diffPercentage; + $diffResult = $2; + } + + if ($diffPercentage == 0) { + printFailureMessageForTest($test, "pixel hash failed (but pixel test still passes)"); + } + } elsif ($verbose) { + printFailureMessageForTest($test, "WARNING: expected image is missing!"); } } - if ($actualPNGSize && ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.png")) { + if ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.png") { mkpath catfile($expectedPixelDir, dirname($base)) if $testDirectory ne $expectedPixelDir; - open EXPECTED, ">", "$expectedPixelDir/$base-expected.png" or die "could not create $expectedPixelDir/$base-expected.png\n"; - print EXPECTED $actualPNG; - close EXPECTED; + writeToFile("$expectedPixelDir/$base-$expectedTag.png", $actualPNG); } - # update the expected hash if the image diff said that there was no difference if ($actualHash ne "" && ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.checksum")) { - open EXPECTED, ">", "$expectedPixelDir/$base-$expectedTag.checksum" or die "could not create $expectedPixelDir/$base-$expectedTag.checksum\n"; - print EXPECTED $actualHash; - close EXPECTED; + writeToFile("$expectedPixelDir/$base-$expectedTag.checksum", $actualHash); } } @@ -691,16 +752,12 @@ for my $test (@tests) { $expectedMac =~ s/\s+"\n/"\n/g; if ($simplified_actual ne $expectedMac) { - open ACTUAL, ">", "/tmp/actual.txt" or die; - print ACTUAL $simplified_actual; - close ACTUAL; - open ACTUAL, ">", "/tmp/expected.txt" or die; - print ACTUAL $expectedMac; - close ACTUAL; + writeToFile("/tmp/actual.txt", $simplified_actual); + writeToFile("/tmp/expected.txt", $expectedMac); system "diff -u \"/tmp/expected.txt\" \"/tmp/actual.txt\" > \"/tmp/simplified.diff\""; $diffResult = "failed"; - if($verbose) { + if ($verbose) { print "\n"; system "cat /tmp/simplified.diff"; print "failed!!!!!"; @@ -711,22 +768,7 @@ for my $test (@tests) { if (dumpToolDidCrash()) { $result = "crash"; - - printFailureMessageForTest($test, "crashed"); - - my $dir = "$testResultsDirectory/$base"; - $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n"; - mkpath $dir; - - deleteExpectedAndActualResults($base); - - open CRASH, ">", "$testResultsDirectory/$base-$errorTag.txt" or die; - print CRASH <ERROR>; - close CRASH; - - recordActualResultsAndDiff($base, $actual); - - closeDumpTool(); + testCrashedOrTimedOut($test, $base, 1, $actual, $error); } elsif (!defined $expected) { if ($verbose) { print "new " . ($resetResults ? "result" : "test") ."\n"; @@ -736,9 +778,7 @@ for my $test (@tests) { if ($generateNewResults || $resetResults) { mkpath catfile($expectedDir, dirname($base)) if $testDirectory ne $expectedDir; - open EXPECTED, ">", "$expectedDir/$base-$expectedTag.txt" or die "could not create $expectedDir/$base-$expectedTag.txt\n"; - print EXPECTED $actual; - close EXPECTED; + writeToFile("$expectedDir/$expectedFileName", $actual); } deleteExpectedAndActualResults($base); unless ($resetResults) { @@ -771,10 +811,8 @@ for my $test (@tests) { my $expectedResultIsMaximallyPlatformSpecific = $expectedBase =~ m|^\Q$platformTestDirectory\E/|; if (!$testIsMaximallyPlatformSpecific && !$expectedResultIsMaximallyPlatformSpecific) { mkpath catfile($platformTestDirectory, dirname($base)); - my $expectedFile = catfile($platformTestDirectory, "$base-$expectedTag.txt"); - open EXPECTED, ">", $expectedFile or die "could not create $expectedFile\n"; - print EXPECTED $actual; - close EXPECTED; + my $expectedFile = catfile($platformTestDirectory, "$expectedFileName"); + writeToFile("$expectedFile", $actual); $message .= " (results generated in $platformTestDirectory)"; } } @@ -792,15 +830,11 @@ for my $test (@tests) { if ($pixelTests && $diffPNG && $diffPNG ne "") { $imagesPresent{$base} = 1; - open ACTUAL, ">", "$testResultsDirectory/$base-$actualTag.png" or die; - print ACTUAL $actualPNG; - close ACTUAL; + writeToFile("$testResultsDirectory/$base-$actualTag.png", $actualPNG); + writeToFile("$testResultsDirectory/$base-$diffsTag.png", $diffPNG); - open DIFF, ">", "$testResultsDirectory/$base-$diffsTag.png" or die; - print DIFF $diffPNG; - close DIFF; - - copy("$expectedDir/$base-$expectedTag.png", "$testResultsDirectory/$base-$expectedTag.png"); + my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); + copy("$expectedPixelDir/$base-$expectedTag.png", "$testResultsDirectory/$base-$expectedTag.png"); open DIFFHTML, ">$testResultsDirectory/$base-$diffsTag.html" or die; print DIFFHTML "<html>\n"; @@ -847,26 +881,18 @@ for my $test (@tests) { } } - if (($count + 1) % $testsPerDumpTool == 0 || $count == $#tests) { - if ($shouldCheckLeaks) { - my $fileName; - if ($testsPerDumpTool == 1) { - $fileName = "$testResultsDirectory/$base-leaks.txt"; - } else { - $fileName = "$testResultsDirectory/" . fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . "-leaks.txt"; - } - my $leakCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, $fileName); - $totalLeaks += $leakCount; - $leaksOutputFileNumber++ if ($leakCount); - } - - closeDumpTool(); + if ($error) { + my $dir = "$testResultsDirectory/$base"; + $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n"; + mkpath $dir; + + writeToFile("$testResultsDirectory/$base-$errorTag.txt", $error); + + $counts{error}++; + push @{$tests{error}}, $test; } - $count++; - $counts{$result}++; - push @{$tests{$result}}, $test; - $testType{$test} = $isText; + countFinishedTest($test, $base, $result, $isText); } printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . ""; @@ -926,10 +952,12 @@ my %text = ( match => "succeeded", mismatch => "had incorrect layout", new => "were new", + timedout => "timed out", crash => "crashed", + error => "had stderr output" ); -for my $type ("match", "mismatch", "new", "crash") { +for my $type ("match", "mismatch", "new", "timedout", "crash", "error") { my $c = $counts{$type}; if ($c) { my $t = $text{$type}; @@ -954,66 +982,18 @@ print HTML "<title>Layout Test Results</title>\n"; print HTML "</head>\n"; print HTML "<body>\n"; -if ($counts{mismatch}) { - print HTML "<p>Tests where results did not match expected results:</p>\n"; - print HTML "<table>\n"; - for my $test (@{$tests{mismatch}}) { - my $base = stripExtension($test); - print HTML "<tr>\n"; - print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>\n"; - print HTML htmlForExpectedAndActualResults($base); - if ($pixelTests) { - if ($imagesPresent{$base}) { - print HTML "<td><a href=\"$base-$expectedTag.png\">expected image</a></td>\n"; - print HTML "<td><a href=\"$base-$diffsTag.html\">image diffs</a>\n"; - print HTML "<a href=\"$base-$diffsTag.png\">$imageDifferences{$base}%</a></td>\n"; - } else { - print HTML "<td></td><td></td>\n"; - } - } - print HTML "</tr>\n"; - } - print HTML "</table>\n"; -} - -if ($counts{crash}) { - print HTML "<p>Tests that caused the DumpRenderTree tool to crash:</p>\n"; - print HTML "<table>\n"; - for my $test (@{$tests{crash}}) { - my $base = stripExtension($test); - my $expectedDir = $expectedResultDirectory{$base}; - print HTML "<tr>\n"; - print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$base</a></td>\n"; - print HTML htmlForExpectedAndActualResults($base); - print HTML "<td><a href=\"$base-$errorTag.txt\">stderr</a></td>\n"; - print HTML "</tr>\n"; - } - print HTML "</table>\n"; -} - -if ($counts{new}) { - print HTML "<p>Tests that had no expected results (probably new):</p>\n"; - print HTML "<table>\n"; - for my $test (@{$tests{new}}) { - my $base = stripExtension($test); - my $expectedDir = $expectedResultDirectory{$base}; - print HTML "<tr>\n"; - print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$base</a></td>\n"; - print HTML "<td><a href=\"" . toURL("$expectedDir/$base-$expectedTag.txt") . "\">results</a></td>\n"; - if ($pixelTests && -f "$expectedDir/$base-$expectedTag.png") { - print HTML "<td><a href=\"" . toURL("$expectedDir/$base-$expectedTag.png") . "\">image</a></td>\n"; - } - print HTML "</tr>\n"; - } - print HTML "</table>\n"; -} +print HTML htmlForResultsSection(@{$tests{mismatch}}, "Tests where results did not match expected results", \&linksForMismatchTest); +print HTML htmlForResultsSection(@{$tests{timedout}}, "Tests that timed out", \&linksForErrorTest); +print HTML htmlForResultsSection(@{$tests{crash}}, "Tests that caused the DumpRenderTree tool to crash", \&linksForErrorTest); +print HTML htmlForResultsSection(@{$tests{error}}, "Tests that had stderr output", \&linksForErrorTest); +print HTML htmlForResultsSection(@{$tests{new}}, "Tests that had no expected results (probably new)", \&linksForNewTest); print HTML "</body>\n"; print HTML "</html>\n"; close HTML; if (isQt()) { - system "konqueror", $testResults if $launchSafari; + system "WebKitTools/Scripts/run-launcher", "--qt", $configurationOption, $testResults if $launchSafari; } elsif (isGtk()) { system "WebKitTools/Scripts/run-launcher", "--gtk", $configurationOption, $testResults if $launchSafari; } elsif (isCygwin()) { @@ -1079,8 +1059,9 @@ sub countAndPrintLeaks($$$) "_CFHTTPReadStreamReadMark", # leak in CFNetwork, rdar://problem/5441468 "httpProtocolStart", # leak in CFNetwork, rdar://problem/5468837 "_CFURLConnectionSendCallbacks", # leak in CFNetwork, rdar://problem/5441600 - "DispatchQTMsg", # leak in Quicktime, PPC only, <rdar://problem/5667132> - "QTMovieContentView createVisualContext", # leak in Quicktime, PPC only, <rdar://problem/5667132> + "DispatchQTMsg", # leak in QuickTime, PPC only, rdar://problem/5667132 + "QTMovieContentView createVisualContext", # leak in QuickTime, PPC only, rdar://problem/5667132 + "_CopyArchitecturesForJVMVersion", # leak in Java, rdar://problem/5910823 ); } @@ -1111,9 +1092,7 @@ sub countAndPrintLeaks($$$) print " + $count leaks ($bytes bytes) were found, details in $leaksFilePath\n"; } - open LEAKS, ">", $leaksFilePath or die; - print LEAKS $leaksOutput; - close LEAKS; + writeToFile($leaksFilePath, $leaksOutput); push( @leaksFilenames, $leaksFilePath ); } @@ -1121,6 +1100,14 @@ sub countAndPrintLeaks($$$) return $adjustedCount; } +sub writeToFile($$) +{ + my ($filePath, $contents) = @_; + open NEWFILE, ">", "$filePath" or die "could not create $filePath\n"; + print NEWFILE $contents; + close NEWFILE; +} + # Break up a path into the directory (with slash) and base name. sub splitpath($) { @@ -1220,7 +1207,6 @@ sub openDumpTool() } $ENV{DYLD_FRAMEWORK_PATH} = $productDir; $ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995> - $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks; $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc; if (isCygwin()) { @@ -1231,16 +1217,21 @@ sub openDumpTool() } setPathForRunningWebKitApp(\%ENV) if isCygwin(); } - - my @args = (); - if ($useValgrind) { - push @args, $dumpTool; + + exportArchPreference(); + + my @args = @toolArgs; + unshift @args, $dumpTool; + if (isOSX and !isTiger()) { + unshift @args, "arch"; } - push @args, @toolArgs; if ($useValgrind) { - $dumpTool = "valgrind"; - } - $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, $dumpTool, @args) or die "Failed to start tool: $dumpTool\n"; + unshift @args, "valgrind"; + } + + $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks; + $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, @args) or die "Failed to start tool: $dumpTool\n"; + $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks; $isDumpToolOpen = 1; $dumpToolCrashed = 0; } @@ -1251,8 +1242,15 @@ sub closeDumpTool() close IN; close OUT; - close ERROR; waitpid $dumpToolPID, 0; + + # check for WebCore counter leaks. + if ($shouldCheckLeaks) { + while (<ERROR>) { + print; + } + } + close ERROR; $isDumpToolOpen = 0; } @@ -1262,7 +1260,17 @@ sub dumpToolDidCrash() return 0 unless $isDumpToolOpen; my $pid = waitpid(-1, WNOHANG); - return $pid == $dumpToolPID; + return 1 if ($pid == $dumpToolPID); + + # On Mac OS X, crashing may be significantly delayed by crash reporter. + return 0 unless isOSX(); + + my $tryingToExit = 0; + open PS, "ps -o state -p $dumpToolPID |"; + <PS>; # skip header + $tryingToExit = 1 if <PS> =~ /E/; + close PS; + return $tryingToExit; } sub openHTTPDIfNeeded() @@ -1402,21 +1410,15 @@ sub isTextOnlyTest($) sub expectedDirectoryForTest($;$;$) { - my ($base, $isText, $isPixelTest) = @_; + my ($base, $isText, $expectedExtension) = @_; my @directories = @platformHierarchy; push @directories, map { catdir($platformBaseDirectory, $_) } qw(mac-leopard mac) if isCygwin(); push @directories, $expectedDirectory; # If we already have expected results, just return their location. - if ($isPixelTest) { - foreach my $directory (@directories) { - return $directory if (-f "$directory/$base-$expectedTag.png"); - } - } else { - foreach my $directory (@directories) { - return $directory if (-f "$directory/$base-$expectedTag.txt"); - } + foreach my $directory (@directories) { + return $directory if (-f "$directory/$base-$expectedTag.$expectedExtension"); } # For platform-specific tests, the results should go right next to the test itself. @@ -1432,6 +1434,56 @@ sub expectedDirectoryForTest($;$;$) return $isText ? $expectedDirectory : $platformHierarchy[$#platformHierarchy]; } +sub countFinishedTest($$$$) { + my ($test, $base, $result, $isText) = @_; + + if (($count + 1) % $testsPerDumpTool == 0 || $count == $#tests) { + if ($shouldCheckLeaks) { + my $fileName; + if ($testsPerDumpTool == 1) { + $fileName = "$testResultsDirectory/$base-leaks.txt"; + } else { + $fileName = "$testResultsDirectory/" . fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . "-leaks.txt"; + } + my $leakCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, $fileName); + $totalLeaks += $leakCount; + $leaksOutputFileNumber++ if ($leakCount); + } + + closeDumpTool(); + } + + $count++; + $counts{$result}++; + push @{$tests{$result}}, $test; + $testType{$test} = $isText; +} + +sub testCrashedOrTimedOut($$$$$) +{ + my ($test, $base, $didCrash, $actual, $error) = @_; + + printFailureMessageForTest($test, $didCrash ? "crashed" : "timed out"); + + sampleDumpTool() unless $didCrash; + + my $dir = "$testResultsDirectory/$base"; + $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n"; + mkpath $dir; + + deleteExpectedAndActualResults($base); + + if (defined($error) && length($error)) { + writeToFile("$testResultsDirectory/$base-$errorTag.txt", $error); + } + + recordActualResultsAndDiff($base, $actual); + + kill 9, $dumpToolPID unless $didCrash; + + closeDumpTool(); +} + sub printFailureMessageForTest($$) { my ($test, $description) = @_; @@ -1517,15 +1569,94 @@ sub validateSkippedArg($$;$) $treatSkipped = $value; } -sub htmlForExpectedAndActualResults($) +sub htmlForResultsSection(\@$&) +{ + my ($tests, $description, $linkGetter) = @_; + + my @html = (); + return join("\n", @html) unless @{$tests}; + + push @html, "<p>$description:</p>"; + push @html, "<table>"; + foreach my $test (@{$tests}) { + push @html, "<tr>"; + push @html, "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>"; + foreach my $link (@{&{$linkGetter}($test)}) { + push @html, "<td><a href=\"$link->{href}\">$link->{text}</a></td>"; + } + push @html, "</tr>"; + } + push @html, "</table>"; + + return join("\n", @html); +} + +sub linksForExpectedAndActualResults($) { my ($base) = @_; - return "<td></td><td></td><td></td>\n" unless -s "$testResultsDirectory/$base-$diffsTag.txt"; + my @links = (); + + return \@links unless -s "$testResultsDirectory/$base-$diffsTag.txt"; + + my $expectedResultPath = $expectedResultPaths{$base}; + my ($expectedResultFileName, $expectedResultsDirectory, $expectedResultExtension) = fileparse($expectedResultPath, qr{\.[^.]+$}); + + push @links, { href => "$base-$expectedTag$expectedResultExtension", text => "expected" }; + push @links, { href => "$base-$actualTag$expectedResultExtension", text => "actual" }; + push @links, { href => "$base-$diffsTag.txt", text => "diffs" }; + + return \@links; +} + +sub linksForMismatchTest +{ + my ($test) = @_; + + my @links = (); + + my $base = stripExtension($test); + + push @links, @{linksForExpectedAndActualResults($base)}; + return \@links unless $pixelTests && $imagesPresent{$base}; + + push @links, { href => "$base-$expectedTag.png", text => "expected image" }; + push @links, { href => "$base-$diffsTag.html", text => "image diffs" }; + push @links, { href => "$base-$diffsTag.png", text => "$imageDifferences{$base}%" }; + + return \@links; +} + +sub linksForErrorTest +{ + my ($test) = @_; + + my @links = (); + + my $base = stripExtension($test); + + push @links, @{linksForExpectedAndActualResults($base)}; + push @links, { href => "$base-$errorTag.txt", text => "stderr" }; + + return \@links; +} + +sub linksForNewTest +{ + my ($test) = @_; - return "<td><a href=\"$base-$expectedTag.txt\">expected</a></td>\n" - . "<td><a href=\"$base-$actualTag.txt\">actual</a></td>\n" - . "<td><a href=\"$base-$diffsTag.txt\">diffs</a></td>\n"; + my @links = (); + + my $base = stripExtension($test); + my $expectedResultPath = $expectedResultPaths{$base}; + my $expectedResultPathMinusExtension = stripExtension($expectedResultPath); + + push @links, { href => toURL($expectedResultPath), text => "results" }; + if ($pixelTests && -f "$expectedResultPathMinusExtension.png") { + push @links, { href => toURL("$expectedResultPathMinusExtension.png"), text => "image" }; + } + + return \@links; } sub deleteExpectedAndActualResults($) @@ -1539,18 +1670,18 @@ sub deleteExpectedAndActualResults($) sub recordActualResultsAndDiff($$) { - my ($base, $actual) = @_; - - return unless length($actual); + my ($base, $actualResults) = @_; - open ACTUAL, ">", "$testResultsDirectory/$base-$actualTag.txt" or die "Couldn't open actual results file for $base"; - print ACTUAL $actual; - close ACTUAL; + return unless defined($actualResults) && length($actualResults); - my $expectedDir = $expectedResultDirectory{$base}; - copy("$expectedDir/$base-$expectedTag.txt", "$testResultsDirectory/$base-$expectedTag.txt"); + my $expectedResultPath = $expectedResultPaths{$base}; + my ($expectedResultFileNameMinusExtension, $expectedResultDirectoryPath, $expectedResultExtension) = fileparse($expectedResultPath, qr{\.[^.]+$}); + my $actualResultsPath = "$testResultsDirectory/$base-$actualTag$expectedResultExtension"; + my $copiedExpectedResultsPath = "$testResultsDirectory/$base-$expectedTag$expectedResultExtension"; + writeToFile("$actualResultsPath", $actualResults); + copy("$expectedResultPath", "$copiedExpectedResultsPath"); - system "diff -u \"$testResultsDirectory/$base-$expectedTag.txt\" \"$testResultsDirectory/$base-$actualTag.txt\" > \"$testResultsDirectory/$base-$diffsTag.txt\""; + system "diff -u \"$copiedExpectedResultsPath\" \"$actualResultsPath\" > \"$testResultsDirectory/$base-$diffsTag.txt\""; } sub buildPlatformHierarchy() @@ -1573,7 +1704,7 @@ sub epiloguesAndPrologues($$) { my @components = split('/', $directory); while (@lastComponents) { - if ($lastComponents[0] ne $components[0]) { + if (!defined($components[0]) || $lastComponents[0] ne $components[0]) { last; } shift @components; @@ -1625,3 +1756,107 @@ sub parseLeaksandPrintUniqueLeaks() { print "See above for individual leaks results.\n" if ($leaksOutputFileNumber > 2); } + +sub extensionForMimeType($) +{ + my ($mimeType) = @_; + + if ($mimeType eq "application/x-webarchive") { + return "webarchive"; + } elsif ($mimeType eq "application/pdf") { + return "pdf"; + } + return "txt"; +} + +# Read up to the first #EOF (the content block of the test), or until detecting crashes or timeouts. +sub readFromDumpToolWithTimer(*;$) +{ + my ($fh, $dontWaitForTimeOut) = @_; + + setFileHandleNonBlocking($fh, 1); + + my $maximumSecondsWithoutOutput = 60; + $maximumSecondsWithoutOutput *= 10 if $guardMalloc; + my $microsecondsToWaitBeforeReadingAgain = 1000; + + my $timeOfLastSuccessfulRead = time; + + my @output = (); + my $status = "success"; + my $mimeType = "text/plain"; + # We don't have a very good way to know when the "headers" stop + # and the content starts, so we use this as a hack: + my $haveSeenContentType = 0; + + while (1) { + if (time - $timeOfLastSuccessfulRead > $maximumSecondsWithoutOutput) { + $status = dumpToolDidCrash() ? "crashed" : "timedOut"; + last; + } + + my $line = readline($fh); + if (!defined($line)) { + if ($! != EAGAIN) { + $status = "crashed"; + last; + } + + if ($dontWaitForTimeOut) { + last; + } + + # No data ready + usleep($microsecondsToWaitBeforeReadingAgain); + next; + } + + $timeOfLastSuccessfulRead = time; + + if (!$haveSeenContentType && $line =~ /^Content-Type: (\S+)$/) { + $mimeType = $1; + $haveSeenContentType = 1; + next; + } + last if ($line =~ /#EOF/); + + push @output, $line; + } + + setFileHandleNonBlocking($fh, 0); + return { + output => join("", @output), + status => $status, + mimeType => $mimeType, + extension => extensionForMimeType($mimeType) + }; +} + +sub setFileHandleNonBlocking(*$) +{ + my ($fh, $nonBlocking) = @_; + + my $flags = fcntl($fh, F_GETFL, 0) or die "Couldn't get filehandle flags"; + + if ($nonBlocking) { + $flags |= O_NONBLOCK; + } else { + $flags &= ~O_NONBLOCK; + } + + fcntl($fh, F_SETFL, $flags) or die "Couldn't set filehandle flags"; + + return 1; +} + +sub sampleDumpTool() +{ + return unless isOSX(); + return unless $runSample; + + my $outputDirectory = "$ENV{HOME}/Library/Logs/DumpRenderTree"; + -d $outputDirectory or mkdir $outputDirectory; + + my $outputFile = "$outputDirectory/HangReport.txt"; + system "/usr/bin/sample", $dumpToolPID, qw(10 10 -file), $outputFile; +} diff --git a/WebKitTools/Scripts/sort-Xcode-project-file b/WebKitTools/Scripts/sort-Xcode-project-file index e9b7a56..a35fe73 100755 --- a/WebKitTools/Scripts/sort-Xcode-project-file +++ b/WebKitTools/Scripts/sort-Xcode-project-file @@ -31,7 +31,7 @@ use strict; use File::Basename; -use File::Temp; +use File::Temp qw(tempfile); use Getopt::Long; sub sortByFileName($$); @@ -64,12 +64,11 @@ for my $projectFile (@ARGV) { next; } - my $OUT = new File::Temp( + my ($OUT, $tempFileName) = tempfile( + basename($projectFile) . "-XXXXXXXX", DIR => dirname($projectFile), - TEMPLATE => basename($projectFile) . "-XXXXXXXX", UNLINK => 0, ); - my $tempFileName = $OUT->filename(); # Clean up temp file in case of die() $SIG{__DIE__} = sub { diff --git a/WebKitTools/Scripts/sunspider-compare-results b/WebKitTools/Scripts/sunspider-compare-results index cf18aae..ec0863a 100755 --- a/WebKitTools/Scripts/sunspider-compare-results +++ b/WebKitTools/Scripts/sunspider-compare-results @@ -57,13 +57,13 @@ if ($showHelp) { @ARGV = map { File::Spec->rel2abs($_) } @ARGV; -sub buildTestKJS +sub buildJSC { if (!defined($root)){ chdirWebKit(); - my $buildResult = system "WebKitTools/Scripts/build-testkjs", "--" . $configuration; + my $buildResult = system "WebKitTools/Scripts/build-jsc", "--" . $configuration; if ($buildResult) { - print STDERR "Compiling testkjs failed!\n"; + print STDERR "Compiling jsc failed!\n"; exit WEXITSTATUS($buildResult); } } @@ -77,15 +77,15 @@ sub setupEnvironmentForExecution($) # FIXME: Other platforms may wish to augment this method to use LD_LIBRARY_PATH, etc. } -sub testKJSPath($) +sub jscPath($) { my ($productDir) = @_; - my $testkjsName = "testkjs"; - $testkjsName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); - return "$productDir/$testkjsName"; + my $jscName = "jsc"; + $jscName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); + return "$productDir/$jscName"; } -buildTestKJS(); +buildJSC(); chdirWebKit(); chdir("SunSpider"); @@ -95,7 +95,7 @@ my $productDir = productDir(); $productDir .= "/JavaScriptCore" if (isQt() or isGtk()); setupEnvironmentForExecution($productDir); -my @args = ("--shell", testKJSPath($productDir)); +my @args = ("--shell", jscPath($productDir)); # This code could be removed if we chose to pass extra args to sunspider instead of Xcode exec "./sunspider-compare-results", @args, @ARGV; diff --git a/WebKitTools/Scripts/svn-apply b/WebKitTools/Scripts/svn-apply index 5845917..d43d525 100755 --- a/WebKitTools/Scripts/svn-apply +++ b/WebKitTools/Scripts/svn-apply @@ -76,7 +76,7 @@ sub handleBinaryChange($$); sub isDirectoryEmptyForRemoval($); sub patch($); sub removeDirectoriesIfNeeded(); -sub setChangeLogDate($); +sub setChangeLogDateAndReviewer($$); sub svnStatus($); # Project time zone for Cupertino, CA, US @@ -84,8 +84,9 @@ my $changeLogTimeZone = "PST8PDT"; my $merge = 0; my $showHelp = 0; -if (!GetOptions("merge!" => \$merge, "help!" => \$showHelp) || $showHelp) { - print STDERR basename($0) . " [-h|--help] [-m|--merge] patch1 [patch2 ...]\n"; +my $reviewer; +if (!GetOptions("merge!" => \$merge, "help!" => \$showHelp, "reviewer=s" => \$reviewer) || $showHelp) { + print STDERR basename($0) . " [-h|--help] [-m|--merge] [-r|--reviewer name] patch1 [patch2 ...]\n"; exit 1; } @@ -106,8 +107,8 @@ my $filter; my $indexPath; my $patch; while (<>) { - s/\r//g; - chomp; + s/([\n\r]+)$//mg; + my $eol = $1; if (!defined($indexPath) && m#^diff --git a/#) { $filter = \&gitdiff2svndiff; } @@ -139,7 +140,7 @@ while (<>) { } } $patch .= $_; - $patch .= "\n"; + $patch .= $eol; } if ($patch && !$copiedFromPath) { @@ -346,7 +347,7 @@ sub patch($) # Standard patch, patch tool can handle this. if (basename($fullPath) eq "ChangeLog") { my $changeLogDotOrigExisted = -f "${fullPath}.orig"; - applyPatch(setChangeLogDate(fixChangeLogPatch($patch)), $fullPath, ["--fuzz=3"]); + applyPatch(setChangeLogDateAndReviewer(fixChangeLogPatch($patch), $reviewer), $fullPath, ["--fuzz=3"]); unlink("${fullPath}.orig") if (! $changeLogDotOrigExisted); } else { applyPatch($patch, $fullPath); @@ -390,9 +391,10 @@ sub removeDirectoriesIfNeeded() } } -sub setChangeLogDate($) +sub setChangeLogDateAndReviewer($$) { my $patch = shift; + my $reviewer = shift; my $savedTimeZone = $ENV{'TZ'}; # Set TZ temporarily so that localtime() is in that time zone $ENV{'TZ'} = $changeLogTimeZone; @@ -403,6 +405,9 @@ sub setChangeLogDate($) delete $ENV{'TZ'}; } $patch =~ s/(\n\+)\d{4}-[^-]{2}-[^-]{2}( )/$1$newDate$2/; + if (defined($reviewer)) { + $patch =~ s/NOBODY \(OOPS!\)/$reviewer/; + } return $patch; } diff --git a/WebKitTools/Scripts/svn-unapply b/WebKitTools/Scripts/svn-unapply index 05910ad..11e3ddb 100755 --- a/WebKitTools/Scripts/svn-unapply +++ b/WebKitTools/Scripts/svn-unapply @@ -88,8 +88,8 @@ my $filter; my $indexPath; my $patch; while (<>) { - s/\r//g; - chomp; + s/([\n\r]+)$//mg; + my $eol = $1; if (!defined($indexPath) && m#^diff --git a/#) { $filter = \&gitdiff2svndiff; } @@ -117,7 +117,7 @@ while (<>) { } } $patch .= $_; - $patch .= "\n"; + $patch .= $eol; } if ($patch) { diff --git a/WebKitTools/Scripts/update-sources-list.py b/WebKitTools/Scripts/update-sources-list.py new file mode 100644 index 0000000..e565059 --- /dev/null +++ b/WebKitTools/Scripts/update-sources-list.py @@ -0,0 +1,93 @@ +#!/usr/bin/python + +# Copyright (C) 2007 Kevin Ollivier All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Make sure any port-independent files added to the Bakefile are +# added to GTK, QT, etc. so that file updates can happen in one place. + +import os, sys +from xml.dom import minidom + +scriptDir = os.path.abspath(sys.path[0]) +wkroot = os.path.abspath(os.path.join(scriptDir, "../..")) + +def getWebCoreFilesDict(): + """ + This method parses the WebCoreSources.bkl file, which has a list of all sources not specific + to any port, and returns the result as a dictionary with items of the form + (groupName, groupFiles). + """ + sources = {} + sources_prefix = "WEBCORE_" + filepath = os.path.join(wkroot, "WebCore/WebCoreSources.bkl") + assert(os.path.exists(filepath)) + + doc = minidom.parse(filepath) + for sourceGroup in doc.getElementsByTagName("set"): + groupName = "" + if sourceGroup.attributes.has_key("var"): + groupName = sourceGroup.attributes["var"].value + groupName = groupName.replace(sources_prefix, "") + + sourcesList = [] + for node in sourceGroup.childNodes: + if node.nodeType == node.TEXT_NODE: + sourcesText = node.nodeValue.strip() + sourcesList = sourcesText.split("\n") + + assert(groupName != "") + assert(sourcesList != []) + + sources[groupName] = sourcesList + + return sources + +def generateWebCoreSourcesGTKAndQT(sources): + """ + Convert the dictionary obtained from getWebCoreFilesDict() into a Unix makefile syntax, + which IIUC is suitable for both GTK and QT build systems. To take advantage of this, + QT and GTK would have to include the file "WebCore/sources.inc" into their makefiles. + """ + makefileString = "" + + for key in sources.keys(): + makefileString += key + "+=" + for source in sources[key]: + makefileString += " \\\n\t\t" + source.strip() + + makefileString += "\n\n" + + makefileString += "BASE_SOURCES +=" + for key in sources.keys(): + makefileString += " \\\n\t\t" + key + + outfile = os.path.join(wkroot, "WebCore/sources.inc") + sourcefile = open(outfile, "w") + sourcefile.write(makefileString) + sourcefile.close() + +sources = getWebCoreFilesDict() +generateWebCoreSourcesGTKAndQT(sources) + +# Coming soon - MSVC and hopefully XCode support! diff --git a/WebKitTools/Scripts/update-webkit b/WebKitTools/Scripts/update-webkit index 6d974b1..e0c0d82 100755 --- a/WebKitTools/Scripts/update-webkit +++ b/WebKitTools/Scripts/update-webkit @@ -81,7 +81,7 @@ sub runSvnUpdate() print $line; push @conflictedChangeLogs, $1 if $line =~ m/^C\s+(.+)\s*$/ && basename($1) eq "ChangeLog"; } - close UPDATE; + close UPDATE or die; if (@conflictedChangeLogs) { print "Attempting to merge conflicted ChangeLogs.\n"; diff --git a/WebKitTools/Scripts/update-webkit-localizable-strings b/WebKitTools/Scripts/update-webkit-localizable-strings index 53037a6..350bf21 100755 --- a/WebKitTools/Scripts/update-webkit-localizable-strings +++ b/WebKitTools/Scripts/update-webkit-localizable-strings @@ -35,6 +35,7 @@ use lib $FindBin::Bin; use webkitdirs; my @directoriesToScan = ("WebKit/mac", "WebKit/win"); +my $fileToUpdate = "WebKit/English.lproj/Localizable.strings"; my $exceptionsFile = "WebKit/StringsNotToBeLocalized.txt"; @ARGV == 0 or die "Usage: " . basename($0) . "\n"; @@ -42,4 +43,4 @@ my $exceptionsFile = "WebKit/StringsNotToBeLocalized.txt"; chdirWebKit(); system "sort -u $exceptionsFile -o $exceptionsFile"; -exec "extract-localizable-strings", $exceptionsFile, @directoriesToScan; +exec "extract-localizable-strings", $exceptionsFile, $fileToUpdate, @directoriesToScan; diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm index ecebf94..728e7c0 100644 --- a/WebKitTools/Scripts/webkitdirs.pm +++ b/WebKitTools/Scripts/webkitdirs.pm @@ -56,6 +56,7 @@ my $osXVersion; my $isQt; my $isGtk; my $isWx; +my $forceRun64Bit; # Variables for Win32 support my $vcBuildPath; @@ -65,7 +66,8 @@ sub determineSourceDir { return if $sourceDir; $sourceDir = $FindBin::Bin; - + $sourceDir =~ s|/+$||; # Remove trailing '/' as we would die later + # walks up path checking each directory to see if it is the main WebKit project dir, # defined by containing JavaScriptCore, WebCore, and WebKit until ((-d "$sourceDir/JavaScriptCore" && -d "$sourceDir/WebCore" && -d "$sourceDir/WebKit") || (-d "$sourceDir/Internal" && -d "$sourceDir/OpenSource")) @@ -178,10 +180,10 @@ sub determineConfigurationProductDir { return if defined $configurationProductDir; determineBaseProductDir(); - if(isCygwin() && !isWx()) { + determineConfiguration(); + if (isCygwin() && !isWx()) { $configurationProductDir = "$baseProductDir/bin"; } else { - determineConfiguration(); $configurationProductDir = "$baseProductDir/$configuration"; } } @@ -267,16 +269,27 @@ sub determinePassedConfiguration { return if $searchedForPassedConfiguration; $searchedForPassedConfiguration = 1; + + my $isWinCairo = grep(/^--cairo-win32$/i, @ARGV); + for my $i (0 .. $#ARGV) { my $opt = $ARGV[$i]; if ($opt =~ /^--debug$/i || $opt =~ /^--devel/i) { splice(@ARGV, $i, 1); $passedConfiguration = "Debug"; + $passedConfiguration .= "_Cairo" if ($isWinCairo && isCygwin()); return; } if ($opt =~ /^--release$/i || $opt =~ /^--deploy/i) { splice(@ARGV, $i, 1); $passedConfiguration = "Release"; + $passedConfiguration .= "_Cairo" if ($isWinCairo && isCygwin()); + return; + } + if ($opt =~ /^--profil(e|ing)$/i) { + splice(@ARGV, $i, 1); + $passedConfiguration = "Profiling"; + $passedConfiguration .= "_Cairo" if ($isWinCairo && isCygwin()); return; } } @@ -315,11 +328,7 @@ sub installedSafariPath if (isOSX()) { $safariBundle = "/Applications/Safari.app"; } elsif (isCygwin()) { - my $findSafariName = "FindSafari"; - $findSafariName .= "_debug" if $configuration ne "Release"; - $findSafariName .= ".exe"; - - $safariBundle = `"$configurationProductDir/$findSafariName"`; + $safariBundle = `"$configurationProductDir/FindSafari.exe"`; $safariBundle =~ s/[\r\n]+$//; $safariBundle = `cygpath -u '$safariBundle'`; $safariBundle =~ s/[\r\n]+$//; @@ -394,8 +403,7 @@ sub hasSVGSupport } if (isGtk() and $path =~ /WebCore/) { - $path .= "/../lib/libWebKitGtk.so" if !$ENV{WEBKITAUTOTOOLS}; - $path .= "/../.libs/libWebKitGtk.so" if $ENV{WEBKITAUTOTOOLS}; + $path .= "/../.libs/webkit-1.0.so"; } my $hasSVGSupport = 0; @@ -512,14 +520,16 @@ sub isDebianBased() sub isCygwin() { - return ($^O eq "cygwin"); + return ($^O eq "cygwin") || 0; } sub isDarwin() { - return ($^O eq "darwin"); + return ($^O eq "darwin") || 0; } +# isOSX() only returns true for Apple's port, not for other ports that can be +# built/run on OS X. sub isOSX() { return isDarwin() unless (isQt() or isGtk() or isWx()); @@ -561,6 +571,11 @@ sub isLeopard() return isOSX() && osXVersion()->{"minor"} == 5; } +sub isSnowLeopard() +{ + return isOSX() && osXVersion()->{"minor"} == 6; +} + sub relativeScriptsDir() { my $scriptDir = File::Spec->catpath("", File::Spec->abs2rel(dirname($0), getcwd()), ""); @@ -694,20 +709,39 @@ sub buildVisualStudioProject return system $vcBuildPath, $winProjectPath, $command, $config; } -sub qtMakeCommand($) +sub retrieveQMakespecVar { - my ($qmakebin) = @_; - chomp(my $mkspec = `$qmakebin -query QMAKE_MKSPECS`); - $mkspec .= "/default"; + my $mkspec = $_[0]; + my $varname = $_[1]; - my $compiler = ""; - open SPEC, "<$mkspec/qmake.conf" or return "make"; + my $compiler = "unknown"; + #print "retrieveMakespecVar " . $mkspec . ", " . $varname . "\n"; + + local *SPEC; + open SPEC, "<$mkspec" or return "make"; while (<SPEC>) { - if ($_ =~ /QMAKE_CC\s*=\s*([^\s]+)/) { + if ($_ =~ /\s*include\((.+)\)/) { + # open the included mkspec + my $oldcwd = getcwd(); + (my $volume, my $directories, my $file) = File::Spec->splitpath($mkspec); + chdir "$volume$directories"; + $compiler = retrieveQMakespecVar($1, $varname); + chdir $oldcwd; + } elsif ($_ =~ /$varname\s*=\s*([^\s]+)/) { $compiler = $1; + last; } } close SPEC; + return $compiler; +} + +sub qtMakeCommand($) +{ + my ($qmakebin) = @_; + chomp(my $mkspec = `$qmakebin -query QMAKE_MKSPECS`); + $mkspec .= "/default"; + my $compiler = retrieveQMakespecVar("$mkspec/qmake.conf", "QMAKE_CC"); #print "default spec: " . $mkspec . "\n"; #print "compiler found: " . $compiler . "\n"; @@ -755,7 +789,7 @@ sub buildAutotoolsProject($@) my $result; if ($clean) { $result = system $make, "distclean"; - return $result; + return 0; } print "Calling configure in " . $dir . "\n\n"; @@ -856,12 +890,7 @@ sub buildGtkProject($$@) die "The Gtk port builds JavaScriptCore, WebCore and WebKit in one shot! Only call it for 'WebKit'.\n"; } - if ($ENV{WEBKITAUTOTOOLS}) { - return buildAutotoolsProject($clean, @buildArgs); - } else { - my @buildArgs = ("CONFIG+=gtk-port", "CONFIG-=qt"); - return buildQMakeProject($clean, @buildArgs); - } + return buildAutotoolsProject($clean, @buildArgs); } sub setPathForRunningWebKitApp @@ -893,7 +922,12 @@ sub runSafari print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; $ENV{DYLD_FRAMEWORK_PATH} = $productDir; $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; - return system safariPath(), @ARGV; + exportArchPreference(); + if (!isTiger()) { + return system "arch", safariPath(), @ARGV; + } else { + return system safariPath(), @ARGV; + } } if (isCygwin()) { @@ -913,39 +947,38 @@ sub runSafari return 1; } -sub runDrosera +sub setRun64Bit($) { - my ($debugger) = @_; + ($forceRun64Bit) = @_; +} - if (isOSX()) { - return system "$FindBin::Bin/gdb-drosera", @ARGV if $debugger; +sub preferredArchitecture +{ + return unless isOSX(); + + my $framework = shift; + $framework = "WebKit" if !defined($framework); - my $productDir = productDir(); - print "Starting Drosera with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; - $ENV{DYLD_FRAMEWORK_PATH} = $productDir; - $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; + my $currentArchitecture = `arch`; + chomp($currentArchitecture); - my $droseraPath = "$productDir/Drosera.app/Contents/MacOS/Drosera"; - return system $droseraPath, @ARGV; + my $run64Bit = 0; + if (!defined($forceRun64Bit)) { + my $frameworkPath = builtDylibPathForName($framework); + die "Couldn't find path for $framework" if !defined($frameworkPath); + # The binary is 64-bit if one of the architectures it contains has "64" in the name + $run64Bit = `lipo -info "$frameworkPath"` =~ /(are|architecture):.*64/; } - if (isCygwin()) { - print "Running Drosera\n"; - my $script = "run-drosera-nightly.cmd"; - my $prodDir = productDir(); - my $result = system "cp", "$FindBin::Bin/$script", $prodDir; - return $result if $result; - - my $cwd = getcwd(); - chdir $prodDir; - - my $debuggerFlag = $debugger ? "/debugger" : ""; - $result = system "cmd", "/c", "call $script $debuggerFlag"; - chdir $cwd; - return $result; + if ($forceRun64Bit or $run64Bit) { + return ($currentArchitecture eq "i386") ? "x86_64" : "ppc64"; } + return $currentArchitecture; +} - return 1; +sub exportArchPreference +{ + $ENV{ARCHPREFERENCE} = preferredArchitecture() if isOSX(); } 1; diff --git a/WebKitTools/Scripts/wkstyle b/WebKitTools/Scripts/wkstyle index 690b5fa..4b3447f 100755 --- a/WebKitTools/Scripts/wkstyle +++ b/WebKitTools/Scripts/wkstyle @@ -25,16 +25,36 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -astyle \ +cmdcpp="astyle \ +--unpad=paren \ --style=linux \ +--brackets=linux \ --indent=spaces=4 \ ---convert-tabs \ -$@ +--indent-switches \ +--convert-tabs" + +cmdh="astyle \ +--unpad=paren \ +--style=linux \ +--brackets=break \ +--indent=spaces=4 \ +--convert-tabs" #astyle does not support unpadding so we use sed for i in $@ do echo $i + +ext=`echo $i|awk -F . '{print $NF}'` + +cmd=$cmdcpp + +if [ $ext == "h" ] ; then + cmd=$cmdh +fi + +$cmd $i + #first print the changes we are making sed -n -e ' /( .*/p @@ -59,6 +79,9 @@ s/ )/)/g N s/\n{/ {/ } +#fixup extra tab in constructor initalizer +/^ \+,/{s/^ //} +/^ \+:/{s/^ //} ' $i > $i.sed mv $i.sed $i done |