| author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> | 
| Fri, 17 Sep 2010 09:02:29 +0300 | |
| changeset 0 | 4f2f89ce4247 | 
| permissions | -rw-r--r-- | 
| 0 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 1 | #!/usr/bin/perl | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 2 | # Copyright (C) 2010 Google Inc. All rights reserved. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 3 | # | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 4 | # Redistribution and use in source and binary forms, with or without | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 5 | # modification, are permitted provided that the following conditions | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 6 | # are met: | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 7 | # | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 8 | # 1. Redistributions of source code must retain the above copyright | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 9 | # notice, this list of conditions and the following disclaimer. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 10 | # 2. Redistributions in binary form must reproduce the above copyright | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 11 | # notice, this list of conditions and the following disclaimer in the | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 12 | # documentation and/or other materials provided with the distribution. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 13 | # 3. Neither the name of Google, Inc. nor the names of | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 14 | # its contributors may be used to endorse or promote products derived | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 15 | # from this software without specific prior written permission. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 16 | # | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 17 | # THIS SOFTWARE IS PROVIDED BY GOOGLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 20 | # DISCLAIMED. IN NO EVENT SHALL GOOGLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 27 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 28 | # Temporary script to test the HTML5 parser until it is able to | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 29 | # run enough LayoutTests so that we know what changes we'll need | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 30 | # to make to run-webkit-tests to support testing with the new parser. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 31 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 32 | # NOTE: This script is a total hack and should be rolled into | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 33 | # run-webkit-tests instead of being improved further. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 34 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 35 | use strict; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 36 | use warnings; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 37 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 38 | use FindBin; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 39 | use lib $FindBin::Bin; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 40 | use webkitdirs; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 41 | use VCSUtils; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 42 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 43 | sub writeToFile($$) | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 44 | {
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 45 | my ($filePath, $contents) = @_; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 46 | open NEWFILE, ">", "$filePath" or die "Could not create $filePath. $!\n"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 47 | print NEWFILE $contents; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 48 | close NEWFILE; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 49 | } | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 50 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 51 | setConfiguration(); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 52 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 53 | my $productDir = productDir(); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 54 | my $dumpTool = "$productDir/DumpRenderTree"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 55 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 56 | chdirWebKit(); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 57 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 58 | my @args = argumentsForConfiguration(); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 59 | system("WebKitTools/Scripts/build-dumprendertree", @args) == 0 or die "Failed to build DumpRenderTree";
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 60 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 61 | my @tests = ( | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 62 | "html5lib/runner", | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 63 | ); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 64 | |
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 65 | foreach my $test (@tests) {
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 66 | # This logic is super-dumb. Instead of making it smarter, we should | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 67 | # roll this into run-webkit-tests once we can run enough of the layout tests. | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 68 | my $testPath = "LayoutTests/$test.html"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 69 | my $expectedPath = "LayoutTests/$test-expected-html5.txt"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 70 | my $actualPath = "LayoutTests/$test-actual-html5.txt"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 71 | my $command = "DYLD_FRAMEWORK_PATH=$productDir $dumpTool --html5-treebuilder $testPath"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 72 | print $command, "\n"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 73 | my $output = `$command`; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 74 | writeToFile($actualPath, $output); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 75 |     if (-r $expectedPath) {
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 76 | my $expectedOutput = `cat $expectedPath`; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 77 |         if ($expectedOutput eq $output) {
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 78 | print "$test -> PASS\n"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 79 |         } else {
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 80 | print "$test -> FAIL, diff:\n"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 81 |             system("diff -u $expectedPath $actualPath");
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 82 | } | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 83 |     } else {
 | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 84 | print "$test -> NEW, results:\n"; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 85 | writeToFile($expectedPath, $output); | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 86 | print $output; | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 87 | } | 
| 
4f2f89ce4247
Revision: 201037
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: diff
changeset | 88 | } |